常用的系统权限集合有以下三个:
CONNECT(基本的连接), RESOURCE(程序开发), DBA(数据库管理)
常用的数据对象权限有以下五个:
ALL ON 数据对象名, SELECT ON 数据对象名, UPDATE ON 数据对象名,
DELETE ON 数据对象名, INSERT ON 数据对象名, ALTER ON 数据对象名
GRANT CONNECT, RESOURCE TO 用户名;
GRANT SELECT ON 表名 TO 用户名;
GRANT SELECT, INSERT, DELETE ON表名 TO 用户名1, 用户名2;
2.REVOKE 回收权限
REVOKE CONNECT, RESOURCE FROM 用户名;
REVOKE SELECT ON 表名 FROM 用户名;
REVOKE SELECT, INSERT, DELETE ON 表名 FROM 用户名1, 用户名2;
可参照另一篇文章:oracle用户具有的权限和角色
select * from dba_sys_privs;
select * from dba_tab_privs;
SELECT DISTINCT(grantee) FROM dba_tab_privs;
SELECT DISTINCT(owner) FROM dba_tab_privs;
--TLOANCDE,TLOANDATA
SELECT DISTINCT(privilege) FROM dba_tab_privs;
/*
FLASHBACK
EXECUTE
ALTER
ON COMMIT REFRESH
DEQUEUE
DELETE
UPDATE
DEBUG
QUERY REWRITE
SELECT
USE
READ
INSERT
WRITE
INDEX
REFERENCES
MERGE VIEW
*/
SELECT * FROM dba_tab_privs
WHERE owner = 'TLOANCDE' OR owner = 'TLOANDATA'
ORDER BY grantee,table_name,privilege;
SELECT *
FROM dba_tab_privs
WHERE owner = 'TLOANDATA' AND TABLE_NAME = 'DAMS_D10_SEQUENCE'
-------------------------------------------------------------
--(1).查看当前的 user下 某表的 权限--关注要删除的用户A的X权限
SELECT *
FROM dba_tab_privs
WHERE owner = 'TLOANDATA' AND TABLE_NAME = 'DAMS_D20_SEQUENCE'
--(2).执行 回收权限
REVOKE alter on TLOANDATA.DAMS_D20_SEQUENCE from DEVSUP02;
--(3).验证结果:关注要删除的A用户的X权限
SELECT *
FROM dba_tab_privs
WHERE owner = 'TLOANDATA' AND TABLE_NAME = 'DAMS_D20_SEQUENCE'
--(4).恢复测试环境数据
GRANT alter on TLOANDATA.DAMS_D20_SEQUENCE TO DEVSUP02;
--5.验证恢复无误,查询结果 同1
SELECT *
FROM dba_tab_privs
WHERE owner = 'TLOANDATA' AND TABLE_NAME = 'DAMS_D20_SEQUENCE'