1 建立使用者
create user tom
identified by 密碼
default tablespace 資料表空間
temporary tablespace 暫存資料表空間
quota 20m on 資料表空間
password expire;
其中 quota表明只能使用某個資料表空間指定大小的磁碟空間.
改變其配額
alter user tom quota 新數值 on 資料表空間.
2 刪除使用者 drop user tom;
3 概要檔案
概要檔案主要是用來限制資源或密碼等的.
比如create profile abc limit
sessions_per_user 8
cpu_per_session 16800
logical_reads_per_session 23688
connect_time 268
idele_time 38;
這裡說明每個session只能開啟8個會話,每個會話最多可以使用CPU時間為168S,每個會話最多可以讀23688個資料區塊,每個會話的
連線時間為268分,每個會話的沒有活動的時間不能超過38分鐘.
4 口令概要檔案的管理
典型的有failed_login_attempts 可以失敗登陸的次數
passwrod_lock_time unlimited 在嘗試登陸指定的次數失敗後,帳戶將被鎖住.
passwrod_life_time 口令多少天有效
password_reuse_time 口令作廢多少天后可以重新使用.
5 授予系統許可權.
create user tom identified by 密碼;
如果要實現授權的傳遞,必須要加with admin option子句.
查看某個使用者擁有的許可權
select * from dba_sys_privs where grantee='TOM'(注意大寫);
回收許可權
revoke 要回收的許可權 from 使用者;
查看授予許可權的使用者和被賦予許可權使用者的資訊
select * from user_col_privs_made;
6 管理角色
create role sales identified by 密碼;
授予角色許可權
grant create session,create table,create view to sales;
查看角色的許可權
select * from role_sys_privs where role in ('SALES');
修改預設角色
alter user tom default role all;
alter user tom default role all except sales;(除了sales)
預設角色的應用.
比如有兩個角色sales,manager,如果sales有select許可權,manager有update,delete許可權,
如果把manager設定為非預設角色(alter user tom default role all execept manager)
,則假如屬於sales角色的使用者tom是只有select許可權的,
要讓TOM有update,delete許可權,必須
set role manager identified by 密碼;
啟用manager角色
啟用或禁止角色
首先查看使用者有的系統許可權
select * from session_privs;
set role all except manager(啟用除了manager以外的所有角色)
角色的回收
revoke manager,sales from tom;