Oracle

如何擺脫 ORA-28002 消息密碼將在 6 天內過期?

  • February 1, 2021

我有一個使用者收到一個 ORA-28002,表明密碼將在六天內過期。我執行了以下內容:

ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; 

但是當我嘗試以使用者身份登錄時,該消息仍然存在。執行這個:

select * from dba_profiles where RESOURCE_NAME LIKE 'PASSWORD_LIFE_TIME';

表明這些值實際上已更改為 UNLIMITED。

密碼已在 dba_users 中標記為“EXPIRED”或標有“EXPIRY_DATE”。你將不得不改變它。您可以將其設置回相同的密碼。簡單的方法是“按值”設置密碼。這通常繞過歷史檢查。

12:28:33 SQL> select * from dba_users where username = 'MYUSER1';

USERNAME                          USER_ID PASSWORD
------------------------------ ---------- ------------------------------
ACCOUNT_STATUS                   LOCK_DATE          EXPIRY_DATE
-------------------------------- ------------------ ------------------
DEFAULT_TABLESPACE             TEMPORARY_TABLESPACE           CREATED
------------------------------ ------------------------------ ------------------
PROFILE                        INITIAL_RSRC_CONSUMER_GROUP
------------------------------ ------------------------------
EXTERNAL_NAME
--------------------------------------------------------------------------------
MYUSER1                               338 66856982BE5CD23F
OPEN
USERS                          TEMP                           17-JAN-11
DEFAULT                        DEFAULT_CONSUMER_GROUP



Elapsed: 00:00:00.03
12:28:43 SQL> alter user myuser1 password expire;

User altered.

Elapsed: 00:00:00.00
12:29:11 SQL> select * from dba_users where username = 'MYUSER1';

USERNAME                          USER_ID PASSWORD
------------------------------ ---------- ------------------------------
ACCOUNT_STATUS                   LOCK_DATE          EXPIRY_DATE
-------------------------------- ------------------ ------------------
DEFAULT_TABLESPACE             TEMPORARY_TABLESPACE           CREATED
------------------------------ ------------------------------ ------------------
PROFILE                        INITIAL_RSRC_CONSUMER_GROUP
------------------------------ ------------------------------
EXTERNAL_NAME
--------------------------------------------------------------------------------
MYUSER1                               338 66856982BE5CD23F
EXPIRED                                             17-JAN-11
USERS                          TEMP                           17-JAN-11
DEFAULT                        DEFAULT_CONSUMER_GROUP



Elapsed: 00:00:00.03
12:29:14 SQL>

其格式為“更改使用者 USER 由值 ‘hash from dba_users.password’ 標識;”

[TEST] C:\>sqlplus system

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jan 17 12:18:16 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Enter password:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

new: showmode BOTH
12:18:17 SQL> prompt end of LOGIN.SQL
end of LOGIN.SQL
12:18:17 SQL> create user myuser1 identified by mypassword1;

User created.

Elapsed: 00:00:00.01
12:18:21 SQL> grant connect, resource to myuser1;

Grant succeeded.

Elapsed: 00:00:00.01
12:18:30 SQL> connect myuser1/mypassword1
Connected.
12:18:39 SQL> connect system
Enter password:
Connected.
12:18:51 SQL> alter user myuser1 password expire;

User altered.

Elapsed: 00:00:00.00
12:19:05 SQL> connect myuser1/mypassword1
ERROR:
ORA-28001: the password has expired


Changing password for myuser1
New password:
Retype new password:
Password changed
Connected.
12:19:16 SQL> connect myuser1/mypassword1
ERROR:
ORA-01017: invalid username/password; logon denied


Warning: You are no longer connected to ORACLE.
12:19:21 SQL> connect system
Enter password:
Connected.
12:19:34 SQL> alter user myuser1 identified by mypassword1;

User altered.

Elapsed: 00:00:00.01
12:19:49 SQL> alter user myuser1 identified by mypassword1 password expire;

User altered.

Elapsed: 00:00:00.01
12:20:26 SQL> select username, password from dba_users where username = 'MYUSER1';

USERNAME                       PASSWORD
------------------------------ ------------------------------
MYUSER1                        66856982BE5CD23F

Elapsed: 00:00:00.01
12:20:36 SQL> alter user myuser1 identified by values '66856982BE5CD23F' ;

User altered.

Elapsed: 00:00:00.01
12:21:01 SQL> connect myuser1/mypassword1
Connected.
12:21:13 SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

引用自:https://dba.stackexchange.com/questions/659