部分内容,收集自网络。
一、查看用户
1.查看所有用户:
select * from dba_users;
select * from all_users;
select * from user_users;
二、查看角色
1.当前用户被激活的全部角色 SESSION_ROLES describes the roles that are currently enabled to the user.
select * from session_roles;
2.当前当前用户被授予的角色 USER_ROLE_PRIVS describes the roles granted to the current user.
select * from user_role_privs;
3.全部用户被授予的角色 。DBA_ROLE_PRIVS describes the roles granted to all users and roles in the database.
select * from dba_role_privs;
4、查看某个用户所拥有的角色
select * from dba_role_privs where grantee='用户名';
5、查看某个角色所拥有的权限 DBA_SYS_PRIVS describes system privileges granted to users and roles.
select * from dba_sys_privs where grantee='CONNECT';
6.查看所有角色 DBA_ROLES describes all roles in the database.
select * from dba_roles;
三、查看权限
1.基本权限查询:
select * from session_privs; --SESSION_PRIVS describes the privileges that are currently available to the user.
select * from user_sys_privs;
select * from user_tab_privs;-- USER_TAB_PRIVS describes the object grants for which the current user is the object owner, grantor, or grantee
select * from dba_sys_privs ;
select * from role_sys_privs;--ROLE_SYS_PRIVS describes system privileges granted to roles. Information is provided only about roles to which the user has access.
2. 查看用户的系统权限(直接赋值给用户或角色的系统权限)
select * from dba_sys_privs;
select * from user_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;
END