概述
最近有个需求是需要对Oracle某个用户设置输错密码也不被锁,整体原理是:新建一个profile,设置密码错误次数不限制,然后把用户的概要文件(profile)设置为新建的这个profile,下面介绍下设置的过程。
一、默认profile
一般数据库默认是10次尝试失败后锁住用户
1、查看FAILED_LOGIN_ATTEMPTS的值
select * from dba_profiles;
![4e54ee8c49f274b627defa185693342b.png](https://img-blog.csdnimg.cn/img_convert/4e54ee8c49f274b627defa185693342b.png)
2、修改为30次
alter profile default limit FAILED_LOGIN_ATTEMPTS 30;
![f36e58f93ddfd01f620e02658876b18b.png](https://img-blog.csdnimg.cn/img_convert/f36e58f93ddfd01f620e02658876b18b.png)
3、修改为无限次(为安全起见,不建议使用)
alter profile default limit FAILED_LOGIN_ATTEMPTS unlimited;
二、自定义profile
1、创建profile
ALTER SYSTEM SET RESOURCE_LIMIT=TRUE;create profile fsl_profile limit FAILED_LOGIN_ATTEMPTS unlimited PASSWORD_LOCK_TIME 1/24 PASSWORD_REUSE_MAX 5 PASSWORD_REUSE_TIME 1800 PASSWORD_LIFE_TIME 360 PASSWORD_GRACE_TIME 30 SESSIONS_PER_USER UNLIMITED CPU_PER_SESSION UNLIMITED CPU_PER_CALL UNLIMITED IDLE_TIME 360 CONNECT_TIME UNLIMITED LOGICAL_READS_PER_SESSION UNLIMITED LOGICAL_READS_PER_CALL UNLIMITED PRIVATE_SGA UNLIMITED COMPOSITE_LIMIT UNLIMITED;
![bc017bf498e19830320739a6f48384be.png](https://img-blog.csdnimg.cn/img_convert/bc017bf498e19830320739a6f48384be.png)
2、查看当前系统用户profile情况
select username,account_status,default_tablespace,profile from dba_users;
![4a7e2cfccca3ce5757dea42484b4c090.png](https://img-blog.csdnimg.cn/img_convert/4a7e2cfccca3ce5757dea42484b4c090.png)
3、分配新的profile
alter user FS8004 profile fsl_profile;
![ec13674bdb941413ae4a67cd195d3a52.png](https://img-blog.csdnimg.cn/img_convert/ec13674bdb941413ae4a67cd195d3a52.png)
后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注一下~
![1d85f939c000f291f1439c5de4ca5e3d.png](https://img-blog.csdnimg.cn/img_convert/1d85f939c000f291f1439c5de4ca5e3d.png)