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
KSWORK7.查看哪些用户有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';
创新互联建站是专业的海南州网站建设公司,海南州接单;提供成都网站设计、成都做网站,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行海南州网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
分享文章:查询oracle用户角色权限-创新互联
网站URL:
http://bjjierui.cn/article/ccogic.html