共計(jì) 1276 個(gè)字符,預(yù)計(jì)需要花費(fèi) 4 分鐘才能閱讀完成。
這篇文章將為大家詳細(xì)講解有關(guān)如何進(jìn)行 Oracle 用戶角色權(quán)限管理,文章內(nèi)容質(zhì)量較高,因此丸趣 TV 小編分享給大家做個(gè)參考,希望大家閱讀完這篇文章后對相關(guān)知識(shí)有一定的了解。
1、查看所有用戶
SQL select USERNAME from users_users;
SQL alter user scott account lock;(用戶鎖定)
SQL alter user scott account unlock;(用戶解鎖)
2、查看所有角色,(角色:多個(gè)權(quán)限的集合)
SQL select ROLE from dba_roles;
3、查看可以賦予用戶的權(quán)限
SQL select PRIVILEGE from dba_sys_privs group by PRIVILEGE;
SQL select PRIVILEGE from dba_sys_privs where grantee = 角色名
4、查看當(dāng)前用戶所擁有的權(quán)限
SQL select PRIVILEGE from role_sys_privs;
5、查詢某個(gè)用戶所擁有的角色
SQL select * from dba_role_privs where grantee = SCOTT
GRANTEE GRANTED_ROLE ADMIN_ DEFAUL
——————– ——————– —— ——
SCOTT RESOURCE NO YES
SCOTT CONNECT NO YES
6、權(quán)限賦予
SQL grant select, update, insert on test to scott;// 對于 test 表賦予權(quán)限給 scott
SQL grant select, update, insert on test to scott with grant option;// 權(quán)限傳遞,scott 用戶也可以賦予以上權(quán)限給其他用戶
SQL grant all on test to public; // 所有用戶都能對表進(jìn)行查詢,插入,更新等操作,但不包括刪除表
SQL select owner, table_name from all_tables; // 用戶可以查詢的表
SQL select table_name from user_tables; // 用戶創(chuàng)建的表
SQL grant dba to scott;//DBA 角色的授權(quán)
7、權(quán)限收回
SQL Revoke select, update, insert on test to scott;// 收回權(quán)限,如果有權(quán)限傳遞,也將會(huì)丟失
8、角色管理
SQL create role test;// 創(chuàng)建角色
SQL grant insert on scott.emp to test;// 賦予角色權(quán)限
SQL revoke insert on scott.emp to test;// 收回角色權(quán)限
SQL grant test to jack;// 將角色的所有權(quán)限賦予 jack 用戶
關(guān)于如何進(jìn)行 Oracle 用戶角色權(quán)限管理就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。