ORA-28001: the password has expired
Cause: The user"s account has expired and the password needs to be changed
Action: change the password or contact the DBA
程序连接DB服务器时报错:
13-04-22 17:32:15 [ERROR] com.sohu.game.Main {Main.java:102} - 统计失败:
java.sql.SQLException: ORA-28001: the password has expired
at Oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.O3log.receive2nd(O3log.java:496)
解决方法:
查看帐号的信息:
SQL> select USERNAME,ACCOUNT_STATUS,LOCK_DATE,EXPIRY_DATE,password,CREATED from dba_users where username=upper('xxx ');
USERNAME ACCOUNT_ST LOCK_DATE EXPIRY_DATE CREATED
-------------------- ---------- -------------------- ------------------- ------------------------------ -------------------
xxx EXPIRED 2013-04-22 14:44:43 2012-10-17 14:20:15
查看帐号的PASSWORD_LIFE_TIME设置:
SQL> select * from dba_profiles where profile like '%xxx%';
PROFILE RESOURCE_NAME RESOURCE LIMIT
------------------------------ -------------------------------- -------- ----------------------------------------
PF_xxx PASSWORD_LIFE_TIME PASSWORD DEFAULT
查看系统PROFILE文件的默认设置:
SQL> select * from dba_profiles where profile like '%DEFAULT%';
PROFILE RESOURCE_NAME RESOURCE LIMIT
------------------------------ -------------------------------- -------- ----------------------------------------
DEFAULT PASSWORD_LIFE_TIME PASSWORD 180
设置了用户的PASSWORD_LIFE_TIME,默认为180天;
修改用户的PASSWORD_LIFE_TIME限制:
SQL> alter profile DEFAULT limit PASSWORD_LIFE_TIME unlimited;
Profile altered.
重新设置用户的密码:
SQL> alter user xxx identified by xxx;
User altered.
SQL> select USERNAME,ACCOUNT_STATUS,LOCK_DATE,EXPIRY_DATE,password,CREATED from dba_users where username=upper('xxx');
USERNAME ACCOUNT_ST LOCK_DATE EXPIRY_DATE CREATED
-------------------- ---------- -------------------- ------------------- ------------------------------ -------------------
XXX OPEN 2012-10-17 14:20:15
帐号状态恢复正常。
注意:
因为这个帐号是应用程序在使用的,不能更换密码,所在在使用alter user...identified by的时候,需要使用这个帐号当前的密码进行操作。
在CentOS 6.4下安装Oracle 11gR2(x64)