1、创建用户
create user KD identified by 123456;
2、授予连接数据库的权限
grant connect to KD;
3、将Scott用户的emp表授权给KD可以查询
grant select on scott.emp to KD;
grant create table to KD;
4、回收权限
revoke select on scott.emp from KD;
5、表的增删改权限授权
grant select,inset,delete,update on scott.emp to KD;
revoke select,inset,delete,update on scott.emp from KD;
6、删除用户
SQL 错误: ORA-01940: 无法删除当前连接的用户
退出已经连接得KD用户后再执行
drop user KD;
会提示:错误: ORA-01922: 必须指定 CASCADE 以删除 'KD'
drop user KD cascade;
7、查看当前用户所拥有的权限
select * from session_privs;
8、查看当前用户所拥有的角色
select * from user_role_privs;
9、查看角色所有的权限
select * from dba_sys_privs;
select * from dba_sys_privs where grantee='CONNECT';
--create session select * from dba_sys_privs where grantee='RESOURCE'; /*
create trigger
create sequence
create type
create procedure
create cluster
create operator
create indextype
create table
*/ select * from dba_sys_privs where grantee='DBA';
--有最高权限 所有的权限都有 创建一个开发人员并授权:
create user CURRY identified by 123456;
create connet,resource to CURRY; 10、用户解锁
alter user HR account unlock;
11、修改用户密码
alter user HR identified by 123456;
|