如何创建只读权限oracle账户

1.创建角色
CREATE ROLE SELECT_ROLE
2.给角色分配权限

grant CREATE VIEW to SELECT_ROLE;
grant CREATE SYNONYM to SELECT_ROLE;

grant CONNECT TO SELECT_ROLE;
grant SELECT ANY DICTIONARY to SELECT_ROLE;
grant SELECT ANY TABLE to SELECT_ROLE;
grant SELECT ANY TRANSACTION to SELECT_ROLE;
grant SELECT ANY SEQUENCE to SELECT_ROLE;

 

3.把角色赋予指定账户

CREATE USER user IDENTIFIED BY user DEFAULT TABLESPACE xxx;
grant SELECT_ROLE to user;
4.删除角色
drop role SELECT_ROLE;

5.检查角色的权限
select * from dba_sys_privs where grantee='SELECT_ROLE'

测试权限的时候需要加上用户的对象例如
select count(*) from hr.ex_user;

posted @ 2019-01-31 15:35  特务小强  阅读(6993)  评论(0编辑  收藏  举报