關於密碼重用參數PASSWORD_REUSE_TIME,PASSWORD_REUSE_MAX之間的關係及其演示

轉自:oracle

https://blog.51cto.com/carefree/1382811ide

 

測試環境:10.2.0.2.0
測試用戶:SCOTT
測試用的三組密碼:oracle1 oracle2 oracle3測試


PASSWORD_REUSE_TIME和PASSWORD_REUSE_MAX:這兩個參數必須互相關聯設置,password_reuse_time指定了密碼不能重用前的天數,而password_reuse_max則指定了當前密碼被重用以前密碼改變的次數。  code

總結二者之間的規律:
 (1)PASSWORD_REUSE_MAX,PASSWORD_REUSE_TIME都爲UNLIMITED,密碼能夠隨意重用,沒有任何限制。
 (2)PASSWORD_REUSE_MAX,PASSWORD_REUSE_TIME均爲指定值時,必須知足這二者的條件時才能夠重用密碼。
 (3)當PASSWORD_REUSE_MAX,PASSWORD_REUSE_TIME兩個有其中一個不爲UNLIMITED,則密碼永遠不能重用。blog

如下爲驗證過程:it

--確認SCOTT使用的DEFAULT profile
SQL> select USERNAME from dba_users where PROFILE='DEFAULT' and USERNAME='SCOTT';
USERNAME
------------------------------
SCOTT
 

第一種狀況,PASSWORD_REUSE_TIME,PASSWORD_REUSE_MAX值均爲UNLIMITEDclass

SQL>  select profile,limit from dba_profiles where profile='DEFAULT' and resource_name='PASSWORD_REUSE_TIME';
PROFILE                        LIMIT
------------------------------ ----------------------------------------
DEFAULT                        UNLIMITED
SQL>  select profile,limit from dba_profiles where profile='DEFAULT' and resource_name='PASSWORD_REUSE_MAX';
PROFILE                        LIMIT
------------------------------ ----------------------------------------
DEFAULT                        UNLIMITED
--測試
SQL> alter user scott identified by oracle;
User altered.
SQL> /
User altered.
SQL> /
User altered.
 

能夠發現,用戶密碼能夠不受限制的重用sed

 

第二種狀況,PASSWORD_REUSE_TIME,PASSWORD_REUSE_MAX值均不爲UNLIMITED,這裏設定ASSWORD_REUSE_TIME 1/1440表示一分鐘後能夠重用,PASSWORD_REUSE_MAX 1表示密碼更新過一次便可重用。date

 

SQL> alter profile DEFAULT limit PASSWORD_REUSE_MAX 1;
Profile altered.
SQL> alter profile DEFAULT limit PASSWORD_REUSE_TIME 1/1440;
Profile altered.
--測試
SQL> alter user scott identified by oracle1;
User altered.
SQL> select to_char(sysdate,'yyyy-mm-dd,hh24:mi:ss') as a from dual;
A
-------------------
2014-03-20,23:40:45
SQL> alter user scott identified by oracle;
User altered.
SQL> select to_char(sysdate,'yyyy-mm-dd,hh24:mi:ss') as a from dual;
A
-------------------
2014-03-20,23:42:05
SQL> alter user scott identified by oracle1;
User altered.
SQL>  select to_char(sysdate,'yyyy-mm-dd,hh24:mi:ss') as a from dual;
A
-------------------
2014-03-20,23:42:18
--間隔不足一分鐘,更改提示失敗
SQL> alter user scott identified by oracle;
alter user scott identified by oracle
*
ERROR at line 1:
ORA-28007: the password cannot be reused
--直接用上一次的密碼更改,更改失敗
SQL> alter user scott identified by oracle1;
alter user scott identified by oracle1
*
ERROR at line 1:
ORA-28007: the password cannot be reused
 

由上面的實驗,咱們能夠看出,PASSWORD_REUSE_TIME,PASSWORD_REUSE_MAX值均不爲UNLIMITED,必須同時知足這兩個條件才能夠更改密碼。file

 

第三種狀況,PASSWORD_REUSE_TIME 爲UNLIMITED,PASSWORD_REUSE_MAX爲1

SQL> alter profile DEFAULT limit PASSWORD_REUSE_TIME unlimited;
Profile altered.
--測試
SQL>  alter user scott identified by oracle1;
alter user scott identified by oracle1
*
ERROR at line 1:
ORA-28007: the password cannot be reused
SQL> alter user scott identified by oracle2;
User altered.
SQL> alter user scott identified by oracle1;
alter user scott identified by oracle1
*
ERROR at line 1:
ORA-28007: the password cannot be reused
SQL> alter user scott identified by oracle;
alter user scott identified by oracle
*
ERROR at line 1:
ORA-28007: the password cannot be reused
 

由此能夠看出,當PASSWORD_REUSE_TIME 爲UNLIMITED,PASSWORD_REUSE_MAX爲指定值,密碼在任什麼時候候都不能夠重用。

 

第四種狀況,PASSWORD_REUSE_MAX 爲UNLIMITED,PASSWORD_REUSE_TIME爲1/1440。

SQL> alter profile DEFAULT limit PASSWORD_REUSE_MAX unlimited;
Profile altered.
SQL> alter profile DEFAULT limit PASSWORD_REUSE_TIME 1/1440;
Profile altered.
SQL> select to_char(sysdate,'yyyy-mm-dd,hh24:mi:ss') as a from dual;
A
-------------------
2014-03-20,23:50:16
SQL> select to_char(sysdate,'yyyy-mm-dd,hh24:mi:ss') as a from dual;
A
-------------------
2014-03-20,23:53:10
SQL> alter user scott identified by oracle2;
alter user scott identified by oracle2
*
ERROR at line 1:
ORA-28007: the password cannot be reused
SQL> alter user scott identified by oracle1;
alter user scott identified by oracle1
*
ERROR at line 1:
ORA-28007: the password cannot be reused
SQL> alter user scott identified by oracle;
alter user scott identified by oracle
*
ERROR at line 1:
ORA-28007: the password cannot be reused
SQL> alter user scott identified by oracle4;
User altered.
SQL> alter user scott identified by oracle;
alter user scott identified by oracle
*
ERROR at line 1:
ORA-28007: the password cannot be reused
 

從上面的實驗能夠看出,當PASSWORD_REUSE_MAX爲UNLIMITED,PASSWORD_REUSE_TIME爲指定值,密碼在任什麼時候候都不能夠重用。

相關文章
相關標籤/搜索