linux下Oracle常用命令
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash

·
1、启动oracle数据库:
//切换至Oracle用户:
[root@server36 ~]# su - oracle
//进入sqlplus环境,nolog参数表示不登录:
[oracle@server36 ~]$ sqlplus /nolog
//以管理员模式登录:
[oracle@server36 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Fri Apr 17 10:13:07 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected.
//启动数据库
SQL> startup
//停止数据库
SQL> shutdown immediate
2、数据库监听
//启动监听服务
[root@server36 ~]# su - oracle
[oracle@server36 ~]$ lsnrctl start
//停止监听服务
[oracle@server36 ~]$ lsnrctl stop
//查看监听状态
[oracle@server36 ~]$ lsnrctl status
3、用户权限管理
注:以下命令都需要DBA权限。
//创建用户
create user ittbank identified by 123456 ;
//赋予用户的表空间权限
alter user ittbank default tablespace ittbank;;
//或者两条命令合并为
create user ittbank identified by 123456 default tablespace ittbank;
注:新创建的用户是没有任何权限的,登录的权限都没有。因此需要再继续做授权操作,但必须是具有授权能力的用户,例如:sys、system;角色是指由系统权限集合,通常给某个用户授权时,如果没有角色存在的话,则需要一条条的操作。通常一个角色由多个系统权限组成。常用的角色有三个connect(7种权限),dba,resource(在任何表空间建表)。
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
//授予用户管理权限
grant connect,resource,dba to ittbank ;
//删除用户
drop user“name”cascade;
注:cascade参数是级联删除该用户所有对象,经常遇到如用户有对象而未加此参数则用户删不了的问题,所以习惯性的加此参数。“name”的引号有无都是一样的。
4、数据表及表空间
//创建表空间
create tablespace ittbank datafile '/u01/app/oracle/oradata/ORCL/ittbank.dbf' size 300m autoextend on;
注:说明:末尾带autoextend on参数表示当表空间大小不够用时会自动扩容,所有建议加上autoextend on参数。
//查询当前表空间
select * from v$tablespace;
//查询所有表空间
select * from sys.dba_tablespaces; --查询表空间
//查看用户当前连接数
select count(*) from sys.v_$session;
阅读全文
AI总结




A beautiful web dashboard for Linux
最近提交(Master分支:7 个月前 )
186a802e
added ecosystem file for PM2 5 年前
5def40a3
Add host customization support for the NodeJS version 5 年前
更多推荐
相关推荐
查看更多
linux-dash

A beautiful web dashboard for Linux
linux-dash

A beautiful web dashboard for Linux
linux-dash

所有评论(0)