Oracle收回权限 & 创建角色

0、收回权限

SELECT 'REVOKE '||PRIVILEGE||' FROM BAIPX;' FROM dba_sys_privs  WHERE GRANTEE='BAIPX';

1、收回dba权限

revoke dba from BAIPX;

2、创建角色并授权相关权限

create role BAIPX_ROLE;

grant select on v_$sysstat to BAIPX_ROLE;
grant delete any table to BAIPX_ROLE; 
grant insert any table to BAIPX_ROLE; 
grant select any table to BAIPX_ROLE;
grant unlimited tablespace to BAIPX_ROLE;
grant execute any procedure to BAIPX_ROLE;
grant update any table to BAIPX_ROLE;
grant SELECT ANY TABLE to BAIPX_ROLE;
grant CREATE VIEW to BAIPX_ROLE;
grant ALTER SESSION to BAIPX_ROLE;
grant DROP PUBLIC SYNONYM to BAIPX_ROLE;
grant CREATE DATABASE LINK to BAIPX_ROLE;
grant CREATE ANY DIRECTORY to BAIPX_ROLE;
grant SELECT ANY DICTIONARY to BAIPX_ROLE;
grant CREATE SYNONYM to BAIPX_ROLE;
grant CREATE PUBLIC SYNONYM to BAIPX_ROLE;
grant CREATE TYPE to BAIPX_ROLE;
grant CREATE LIBRARY to BAIPX_ROLE;
grant CREATE PUBLIC DATABASE LINK to BAIPX_ROLE;
grant CREATE TRIGGER to BAIPX_ROLE;
grant DEBUG CONNECT SESSION to BAIPX_ROLE;
grant CREATE TABLE to BAIPX_ROLE;
grant CREATE CLUSTER to BAIPX_ROLE;
grant CREATE SESSION to BAIPX_ROLE;
grant CREATE SEQUENCE to BAIPX_ROLE;
grant DROP PUBLIC DATABASE LINK to BAIPX_ROLE;
grant CREATE PROCEDURE to BAIPX_ROLE;

3、把角色授予给用户

grant BAIPX_ROLE to BAIPX;

grant connect, resource to BAIPX;

grant unlimited tablespace to BAIPX;

4、查看用户权限

###查询某用户的被赋予的系统权限

select * from dba_sys_privs where GRANTEE='BAIPX';

###查询某用户被赋予的角色权限

select * from dba_role_privs where GRANTEE='BAIPX';

###查询角色内包含的权限

select * from role_sys_privs  where role='BAIPX';

授予相同权限

select table_name from dict where table_name like '%PRIVS%';
select 'grant '|| PRIVILEGE|| ' ' || ' on ' || OWNER||'.'|| TABLE_NAME||' TO ' ||  GRANTEE|| ';'from dba_tab_privs where grantee='WSCRM';
select 'grant '|| GRANTED_ROLE || ' to ' || GRANTEE||';' from dba_role_privs where grantee='WSCRM';
select 'grant '|| privilege|| ' to ' || grantee||';' from dba_sys_privs where grantee='WSCRM';
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值