標籤:
--使用者(user)SQL> --建立一個名為 grace password是password 的使用者,新使用者沒有不論什麼許可權SQL> create user grace identified by password;驗證使用者:password驗證方式(username/password)外部驗證方式(主機認證,即通過登陸的username)全域驗證方式(其它方式:生物認證方式、token方式)優先順序順序:外部驗證>password驗證--許可權(privilege)使用者權限有兩種:System:同意使用者運行對於資料庫的特定行為,比如:建立表、建立使用者等Object:同意與使用者訪問和操作一個特定的對象,比如:對其它方案下的表的查詢SQL> --給grace使用者授予系統許可權SQL> --create session SQL> grant create session to grace;SQL> --create tableSQL> grant create table to grace ;SQL> --分配空間(改動使用者grace的空間為不限制)SQL> alter user grace quota unlimited on users;SQL> --對象許可權SQL> --將目前使用者emp表的查詢的許可權授予grace使用者SQL> grant select on emp to grace;SQL> --admin option 系統許可權 不會級聯SQL> -- DBA --> create session --> jeff:管理員授予jeff登陸許可權SQL> grant create session to jeff with admin option;SQL> -- jeff --> create session --> emi:jeff授予emi登陸許可權SQL> grant create session to emi;SQL> --管理員撤銷jeff的登陸許可權。此時emi的登陸許可權還在。不會被串聯刪除SQL> revoke create session from jeff;SQL> --GRANT OPTION 撤銷對象許可權會產生級聯SQL> -- scott-->select on emp ---> jeff:scott使用者授予jeff查詢emp表的許可權SQL> grant select on emp to jeff with grant option;SQL> --jeff:-->select on scott.emp --> emi:jeff授予emi查詢scott的emp表的許可權SQL> grant select on scott.emp to emi;SQL> --scott撤銷jeff的查詢emp表的許可權,此時emi的查詢許可權也被刪除SQL> revoke select on emp from jeff;--角色(role)SQL> --刪除角色SQL> drop role hr_clerk;SQL> --建立經理角色SQL> create role hr_mgr;SQL> --建立普通員工角色SQL> create role hr_clerk;SQL> --兩個許可權 create session, create tableSQL> --授予普通員工角色登陸許可權SQL> grant create session to hr_clerk;SQL> --授予經理建立表的許可權和普通員工角色的許可權SQL> grant create table,hr_clerk to hr_mgr;SQL> --grant connect,resouce to scott;connect,resouce系統定義好的角色SQL> --建立使用者並授予許可權(普通使用者能做的準系統都有)SQL> /*SQL> create user ****SQL> grant connect,resouce to ***;SQL> */--概要檔案和使用者--每一個使用者僅僅能被關聯到一個概要檔案--概要檔案:管理賬戶狀態和password有效期間;控制資源消費。
Oracle學習(十四):系統管理使用者安全性