denrepo

OracleSecurity & users

Failed logins in the last 24 hours

From the unified audit trail, which records failed logons by default through the ORA_LOGON_FAILURES policy. Return code 1017 is a wrong password; 28000 is a locked account.

12.2+

Not yet verified. How scripts are tested

ora-failed-logins.sql
1CLEAR COLUMNS2SET LINESIZE 160 PAGESIZE 200 TRIMOUT ON TAB OFF3COLUMN at_time     HEADING "TIME"    FORMAT A194COLUMN dbusername  HEADING "DB USER" FORMAT A205COLUMN os_username HEADING "OS USER" FORMAT A206COLUMN userhost    HEADING "HOST"    FORMAT A30 TRUNCATE7COLUMN return_code HEADING "ORA-"    FORMAT 999998 9SELECT TO_CHAR(event_timestamp, 'YYYY-MM-DD HH24:MI:SS') AS at_time,10       dbusername, os_username, userhost, return_code11FROM unified_audit_trail12WHERE action_name = 'LOGON'13  AND return_code <> 014  AND event_timestamp > SYSTIMESTAMP - INTERVAL '1' DAY15ORDER BY event_timestamp DESC;

Save it as ora-failed-logins.sql and run it with SQL> @ora-failed-logins.

Open in denrepo

Helps with

Part of these runbooks

More Oracle scripts: Security & users