查看当前用户的角色
sql>select * from user_role_privs;
sql>select * from session_privs
查看当前用户的权限和表级权限
sql>select * from user_sys_privs;
sql>select * from user_tab_privs;
附:
一、查看用户:
1.查看当前用户:
select * from v$session;
2.查看所有用户:
select * from dba_users;
select * from all_users;
select * from user_users;
二、查看角色:
1.当前用户被激活的全部角色
select * from session_roles;
2.当前用户被授予的角色
select * from user_role_privs;
2.全部用户被授予的角色
select * from dba_role_privs;
3.查看所有角色:
select * from dba_roles;
4. 查询当前角色被授予的角色
select granted_role from role_role_privs where role=&role;–例如role= ‘dba’
三、查看权限:
1.基本权限查询:
select * from session_privs;–当前用户所拥有的全部权限
select * from user_sys_privs;–当前用户的系统权限
select * from user_tab_privs;–当前用户的表级权限
select * from dba_sys_privs;–查询某个用户所拥有的系统权限
select * from role_sys_privs;–查看角色(只能查看登陆用户拥有的角色)所包含的权限
2.查看用户对象权限:
select * from dba_tab_privs;
select * from all_tab_privs;
select * from user_tab_privs;
3.查看哪些用户有sysdba或sysoper系统权限(查询时需要相应权限)
select * from v$pwfile_users
注意:
1、以下语句可以查看oracle提供的系统权限
select name from sys.system_privilege_map
2、查看一个用户的所有系统权限(包含角色的系统权限)
sql代码
select privilege from dba_sys_privs where grantee=’datauser’
union
select privilege from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee=’datauser’ );