连接oracle时报错:ORA-28001: the password has expired
调试Web项目的时候出现异常:
- java.sql.SQLException: ORA-28001: the password has expired
网上查了一下,是Oracle11g密码过期的原因
连接Oracle,以Oracle用户登陆,输入以下命令
- 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
- ------------------------------------------------------------
结果显示密码有效期是180天
输入命令:
- alter profile default limit password_life_time unlimited;
- commit;
再次执行:
- select * from dba_profiles where profile='DEFAULT' and resource_name='PASSWORD_LIFE_TIME';
结果显示为:
- PROFILE
- ------------------------------------------------------------
- RESOURCE_NAME
- ------------------------------------------------------------
- RESOURCE_TYPE
- ----------------
- LIMIT
- ------------------------------------------------------------
- DEFAULT
- PASSWORD_LIFE_TIME
- PASSWORD
- UNLIMITED
- ------------------------------------------------------------
进行以上步骤之后需要改变密码,否则还会出现password has expired异常
改变密码的命令
- alter user XXXUSER identified by Welcome1;
如果账号被锁住,则需要解锁命令
- alter user XXXUSER identified by oracle account unlock;