Oracle to view the permissions or roles of the currently logged in user

Reprinted: http://blog.itpub.net/29500582/viewspace-1314555/

Oracle to view the permissions or roles of the currently logged in user


View the roles of the current user 
SQL>select * from user_role_privs; 
SQL>select * from session_privs 

View the system permissions and table-level permissions of the current user 
SQL>select * from user_sys_privs; 
SQL>select * from user_tab_privs; 
Attachment:

1. View users:
1 .View current users:
  select * from v$session; 2.View
all users:
  select * from dba_users;
  select * from all_users;
  select * from user_users;2.View

roles: 1.All roles
activated by the current user
  select * from session_roles;
2. The roles granted by the current user
  select * from user_role_privs;
2. The roles granted by all users
  select * from dba_role_privs;
3. View all roles:
  select * from dba_roles;
4. Query the roles granted by the current role
  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' );   

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326710350&siteId=291194637