下面一起來了解下如何管理數(shù)據(jù)庫權(quán)限與角色,相信大家看完肯定會(huì)受益匪淺,文字在精不在多,希望如何管理數(shù)據(jù)庫權(quán)限與角色這篇短內(nèi)容是你想要的。
為西區(qū)等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計(jì)制作服務(wù),及西區(qū)網(wǎng)站建設(shè)行業(yè)解決方案。主營(yíng)業(yè)務(wù)為網(wǎng)站制作、成都做網(wǎng)站、西區(qū)網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠(chéng)的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!
授予用戶的系統(tǒng)權(quán)限 SQL> grant create table,create sequence,create view to tpcc; Grant succeeded. 查詢授予用戶的系統(tǒng)權(quán)限 SQL> col grantee for a20 SQL> col privilege for a30 SQL> col admin_option for a15 SQL> select * from dba_sys_privs where grantee ='TPCC'; GRANTEE PRIVILEGE ADMIN_OPTION --------------- ------------------------------ --------------- TPCC CREATE TABLE NO TPCC UNLIMITED TABLESPACE NO TPCC CREATE VIEW NO TPCC ALTER SESSION NO TPCC CREATE SEQUENCE NO 撤銷授予用戶的系統(tǒng)權(quán)限 SQL> revoke create sequence from tpcc; Revoke succeeded. SQL> select * from dba_sys_privs where grantee ='TPCC'; GRANTEE PRIVILEGE ADMIN_OPTION --------------- ------------------------------ --------------- TPCC CREATE TABLE NO TPCC UNLIMITED TABLESPACE NO TPCC CREATE VIEW NO TPCC ALTER SESSION NO 授予用戶的對(duì)象權(quán)限 SQL> grant select on scott.emp to tpcc; Grant succeeded. 查詢授予用戶的對(duì)象權(quán)限 SQL> col owner for a20 SQL> col table_name for a20 SQL> col grantee for a15 SQL> col grantor for a15 SQL> col privilege for a30 SQL> select grantee,owner,table_name,grantor,privilege from dba_tab_privs where grantee = 'TPCC'; GRANTEE OWNER TABLE_NAME GRANTOR PRIVILEGE --------------- -------------------- -------------------- --------------- ------------------------------ TPCC SYS DBMS_LOCK SYS EXECUTE TPCC SCOTT EMP SCOTT SELECT 撤銷授予用戶的對(duì)象權(quán)限 SQL> revoke select on scott.emp from tpcc; Revoke succeeded. SQL> select grantee,owner,table_name,grantor,privilege from dba_tab_privs where grantee = 'TPCC'; GRANTEE OWNER TABLE_NAME GRANTOR PRIVILEGE --------------- -------------------- -------------------- --------------- ------------------------------ TPCC SYS DBMS_LOCK SYS EXECUTE 查詢數(shù)據(jù)庫的角色 SQL> col role for a30 SQL> select * from dba_roles; ROLE PASSWORD_REQUIRED AUTHENTICATION_TYPE ------------------------------ ------------------------ --------------------------------- CONNECT NO NONE RESOURCE NO NONE DBA NO NONE SELECT_CATALOG_ROLE NO NONE EXECUTE_CATALOG_ROLE NO NONE DELETE_CATALOG_ROLE NO NONE EXP_FULL_DATABASE NO NONE IMP_FULL_DATABASE NO NONE LOGSTDBY_ADMINISTRATOR NO NONE DBFS_ROLE NO NONE AQ_ADMINISTRATOR_ROLE NO NONE 查詢授予角色的權(quán)限 SQL> select * from role_sys_privs where role in ('CONNECT','RESOURCE'); ROLE PRIVILEGE ADMIN_OPTION ------------------------------ ------------------------------ --------------- RESOURCE CREATE SEQUENCE NO RESOURCE CREATE TRIGGER NO RESOURCE CREATE CLUSTER NO RESOURCE CREATE PROCEDURE NO RESOURCE CREATE TYPE NO CONNECT CREATE SESSION NO RESOURCE CREATE OPERATOR NO RESOURCE CREATE TABLE NO RESOURCE CREATE INDEXTYPE NO 查詢授予用戶的角色 SQL> col admin_option for a15 SQL> col default_role for a15 SQL> col granted_role for a30 SQL> select * from dba_role_privs where grantee = 'TPCC'; GRANTEE GRANTED_ROLE ADMIN_OPTION DEFAULT_ROLE --------------- ------------------------------ --------------- --------------- TPCC RESOURCE NO YES TPCC CONNECT NO YES 查詢用戶獲得的權(quán)限 SQL> conn tpcc/tpcc Connected. SQL> select * from session_privs; PRIVILEGE ------------------------------ CREATE SESSION ALTER SESSION UNLIMITED TABLESPACE CREATE TABLE CREATE CLUSTER CREATE VIEW CREATE SEQUENCE CREATE PROCEDURE CREATE TRIGGER CREATE TYPE CREATE OPERATOR PRIVILEGE ------------------------------ CREATE INDEXTYPE
看完如何管理數(shù)據(jù)庫權(quán)限與角色這篇文章后,很多讀者朋友肯定會(huì)想要了解更多的相關(guān)內(nèi)容,如需獲取更多的行業(yè)信息,可以關(guān)注我們的行業(yè)資訊欄目。