This topic describes how to perform request analysis by querying the SQL statements on the SQL Audit page.
Background information
SQL audit allows you to query SQL statements of a cluster based on information such as the user who executed an SQL statement, IP address, and operation type, and export the query results.
SQL audit
Go to the Clusters page of the ApsaraDB for OceanBase console.
Click the name of the target cluster to go to the cluster management page.
In the left-side navigation bar, click Diagnose.
On the diagnostics page, click the SQL Audit tab.
If it is the first time that you use the tab, take the following steps to enable the SQL audit feature.
Select a tenant.
Click Start SQL Audit.
In the dialog box that appears, specify the corresponding parameters.
Click Enable.
On the SQL Audit tab, perform the following operations to query the SQL statements that may have issues.
Filter the information based on the specified conditions.
Filter item
Description
Database
Select one or more databases in the corresponding tenant.
Node
Select one or more nodes.
Keyword
Select one or more keywords that may exist in the problematic SQL statements. The relationship between the keywords can be AND or OR.
Time Range
You can select the last 5 minutes, 30 minutes, 1 hour, 6 hours, or a custom time range. The time range cannot exceed 6 hours.
Username
Enter one or more tenant names.
Operation Type
Select one or more operation types from the drop-down list.
Client IP Address
Enter the IP address of the client.
Execution Duration (ms)
Enter the execution duration for the target SQL statement.
Scan Records
Enter the range of scan records to view.
View the query result. You can view the query result in the following columns: SQL Statement, Database, User, Client IP Address, Operation Type, Request Time, Execution Duration (ms), Scanned Rows, and Updated Rows.
Download the query result: Click Export to download the query result.
NoteAt present, you can download at most 100 audit records. If the number of query records exceeds 100, only the first 100 records on the page are downloaded.