用户级权限总结



/**/

--创建用户

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;

 
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值