Oracle密码过期the password has expired解决办法

Oracle 出现the password has expired这个问题,今天突然发现项目访问不了,一查发现用不了,也登不进去,这个问题由是Oracle 11g密码过期的原因导致的。

调试Web项目的时候出现异常:

java.sql.SQLException: ORA-28001: the password has expired

网上查了一下,连接Oracle,以Oracle用户登陆,输入以下命令

以orcaleDBA用户登录

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 Welcome1 account unlock;

 

相关推荐