Oracle 密码设置管理.docx
- 文档编号:26195482
- 上传时间:2023-06-17
- 格式:DOCX
- 页数:7
- 大小:16.99KB
Oracle 密码设置管理.docx
《Oracle 密码设置管理.docx》由会员分享,可在线阅读,更多相关《Oracle 密码设置管理.docx(7页珍藏版)》请在冰豆网上搜索。
Oracle密码设置管理
Oracle密码设置管理
使用脚本utlpwdmg.sql可以方便地启动数据库的密码管理。
该脚本位于$ORACLE_HOME/rdbms/admin目录下。
启动密码管理以前:
SQLselect*fromv$version;
-------------------------------------
OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Prod
PL/SQLRelease10.2.0.1.0-Production
CORE 10.2.0.1.0 Production
TNSforLinux:
Version10.2.0.1.0-Production
NLSRTLVersion10.2.0.1.0-Production
SQL>select*fromdba_profileswhereresource_type='PASSWORD';
PROFILE RESOURCE_NAME RESOURCELIMIT
--------------------------------------------------------------------------------------------------------------
DEFAULT FAILED_LOGIN_ATTEMPTS PASSWORD10
DEFAULT PASSWORD_LIFE_TIME PASSWORDUNLIMITED
DEFAULT PASSWORD_REUSE_TIME PASSWORDUNLIMITED
DEFAULT PASSWORD_REUSE_MAX PASSWORDUNLIMITED
DEFAULT PASSWORD_VERIFY_FUNCTION PASSWORDNULL
DEFAULT PASSWORD_LOCK_TIME PASSWORDUNLIMITED
DEFAULT PASSWORD_GRACE_TIME PASSWORDUNLIMITED
--启用密码管理:
SQL>@?
/rdbms/admin/utlpwdmg.sql
Functioncreated
Profilealtered
启动后:
SQL>select*fromdba_profileswhereresource_type='PASSWORD';
PROFILE RESOURCE_NAME RESOURCELIMIT
--------------------------------------------------------------------------------------------------------------
DEFAULT FAILED_LOGIN_ATTEMPTS PASSWORD3
DEFAULT PASSWORD_LIFE_TIME PASSWORD90
DEFAULT PASSWORD_REUSE_TIME PASSWORD1800
DEFAULT PASSWORD_REUSE_MAX PASSWORDUNLIMITED
DEFAULT PASSWORD_VERIFY_FUNCTION PASSWORDVERIFY_FUNCTION
DEFAULT PASSWORD_LOCK_TIME PASSWORD.0006
DEFAULT PASSWORD_GRACE_TIME PASSWORD10
如果新设定的密码不符合复杂性检验规则,就会报错。
例如:
SQL>alteruserlhidentifiedbylh;
alteruserlhidentifiedbylh
ORA-28003:
passwordverificationforthespecifiedpasswordfailed
ORA-20001:
Passwordsameasorsimilartouser
--取消密码管理:
SQL>alterprofileDEFAULTlimit
如:
SQL>alterprofileDEFAULTlimitpassword_reuse_timeunlimited;
停止密码检验函数:
SQL>alterprofileDEFAULTlimitpassword_verify_functionnull;
熟悉utlpwdmg.sql脚本有助我们更深入了解oracle密码检查机制。
我们可以修改或自定义密码检验函数。
附utlpwdmg.sql脚本内容(红色自己是我修改的):
Rem
Rem$Header:
utlpwdmg.sql31-aug-2000.11:
00:
47nirelandExp$
Rem
Remutlpwdmg.sql
Rem
RemCopyright(c)OracleCorporation1996,2000.AllRightsReserved.
Rem
Rem NAME
Rem utlpwdmg.sql-scriptforDefaultPasswordResourceLimits
Rem
Rem DESCRIPTION
Rem Thisisascriptforenablingthepasswordmanagementfeatures
Rem bysettingthedefaultpasswordresourcelimits.
Rem
Rem NOTES
Rem Thisfilecontainsafunctionforminimumcheckingofpassword
Rem complexity.Thisismoreofasamplefunctionthatthecustomer
Rem canusetodevelopthefunctionforactualcomplexitychecksthatthe
Rem customerwantstomakeonthenewpassword.
Rem
Rem MODIFIED (MM/DD/YY)
Rem nireland 08/31/00-Improvecheckforusername=password.#1390553
Rem nireland 06/28/00-Fixnulloldpasswordtest.#1341892
Rem asurpur 04/17/97-Fixforbug479763
Rem asurpur 12/12/96-Changingthenameofpassword_verify_function
Rem asurpur 05/30/96-Newscriptfordefaultpasswordmanagement
Rem asurpur 05/30/96-Created
Rem
--Thisscriptsetsthedefaultpasswordresourceparameters
--Thisscriptneedstoberuntoenablethepasswordfeatures.
--Howeverthedefaultresourceparameterscanbechangedbased
--ontheneed.
--Adefaultpasswordcomplexityfunctionisalsoprovided.
--Thisfunctionmakestheminimumcomplexitycheckslike
--theminimumlengthofthepassword,passwordnotsameasthe
--username,etc.Theusermayenhancethisfunctionaccordingto
--theneed.
--ThisfunctionmustbecreatedinSYSschema.
--connectsys/
CREATEORREPLACEFUNCTIONverify_function
(usernamevarchar2,
passwordvarchar2,
old_passwordvarchar2)
RETURNbooleanIS
nboolean;
minteger;
differinteger;
isdigitboolean;
ischarboolean;
ispunctboolean;
digitarrayvarchar2(20);
punctarrayvarchar2(25);
chararrayvarchar2(52);
BEGIN
digitarray:
='0123456789';
chararray:
='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
punctarray:
='!
"#$%&()``*+,-/:
;<=>?
_';
--Checkifthepasswordissameastheusername
IFNLS_LOWER(password)=NLS_LOWER(username)THEN
raise_application_error(-20001,'Passwordsameasorsimilartouser');
ENDIF;
--Checkfortheminimumlengthofthepassword
--wangncmodified,2008-9-2515:
11:
30,change4to16.
IFlength(password)<16THEN
raise_application_error(-20002,'Passwordlengthlessthan16');
ENDIF;
--Checkifthepasswordistoosimple.Adictionaryofwordsmaybe
--maintainedandacheckmaybemadesoasnottoallowthewords
--thataretoosimpleforthepassword.
--wangncmodified,2008-9-2515:
12:
17,add'dba','manager','tiger'
IFNLS_LOWER(password)IN('welcome','database','account','user','password','oracle','computer','abcd',
'dba','manager','tiger')THEN
raise_application_error(-20002,'Passwordtoosimple');
ENDIF;
--Checkifthepasswordcontainsatleastoneletter,onedigitandone
--punctuationmark.
--1.Checkforthedigit
isdigit:
=FALSE;
m:
=length(password);
FORiIN1..10LOOP
FORjIN1..mLOOP
IFsubstr(password,j,1)=substr(digitarray,i,1)THEN
isdigit:
=TRUE;
GOTOfindchar;
ENDIF;
ENDLOOP;
ENDLOOP;
IFisdigit=FALSETHEN
raise_application_error(-20003,'Passwordshouldcontainatleastonedigit,onecharacterandonepunctuation');
ENDIF;
--2.Checkforthecharacter
<
ischar:
=FALSE;
FORiIN1..length(chararray)LOOP
FORjIN1..mLOOP
IFsubstr(password,j,1)=substr(chararray,i,1)THEN
ischar:
=TRUE;
GOTOfindpunct;
ENDIF;
ENDLOOP;
ENDLOOP;
IFischar=FALSETHEN
raise_application_error(-20003,'Passwordshouldcontainatleastone\
digit,onecharacterandonepunctuation');
ENDIF;
--3.Checkforthepunctuation
<
ispunct:
=FALSE;
FORiIN1..length(punctarray)LOOP
FORjIN1..mLOOP
IFsubstr(password,j,1)=substr(punctarray,i,1)THEN
ispunct:
=TRUE;
GOTOendsearch;
ENDIF;
ENDLOOP;
ENDLOOP;
IFispunct=FALSETHEN
raise_application_error(-20003,'Passwordshouldcontainatleastone\
digit,onecharacterandonepunctuation');
ENDIF;
<
--Checkifthepassworddiffersfromthepreviouspasswordbyatleast
--3letters
IFold_passwordISNOTNULLTHEN
differ:
=length(old_password)-length(password);
IFabs(differ)<3THEN
IFlength(password) m: =length(password); ELSE m: =length(old_password); ENDIF; differ: =abs(differ); FORiIN1..mLOOP IFsubstr(password,i,1)! =substr(old_password,i,1)THEN differ: =differ+1; ENDIF; ENDLOOP; IFdiffer<3THEN raise_application_error(-20004,'Passwordshoulddifferbyat\ least3characters'); ENDIF; ENDIF; ENDIF; --Everythingisfine;returnTRUE; RETURN(TRUE); END; / --ThisscriptaltersthedefaultparametersforPasswordManagement --ThismeansthatalltheusersonthesystemhavePasswordManagement --enabledandsettothefollowingvaluesunlessanotherprofileis --createdwithparametervaluessettodifferentvalueorUNLIMITED --iscreatedandassignedtotheuser. /* PASSWORD_LIFE_TIME90--用于指定口令有效期 PASSWORD_GRACE_TIME10--用于指定口令宽限期(为了强制用户定期改变口令,以上二者必须同时设置.) PASSWORD_REUSE_TIME1800--用于指定口令可重用时间. PASSWORD_REUSE_MAXUNLIMITED--用于指定在重用口令之前口令需要改变的次数.(需要主要,使用口令历史选项时,只能使用以上两种其中的一个选项.并将另一个选项设置为UNLIMITED.) FAILED_LOGIN_ATTEMPTS3--用于指定连续登陆的最大失败次数. PASSWORD_LOCK_TIME1/1440--用于指定帐户被锁定的天数. PASSWORD_VERIFY_FUNCTIONverify_function;--如果要禁用口令校验函数,可以将PASSWORD_VERIFY_FUNCTION选项设置为NULL. */ ALTERPROFILEDEFAULTLIMIT PASSWORD_LIFE_TIME90 PASSWORD_GRACE_TIME10 PASSWORD_REUSE_TIME1800 PASSWORD_REUSE_MAXUNLIMITED FAILED_LOGIN_ATTEMPTS3 PASSWORD_LOCK_TIME1/1440 PASSWORD_VERIFY_FUNCTIONverify_function;
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Oracle 密码设置管理 密码 设置 管理
![提示](https://static.bdocx.com/images/bang_tan.gif)