Oracle密码过期问题,设置永不过期

Oracle密码过期问题,设置永不过期

Oracle用户密码过期的根本原因,还是在于该用户所属的profile的life_time到期

总体思路

 1.查看该用户的过期时间,profile
select username,expiry_date,profile from dba_users where username = 'ABC';
 2.查看该profile的有效时长
SELECT  *  FROM  dba_profiles  s  WHERE  s.profile = 'DEFAULT'  AND  resource_name = 'PASSWORD_LIFE_TIME';
 3.将该profile设置为永不过期
alter profile default limit password_life_time unlimited;
 4.重新设置一下该用户的密码
alter user ABC identified by newpassword;

1.查看用户所属profile及过期时间

SYS@oracle>select username,expiry_date,profile from dba_users where username = 'ABC';

2. 查看该profile的有效时长

这里的DEFAULT_ABC就是上一步通过用户名从dba_users中查出的PROFILE的值

SYS@oracle>select * from dba_profiles s where s.profile = 'DEFAULT_ABC' and resource_name = 'PASSWORD_LIFE_TIME';

3.将该profile设置为永不过期

将密码设置为永不过期后,可以通过前两步做校验,这里已经成功设置为永不过期

SYS@oracle>alter profile DEFAULT_ABC limit password_life_time unlimited;
SYS@oracle>select username,expiry_date,profile from dba_users where username = 'ABC';
SYS@oracle>select * from dba_profiles s where s.profile = 'DEFAULT_ABC' and resource_name = 'PASSWORD_LIFE_TIME';

4.重置密码

如果你的密码已经过期了,那么需要你重新设置一下密码,无需重启数据库就会生效

alter user ABC identified by ABC;

5.其余相关命令

创建profile并设置过期时间30天

create profile default_ABC limit password_life_time 30;

创建profile并设置永不过期

create profile default_ABC limit password_life_time unlimited

为用户指定profile归属

alter user ABC profile default_ABC
相关推荐
阿华的代码王国20 分钟前
MySQL ------- 索引(B树B+树)
数据库·mysql
Hello.Reader1 小时前
StarRocks实时分析数据库的基础与应用
大数据·数据库
执键行天涯1 小时前
【经验帖】JAVA中同方法,两次调用Mybatis,一次更新,一次查询,同一事务,第一次修改对第二次的可见性如何
java·数据库·mybatis
yanglamei19621 小时前
基于GIKT深度知识追踪模型的习题推荐系统源代码+数据库+使用说明,后端采用flask,前端采用vue
前端·数据库·flask
工作中的程序员1 小时前
ES 索引或索引模板
大数据·数据库·elasticsearch
严格格1 小时前
三范式,面试重点
数据库·面试·职场和发展
微刻时光2 小时前
Redis集群知识及实战
数据库·redis·笔记·学习·程序人生·缓存
单字叶2 小时前
MySQL数据库
数据库·mysql
mqiqe2 小时前
PostgreSQL 基础操作
数据库·postgresql·oracle
just-julie2 小时前
MySQL面试题——第一篇
数据库·mysql