Note
This view is available starting with V2.2.30.
Purpose
The USER_AUDIT_SESSION view displays the audit records of the connection and disconnection of the current user.
Applicability
This view is available only in Oracle mode of OceanBase Database.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| OS_USERNAME | VARCHAR2(255) | NO | This column is not supported. The value of this column is NULL by default. |
| USERNAME | VARCHAR2(64) | NO | The name of the user whose actions are audited. |
| USERHOST | VARCHAR2(32) | NO | This column is not supported. The value of this column is NULL by default. |
| TERMINAL | VARCHAR2(255) | NO | This column is not supported. The value of this column is NULL by default. |
| TIMESTAMP | DATE | NO | The date and time when the audit record was created in the local database session time zone. |
| ACTION_NAME | VARCHAR2(128) | NO | The name of the operation type corresponding to the numeric code in the operation column of DBA_AUDIT_TRAIL. |
| LOGOFF_TIME | DATE | NO | The date and time when the user logged off. |
| LOGOFF_LREAD | NUMBER(38) | NO | The number of logical reads in the session. |
| LOGOFF_PREAD | NUMBER | NO | This column is not supported. The value of this column is NULL by default. |
| LOGOFF_LWRITE | NUMBER | NO | This column is not supported. The value of this column is NULL by default. |
| LOGOFF_DLOCK | VARCHAR2(40) | NO | This column is not supported. The value of this column is NULL by default. |
| 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 the 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 record was created in the UTC time zone. |
| PROXY_SESSIONID | NUMBER(38) | NO | The sequence number of the proxy session. |
| GLOBAL_UID | NUMBER(38) | NO | The global user identifier of the user. |
| INSTANCE_NUMBER | VARCHAR2(40) | NO | This column is not supported. The value of this column is NULL by default. |
| OS_PROCESS | VARCHAR2(40) | NO | This column is not supported. The value of this column is NULL by default. |
| SVR_IP | VARCHAR2(46) | NO | The IP address of the Observer node corresponding to the session.
NoteFor V4.3.x, this column is available starting with V4.3.5. |
| SVR_PORT | INT | NO | The port number of the Observer node corresponding to the session.
NoteFor V4.3.x, this column is available starting with V4.3.5. |
Sample query
Query the audit trail entries for CONNECT and DISCONNECT operations of the current user.
obclient [SYS]> SELECT USERNAME, USERHOST, TIMESTAMP, ACTION_NAME FROM SYS.USER_AUDIT_SESSION;
The query result is as follows:
+----------+----------------+-----------+-------------+
| USERNAME | USERHOST | TIMESTAMP | ACTION_NAME |
+----------+----------------+-----------+-------------+
| 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 |
| 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 |
| 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 |
| SYS | 100.xx.xxx.xxx | 08-APR-25 | LOGON |
| SYS | 100.xx.xxx.xxx | 09-APR-25 | LOGON |
+----------+----------------+-----------+-------------+
11 rows in set
References
Query the audit trail entries for all
CONNECTandDISCONNECToperations in the current tenant: DBA_AUDIT_SESSIONQuery the audit trail entries for
AUDIT EXISTSandAUDIT NOT EXISTSoperations: DBA_AUDIT_EXISTSQuery the audit trail entries for all objects:
Query all audit trail entries:
Query the audit trail entries for
GRANT,REVOKE,AUDIT,NOAUDIT, andALTER SYSTEMstatements:For more information about security audit, see the following topics: