用户级权限总结



/**/

--创建用户

create user keda identified by keda;

--查看系统权限

--select * from system_privilege_map;

--对shiyou用户授予登录数据库,创建表,操作表空间的权限

grant create session, create table, unlimited tablespace to xiyou;
grant create role to keda;

--撤销权限

--不能自己撤销自己
revoke create session from shiyou;


--需求:xiyou用户需要访问shiyou用户下的student对象
--
授予对象权限
--步骤:以shiyou登录,然后授予xiyou用户的select
--对象权限
grant select on student to xiyou;
 
--select * from shiyou.student;


--
撤销对象权限
revoke select on student from xiyou;

--select * from shiyou.student;  会出错

--授予keda用户connect角色和resource角色

grant connect,resource to keda;

--锁定用户

alter user shiyou account lock;

--解除用户锁定

alter user shiyou account unlock;
select sid,serial# from v$session where username='qrj';
alter system kill session '200,96';

--删除用户

drop user qrj cascade;

--自定义角色

create role qianqian not identified;
grant create session to qianqian with admin option;
grant select on keda.student to qianqian;
grant qianqian to xiyou;

select * from keda.student;
revoke qianqian from xiyou;

--修改密码

alter user keda identified by dake;

--with admin option用于系统权限授权
--with grant option用于对象权限授权
create role xx identified by xx;

grant create session to xx with admin option;
set role xx identified by 
grant select on keda.student to xx;
grant xx to xiyou;

select * from keda.student;

 

你可能感兴趣的:(Oracle数据库)