ORACLE user is locked, unlock user

ORACLE user is locked

1. Background description

某日,开发人员说,某个用户被锁住了,帮忙解锁,解锁不到两分钟后又被锁住了

2. Investigation ideas

1. First check the specific time the user was locked.

select username,lock_date from dba_users where username='PEOPLE';

set line 999
select username,account_status,lock_date,profile from dba_users; 

EXPIRED & LOCKED Password expired and locked

LOCKED(TIMED) The number of incorrect passwords exceeds the maximum allowed number of times set by the system, and the user is locked.

2. View the profile and related information used by the user

SELECT PROFILE FROM DBA_USERS WHERE USERNAME='PEOPLE';


SELECT PROFILE,RESOURCE_NAME,LIMIT FROM DBA_PROFILES WHERE PROFILE='DEFAULT';    #DEFAULT为查出来的信息,具体以实际情况为准

FAILED_LOGIN_TIME: When logging in, if the password is incorrect more than 10 times, the account will be locked.
PASSWORD_LIFE_TIME: The password is valid for 180 days.
PASSWORD_LOCK_TIME: The password will be automatically unlocked after 1 day.

设置密码永不过期
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

修改密码错误限制次数
ALTER PROFILE DEFAULT LIMIT FAILED_LOGIN_ATTEMPTS 20;

3. Check the monitoring log

As shown above, it is found that the user status is LOCKED (TIMED), so it is caused by entering the wrong password.

cd $ORACLE_BASE/diag/tnslsnr/
tail -100f listener.log

It is found that there is a problem with the user password entered in the application. Contact the development to adjust the user password.

4. Unlock users

alter user PEOPLE account unlock;

加锁
alter user PEOPLE account lock;

3. Other SQL adjustments

调整密码错误限制为无限次,为了安全不建议设置
alter profile default limit FAILED_LOGIN_ATTEMPTS unlimited;

ORA-28002,需要修改密码
alter user 用户名 identified by 密码; 

Guess you like

Origin blog.csdn.net/m0_49562857/article/details/133273361