部分內容,收集自網絡。
一、查看用戶
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