您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
1.查看所有用户: select * from dba_users; select * from all_users; select * from user_users; 2.查看用户或角色系统权限(直接赋值给用户或角色的系统权限): select * from dba_sys_privs; select * from user_sys_privs; SQL> select * from user_sys_privs; USERNAME PRIVILEGE ADM ------------------------------ ---------------------------------------- --- ZDZQ UNLIMITED TABLESPACE NO 3.查看角色(只能查看登陆用户拥有的角色)所包含的权限 sql>select * from role_sys_privs; 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; --查询拥有DBA权限的用户 SQL> select * from dba_role_privs where granted_role='DBA'; GRANTEE GRANTED_ROLE ADM DEF ------------------------------ ------------------------------ --- --- SYS DBA YES YES SYSTEM DBA YES YES ZSZQ DBA NO YES KSWORK
7.查看哪些用户有sysdba或sysoper系统权限(查询时需要相应权限) select * from V$PWFILE_USERS 比如我要查看用户 wzsb的拥有的角色: SQL> select * from dba_sys_privs where grantee='ZSZQ'; GRANTEE PRIVILEGE ADM ------------------------------ ---------------------------------------- --- ZSZQ UNLIMITED TABLESPACE NO 查看一个用户所有的权限及角色 select privilege from dba_sys_privs where grantee = 'ZSZQ' union select privilege from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee = 'ZSZQ'); SQL> select * from dba_sys_privs where grantee='ZSZQ'; GRANTEE PRIVILEGE ADM ------------------------------ ---------------------------------------- --- ZSZQ UNLIMITED TABLESPACE NO 8、查看RESOURCE具有那些权限 SQL> SELECT * FROM DBA_SYS_PRIVS WHERE GRANTEE='RESOURCE'; GRANTEE PRIVILEGE ADM ------------------------------ ---------------------------------------- --- RESOURCE CREATE TRIGGER NO RESOURCE CREATE SEQUENCE NO RESOURCE CREATE TYPE NO RESOURCE CREATE PROCEDURE NO RESOURCE CREATE CLUSTER NO RESOURCE CREATE OPERATOR NO RESOURCE CREATE INDEXTYPE NO RESOURCE CREATE TABLE NO 已选择8行。 SQL> select * from role_sys_privs t1 where t1.role = 'RESOURCE'; ROLE PRIVILEGE ADM ------------------------------ ---------------------------------------- --- RESOURCE CREATE SEQUENCE NO RESOURCE CREATE TRIGGER NO RESOURCE CREATE CLUSTER NO RESOURCE CREATE PROCEDURE NO RESOURCE CREATE TYPE NO RESOURCE CREATE OPERATOR NO RESOURCE CREATE TABLE NO RESOURCE CREATE INDEXTYPE NO 已选择8行。
9.查看scott用户的默认表空间、临时表空间 select username, default_tablespace, temporary_tablespace from dba_users where username = 'SCOTT'; 10.查看scott用户的系统权限 select username,privilege,admin_option from user_sys_privs where username = 'SCOTT'; SQL> select username,privilege,admin_option 2 from user_sys_privs 3 where username = 'SCOTT'; USERNAME PRIVILEGE ADM ------------------------------ ---------------------------------------- --- SCOTT CREATE VIEW NO SCOTT UNLIMITED TABLESPACE NO 11.查看赋予scott用户的对象权限 select grantee,owner, table_name, t.grantor, t.privilege, t.grantable, t.hierarchy from dba_tab_privs t where t.grantee = 'SCOTT'; 12.查看授予了scott的角色权限 select t.grantee, t.granted_role, t.admin_option, t.default_role from dba_role_privs t where t.grantee = 'SCOTT'; SQL> select t.grantee, t.granted_role, t.admin_option, t.default_role 2 from dba_role_privs t 3 where t.grantee = 'SCOTT'; GRANTEE GRANTED_ROLE ADM DEF ------------------------------ ------------------------------ --- --- SCOTT RESOURCE NO YES SCOTT CONNECT NO YES SQL> select * from user_role_privs t; USERNAME GRANTED_ROLE ADM DEF OS_ ------------------------------ ------------------------------ --- --- --- ZSZQ CONNECT NO YES NO ZSZQ DBA NO YES NO ZSZQ EXP_FULL_DATABASE NO YES NO ZSZQ IMP_FULL_DATABASE NO YES NO ZSZQ RESOURCE NO YES NO 13.查看scott用户使用了哪些表空间 select t.table_name, t.tablespace_name from dba_all_tables t where t.owner = 'SCOTT' ; 14.查看当前用户拥有的权限 select t.privilege from session_privs t; SQL> select t.privilege from session_privs t; PRIVILEGE ---------------------------------------- CREATE SESSION UNLIMITED TABLESPACE CREATE TABLE CREATE CLUSTER CREATE VIEW CREATE SEQUENCE CREATE PROCEDURE CREATE TRIGGER CREATE TYPE CREATE OPERATOR CREATE INDEXTYPE 已选择11行。 15.查看角色(DBA)被赋予的角色权限 select * from role_role_privs t where t.role = 'DBA'; 查看角色(DBA)被赋予的对象权限 16.select * from role_tab_privs t1 where t1.role = 'DBA';
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。