通过aud$定位使用错误密码登陆数据库的客户端具体信息
    文档课题:通过aud$定位使用错误密码登陆数据库的客户端具体信息.
数据库:oracle 11.2.0.4 64位
系统:centos 7.9 64位
应用场景:oracle 11g存在密码延迟验证的特性,如果输入错误密码登录,随着错误密码登录次数的增加,每次登录前验证的时间相应也会增加,此功能目的在于避免黑客将数据库密码攻破.若错误密码输入次数较多会造成Library Cache Lock的等待事件.此时就需要快速定位出使用错误密码登陆数据库的客户端具体信息.
1、模拟场景
客户端使用错误的用户密码登陆数据库.
sys@ORCL 2022-10-13 14:06:06> create user leo identified by leo;
User created.
sys@ORCL 2022-10-13 14:06:18> grant connect,resource to leo;
Grant succeeded.
C:\Users\Administrator>sqlplus leo/liujun@192.168.133.216:1521/orcl
SQL*Plus: Release 19.0.0.0.0 - Production on 星期四 10月 13 14:07:33 2022
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle.  All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
请输入用户名:
2、客户端定位
查询最近1天由于密码错误登陆失败的信息.
sys@ORCL 2022-10-13 14:13:58> select sessionid,userid,userhost,comment$text,spare1,ntimestamp# from aud$ where returncode=1017 and ntimestamp#>sysdate-1
 SESSIONID USERID  USERHOST             COMMENT$TEXT                        SPARE1          NTIMESTAMP#
---------- ------- -------------------- ----------------------------------- --------------- ------------------------------
    320018 LEO     WorkGroup\NEWMACHINE Authenticated by: DATABASE; Client  Administrator   13-OCT-22 06.08.12.671864 AM
                                        address: (ADDRESS=(PROTOCOL=tcp)(HO
                                        ST=192.168.133.1)(PORT=63254))
根据结果定位到使用错误用户密码登陆数据库具体客户端信息.
3、returncode
查询当前审计returncode值.
sys@ORCL 2022-10-13 14:13:58> select distinct returncode from aud$;
RETURNCODE
----------
      1017
         0
查错误信息:
[oracle@liujun zoneinfo]$ oerr ora 1017
01017, 00000, "invalid username/password; logon denied"
// *Cause:
// *Action:
参考网址:https://www.modb.pro/db/23005