Note
This view is introduced in V2.2.77.
Purpose
The DBA_AUDIT_SESSION view displays all audit records for CONNECT and DISCONNECT operations.
Applicability
This view applies only to the Oracle-compatible mode of OceanBase Database.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| OS_USERNAME | VARCHAR2(255) | NO | This column is not supported. The default value is NULL. |
| USERNAME | VARCHAR2(64) | NO | The name of the user that initiates the audited operation. |
| USERHOST | VARCHAR2(32) | NO | This column is not supported. The default value is NULL. |
| TERMINAL | VARCHAR2(255) | NO | This column is not supported. The default value is NULL. |
| TIMESTAMP | DATE | NO | The date and time when the audit trail entry is created in the local database session time zone. |
| ACTION_NAME | VARCHAR2(128) | NO | The name of the action corresponding to the numeric code in the action column of the DBA_AUDIT_TRAIL view. |
| LOGOFF_TIME | DATE | NO | The date and time when the user logs off. |
| LOGOFF_LREAD | NUMBER(38) | NO | The number of logical reads in the session. |
| LOGOFF_PREAD | NUMBER | NO | This column is not supported. The default value is NULL. |
| LOGOFF_LWRITE | NUMBER | NO | This column is not supported. The default value is NULL. |
| LOGOFF_DLOCK | VARCHAR2(40) | NO | This column is not supported. The default value is NULL. |
| SESSIONID | NUMBER(38) | NO | For V4.3.x:
|
| RETURNCODE | NUMBER(38) | NO | The error code generated by the operation. |
| CLIENT_ID | VARCHAR2(40) | NO | The client identifier in each session. |
| SESSION_CPU | NUMBER(38) | NO | The CPU time used by the session. |
| EXTENDED_TIMESTAMP | TIMESTAMP(6) WITH TIME ZONE | NO | The timestamp when the audit trail entry is created in the Coordinated Universal Time (UTC) time zone. |
| PROXY_SESSIONID | NUMBER(38) | NO | The proxy session sequence number. |
| GLOBAL_UID | NUMBER(38) | NO | The global user identifier of the user. |
| INSTANCE_NUMBER | VARCHAR2(40) | NO | This column is not supported. The default value is NULL. |
| OS_PROCESS | VARCHAR2(40) | NO | This column is not supported. The default value is NULL. |
Sample query
Query all audit records related to CONNECT and DISCONNECT.
obclient [SYS]> SELECT USERNAME, USERHOST, TIMESTAMP, ACTION_NAME FROM SYS.DBA_AUDIT_SESSION;
The query result is as follows:
+------------+----------------+-----------+-------------+
| USERNAME | USERHOST | TIMESTAMP | ACTION_NAME |
+------------+----------------+-----------+-------------+
| ORAAUDITOR | 100.xx.xxx.xxx | 08-APR-25 | LOGOFF |
| SYS | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| ORAAUDITOR | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| ORAAUDITOR | 100.xx.xxx.xxx | 08-APR-25 | LOGOFF |
| SYS | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| ORAAUDITOR | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| ORAAUDITOR | 100.xx.xxx.xxx | 08-APR-25 | LOGOFF |
| SYS | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| ORAAUDITOR | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| ORAAUDITOR | 100.xx.xxx.xxx | 08-APR-25 | LOGOFF |
| SYS | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| ORAAUDITOR | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| ORAAUDITOR | 100.xx.xxx.xxx | 08-APR-25 | LOGOFF |
| SYS | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| ORAAUDITOR | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| ORAAUDITOR | 100.xx.xxx.xxx | 08-APR-25 | LOGOFF |
| SYS | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| TEST2 | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| TEST2 | 100.xx.xxx.xxx | 08-APR-25 | LOGOFF |
| SYS | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| SYS | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| SYS | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| ORAAUDITOR | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| ORAAUDITOR | 100.xx.xxx.xxx | 08-APR-25 | LOGOFF |
| SYS | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| SYS | 100.xx.xxx.xxx | 09-APR-25 | LOGON |
+------------+----------------+-----------+-------------+
26 rows in set
References
View audit records related to
CONNECTandDISCONNECTfor the current user: USER_AUDIT_SESSIONView audit records generated by
AUDIT EXISTSandAUDIT NOT EXISTS: DBA_AUDIT_EXISTSView audit records for all objects:
View all audit records:
View audit records for
GRANT,REVOKE,AUDIT,NOAUDIT, andALTER SYSTEMstatements:For more information about security audit, see the following topics: