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
相关推荐
LjQ2040几秒前
网络爬虫一课一得
开发语言·数据库·python·网络爬虫
烙印6015 分钟前
MyBatis原理剖析(二)
java·数据库·mybatis
RestCloud6 分钟前
如何通过ETLCloud实现跨系统数据同步?
数据库·数据仓库·mysql·etl·数据处理·数据同步·集成平台
你是狒狒吗8 分钟前
TM中,return new TransactionManagerImpl(raf, fc);为什么返回是new了一个新的实例
java·开发语言·数据库
Channing Lewis1 小时前
sql server如何创建表导入excel的数据
数据库·oracle·excel
秃头摸鱼侠1 小时前
MySQL安装与配置
数据库·mysql·adb
UGOTNOSHOT1 小时前
每日八股文6.3
数据库·sql
行云流水行云流水2 小时前
数据库、数据仓库、数据中台、数据湖相关概念
数据库·数据仓库
John Song2 小时前
Redis 集群批量删除key报错 CROSSSLOT Keys in request don‘t hash to the same slot
数据库·redis·哈希算法
IvanCodes2 小时前
七、Sqoop Job:简化与自动化数据迁移任务及免密执行
大数据·数据库·hadoop·sqoop