oracle 简单 doc 命令

oracle 简单 doc 命令


连接数库

sqlplus/ as sysdba;

创建用户(创建用户,口令为密码,设置默认表空间是users ,临时表空间是temp)。

create user 用户名
indetified by 密码
default tablespace users
temporary tablespace temp;

授予权限和角色

grant connect to 用户名;

授予用户connect角色,允许用户连接到数据库。

grant resource to 用户名;

授予用户resource角色,允许用户使用数据库中的表空间。

grant select on scott.emp to 用户名;

修改用户的口令

alter user 用户名 identified by 新口令;

修改用户状态
(锁定用户)

alter user 用户名 account lock;

(解锁定用户)

alter user 用户名 account unlock;

修改用户表空间

alter user  用户名 default tablespace users temporary tablespace temp;

删除用户

drop user 用户名 cascade;

授予权限 create session 和角色 dba 给数据库管理员。

grant create session,dba to 用户名;

权限回收

revoke insert on scott.emp from 用户名;

退出

exit;

查看当前登录用户

show user;

切换用户登录

connect 用户名/口令;

创建表空间:
(这里说一哈,在创建表空间的时候要保证存放路径存在,
就是下面例子存放的位置要保证d盘下有一个database文件夹)

create tablespace 表空间名
datafile '存放路径(Eg:[Eg: d:\database\datafiles_1])' size 50M;

创建临时表空间

create temporary tablespace 临时表空间名
tempfile '存放路径(Eg:[Eg: d:\database\usertemp_1.dbf ])'  size 50M;

表空间增加10M

alter tablespace  表空间名
add datafile  'filename1' size 50M;

设置表空间为默认的表空间

alter database default tablespace 表空间名;

删除表空间(这里提醒一哈,这里删除仅仅只是删除控制文件中的指针,
并没有删除物理文件,必修在操作系统中物理删除文件)

drop tablespace 表空间名 including contents;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值