Oracle权限相关查询
Posted ClarkYu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle权限相关查询相关的知识,希望对你有一定的参考价值。
Oracle权限相关查询着实视图有点多,记录下常用的语句,方便查询:
1.查看所有用户:
select * from dba_users;
select * from all_users;
select * from user_users;
2.查看用户或角色系统权限(直接赋值给用户或角色的系统权限):
select * from dba_sys_privs;
select * from user_sys_privs;
3.查看角色(只能查看登陆用户拥有的角色)所包含的权限
select * from role_sys_privs where role=‘DBA‘;
4.查看用户对象权限:
select * from dba_tab_privs;
select * from all_tab_privs;
select * from user_tab_privs;
5.查看所有角色:
select * from dba_roles;
6.查看用户或角色所拥有的角色:
select * from dba_role_privs;
select * from user_role_privs;
7.查看哪些用户有sysdba或sysoper系统权限(查询时需要相应权限)
select * from V$PWFILE_USERS;
比如我要查看用户 XXX的拥有的权限:
select * from dba_sys_privs where grantee=‘XXX‘;
GRANTEE PRIVILEGE ADMIN_OPTION
------------------------------ ---------------------------------------- ------------
XXX CREATE TRIGGER NO
XXX UNLIMITED TABLESPACE NO
比如我要查看用户 XXX的拥有的角色:
select * from dba_role_privs where grantee=‘XXX‘;
GRANTEE GRANTED_ROLE ADMIN_OPTION DEFAULT_ROLE
------------------------------ ------------------------------ ------------ ------------
XXX DBA NO YES
查看一个用户所有的权限及角色
select privilege from dba_sys_privs where grantee=‘XXX‘
union
select privilege from dba_sys_privs where grantee in
(select granted_role from dba_role_privs where grantee=‘XXX‘ );
以上是关于Oracle权限相关查询的主要内容,如果未能解决你的问题,请参考以下文章