oracle账户被锁

问题:ORA-28000: the account is locked

排查
通过sys用户以sysdba角色登录数据库
1.查看用户连接数据库信息

--osuser连接用户信息、username连接的用户、machine电脑名称
SELECT osuser, a.username,cpu_time/executions/1000000||'s',  sql_fulltext,machine
from v$session a, v$sqlarea b
where a.sql_address =b.address order by cpu_time/executions desc; 

image.png

2.查看用户的状态
select username,account_status,lock_date from dba_users ORDER BY lock_date desc nulls last;
3.查看密码错误次数锁死信息
select * from dba_profiles where resource_name like 'FAILED_LOGIN_ATTEMPTS%';
oracle账户被锁_第1张图片
image.png

4.修改错误次数为50
alter profile default limit FAILED_LOGIN_ATTEMPTS 50;
也可以改为不限制(安全考虑,不建议)
alter profile default limit FAILED_LOGIN_ATTEMPTS unlimited;
5.解锁账户

alter user SYSTEM account unlock;  
commit;

重点排查是那个ip锁了用户
由于用户多次被锁,考虑排查谁在用错误密码访问数据,导致账户被锁,以期彻底解决问题。
用DBA角色连接数据库。
1.查看具体的被锁时间
select username,lock_date from dba_users where username='SYSTEM';
2.在Oracle安装目录下查找listener.log日志
在日志文件中根据用户被锁时间定为查找发现:

13-7月 -2018 09:13:27 * ping * 0
13-7月 -2018 09:13:27 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=)(USER=SYSTEM))(COMMAND=status)(ARGUMENTS=64)(SERVICE=(ADDRESS=(PROTOCOL=TCP)(HOST=YD-JK)(PORT=1521)))(VERSION=186646784)) * status * 0
13-7月 -2018 09:13:32 * (CONNECT_DATA=(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=xuxiang))(SERVICE_NAME=mobile)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=xuxiang))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.13.10)(PORT=3185)) * establish * mobile * 0
13-7月 -2018 09:13:32 * (CONNECT_DATA=(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=xuxiang))(SERVICE_NAME=mobile)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=xuxiang))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.13.10)(PORT=3186)) * establish * mobile * 0
13-7月 -2018 09:13:34 * (CONNECT_DATA=(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=xuxiang))(SERVICE_NAME=mobile)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=xuxiang))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.13.10)(PORT=3187)) * establish * mobile * 0
13-7月 -2018 09:13:34 * (CONNECT_DATA=(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=xuxiang))(SERVICE_NAME=mobile)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=xuxiang))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.13.10)(PORT=3188)) * establish * mobile * 0
13-7月 -2018 09:13:35 * (CONNECT_DATA=(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=xuxiang))(SERVICE_NAME=mobile)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=xuxiang))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.13.10)(PORT=3191)) * establish * mobile * 0

oracle账户被锁_第2张图片
image.png

由日志可知是ip为 192.168.13.10 电脑名称为 xuxiang的用户多次尝试登陆失败导致的。
找到该电脑修改即可

你可能感兴趣的:(oracle账户被锁)