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
相关推荐
搞不懂语言的程序员8 分钟前
Redis的Pipeline和Lua脚本适用场景是什么?使用时需要注意什么?
数据库·redis·lua
王RuaRua16 分钟前
[数据结构]5. 栈-Stack
linux·数据结构·数据库·链表
Lw老王要学习2 小时前
Linux数据库篇、第一章_02_MySQL的使用增删改查
linux·运维·数据库·mysql·云计算·it
林下清风~2 小时前
MySQL——九、锁
数据库·mysql
呦呦鹿鸣Rzh3 小时前
redis
数据库·redis·缓存
xiaogai_gai3 小时前
有效的聚水潭数据集成到MySQL案例
android·数据库·mysql
web130933203984 小时前
Mysql的安装配置教程(非常详细)从零基础入门到精通,看完这一篇就够了
数据库·mysql
三天不学习4 小时前
浅析AI大模型为何需要向量数据库?【入门基础】
数据库·人工智能·欧氏距离·向量数据库·余弦相似度
MonkeyKing_sunyuhua4 小时前
将数据库结构化数据整合到RAG问答中的方式
数据库
喝醉酒的小白4 小时前
MySQL内存使用率高问题排查与解决方案:
数据库