Oracle 的賬號過期處理
1.賬號過期表現(xiàn)如下圖:

1634516549(1).jpg
2.關鍵的sql命令:
第一步:切換用戶
從當前用戶切換用戶到 oracle用戶
[root@mysqlw1 /]# su – oracle
第二步:首先需要使用dba登錄.
[oracle@mysqlw1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Jun 15 10:29:16 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select username, account_status from dba_users;
第三步:執(zhí)行查詢賬號是否被鎖還是過期
select username, account_status from dba_users;

image.png
第四步:查詢賬號的管理策略
SELECT * FROM dba_profiles WHERE profile='DEFAULT' AND resource_name='PASSWORD_LIFE_TIME';
SQL> select * from dba_profiles where profile='DEFAULT' and resource_name='PASSWORD_LIFE_TIME';
PROFILE
------------------------------------------------------------
RESOURCE_NAME
----------------------------------------------------------------
RESOURCE_TYPE
----------------
LIMIT
--------------------------------------------------------------------------------
DEFAULT
PASSWORD_LIFE_TIME
PASSWORD
180
第五步:修改賬號的管理策略
SQL> alter profile default limit password_life_time unlimited;
Profile altered.
3.查看賬號是過期還是被鎖?
3.1賬號被鎖
該賬戶被鎖定執(zhí)行如下sql
alter user 用戶名 account unlock;
eg:SQL> alter user TEST account unlock;
3.2賬號過期
該賬戶過期執(zhí)行如下sql
alter user 用戶名 identified by 密碼;(修改密碼通把密碼進行重置成密碼,改變賬號狀態(tài)有EXPIRED改為OPEN)
eg:

image.png
3.3錯誤問題描述
下面可以查詢系統(tǒng)中的用戶和創(chuàng)建的用戶,通過created字段可以看到創(chuàng)建的時間,默認從此刻起,6個月后就密碼過期了。就會報ORA-28001: the password has expired 的錯誤:
select * from dba_users t where t.username = 'EPLATFORMTEST'