1.查看所有用戶:
select * from dba_users;
select * from all_users;
select * from user_users;
2.查看用戶或角色系統(tǒng)權(quán)限(直接賦值給用戶或角色的系統(tǒng)權(quán)限):
select * from dba_sys_privs;
select * from user_sys_privs;
SQL> select * from user_sys_privs;
USERNAME PRIVILEGE ADM
------------------------------ ---------------------------------------- ---
ZDZQ UNLIMITED TABLESPACE NO
3.查看角色(只能查看登陸用戶擁有的角色)所包含的權(quán)限
sql>select * from role_sys_privs;
4.查看用戶對象權(quán)限:
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權(quán)限的用戶
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系統(tǒng)權(quán)限(查詢時需要相應(yīng)權(quán)限)
select * from V$PWFILE_USERS
比如我要查看用戶 wzsb的擁有的角色:
SQL> select * from dba_sys_privs where grantee='ZSZQ';
GRANTEE PRIVILEGE ADM
------------------------------ ---------------------------------------- ---
ZSZQ UNLIMITED TABLESPACE NO
查看一個用戶所有的權(quán)限及角色
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具有那些權(quán)限
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用戶的默認(rèn)表空間、臨時表空間
select username, default_tablespace, temporary_tablespace
from dba_users
where username = 'SCOTT';
10.查看scott用戶的系統(tǒng)權(quán)限
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用戶的對象權(quán)限
select grantee,owner, table_name, t.grantor, t.privilege, t.grantable, t.hierarchy
from dba_tab_privs t
where t.grantee = 'SCOTT';
12.查看授予了scott的角色權(quán)限
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.查看當(dāng)前用戶擁有的權(quán)限
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)被賦予的角色權(quán)限
select * from role_role_privs t where t.role = 'DBA';
查看角色(DBA)被賦予的對象權(quán)限
16.select * from role_tab_privs t1 where t1.role = 'DBA';
創(chuàng)新互聯(lián)建站是專業(yè)的海南州網(wǎng)站建設(shè)公司,海南州接單;提供成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站,網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行海南州網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
當(dāng)前題目:查詢oracle用戶角色權(quán)限-創(chuàng)新互聯(lián)
地址分享:
http://weahome.cn/article/ccogic.html