概要檔案用於限制由使用者使用的系統和資料庫資源,並可以對口令進行管理。如果在建立使用者時沒有 指定概要檔案,
將使用預設的概要檔案。
1、使用create profile命令建立概要檔案
文法格式如下:
create profile profile_name limit resource_parameters | password_parameters;
其中,resource_parameters用來指定資源限制的參數,password_parameters用來指定口令參數。
(1)resource_parameters的文法格式如下:
[sessions_per_user integer | unlimited | default] --限制一個使用者並發會話個數*/ [cpu_per_session integer | unlimited | default] --限制一次會話的cpu時間,以s/100為單位*/ [cpu_per_call integer | unlimited | default] --限制一次調用的cpu時間*/ [connect_time integer | unlimited | default] --限制一次會話持續的時間,以min為單位*/ [idle_time integer | unlimited | default] --限制一次會話的連續不啟用時間,以min為單位*/ [logical_reads_per_session integer | unlimited | default] --規定一次會話中讀取資料區塊的數目,包括從記憶體和磁碟中讀取的塊數*/ [logical_reads_per_call integer | unlimited | default] --規定處理一個SQL語句一次調用所讀的資料區塊的數目*/ [composite_limit integer | unlimited | default] --規定一次會話的資源開銷,以服務單位表示該參數值*/ [private_sga integer {K|M} | unlimited | default ] --規定一次會話在系統全域區的共用池可分配的私人空間的數目*/
(2)password_parameters的文法格式如下:
[failed_login_attempts expression | unlimited | default] --在鎖定賬戶前允許登入失敗的次數,預設是10次*/ [password_life_time expression | unlimited | default] --設定口令的有效期間,以天為單位,有效期間過後將強制修改密碼,預設180天*/ [password_reuse_time expression | unlimited | default] --規定口令不被重複使用的天數,預設無限制*/ [password_reuse_max expression | unlimited | default] --規定口令被重新使用前需要更改口令的次數,預設無限制*/ [password_lock_time expression | unlimited | default] --指定由於多次登入失敗而鎖定賬戶的天數,預設1天*/ [password_grace_time expression | unlimited | default] --設定口令的到期寬限時間,單位為天,預設7天*/ [password_verify_function functionName | null | default] --使用function來校正口令的複雜度,null表示沒有校正*/
範例程式碼:
create profile myprofile limit password_login_attempts 5 password_lock_time 5; alter user hello profile myprofile;
說明:
上述代碼建立了一個名為myprofile的概要檔案,並把它提供給使用者hello使用,該檔案指明如果使用者 hello連續5次登入失敗,則使用者hello將被鎖定5天。
2、使用alter profile命令修改概要檔案
文法格式如下:
alter profile profile_name limit resource_parameters | password_parameters;
範例程式碼:
修改概要檔案myprofile,設定口令到期寬限時間為10天,設定每60天修改一次密碼,代碼如下:
alter profile myprofile limit password_grace_time 10 password_life_time 60;
3、使用drop profile命令刪除概要檔案
文法格式如下:
drop profile profile_name;
例如,刪除概要檔案myprofile如下:
drop profile myprofile;
查看本欄目更多精彩內容:http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/