Updated on 2026-07-07 GMT+08:00

Checking SQL Statements

After connecting a database to the database audit instance, view the database's SQL statements and details. You can also export the SQL statements to a .csv file.

Prerequisites

  • The database audit instance is in the Running state.
  • For details about how to enable database audit, see Enable Database Audit.
  • A security group rule has been configured for the database audit instance.

Constraints and Limitations

  • Up to 10,000 records can be exported at a time.
  • The maximum length of an audit statement or result set is 10,240 bytes. Excessive parts are not recorded in audit logs.

Checking the SQL Statement List

  1. Log in to the DBSS console.
  2. Click in the upper left corner on the displayed page and select a region.
  3. In the navigation tree on the left, choose Data Reports. The Data Reports page is displayed.
  4. In the Instance drop-down list, select the instance whose SQL statement information you want to view.
  5. Click the Statements tab.
  6. View SQL statement information.

    Figure 1 Querying SQL statements
    To query a specified SQL statement, perform the following steps:
    • Select a time range (All time, 30 minutes, 1 hour, 24 hours, 7 days, or 30 days) or customize the start time and end time. The SQL statements in the time period are displayed in the list.
    • Click and select a filter or enter a keyword.
    Table 1 SQL statement parameters

    Parameter

    Description

    SQL Statements

    Executed SQL statement.

    Client IP Address

    IP address of the client where an SQL statement is executed

    Database IP Address/Domain Name

    IP address or the domain name of the database where an SQL statement is executed.

    Database User

    Database user who executes an SQL statement.

    Name

    Name of the database where an SQL statement is executed.

    Risk Level

    Risk level of executing an SQL statement.

    • High
    • Medium
    • Low
    • No risk

    Rule

    Rule for executing an SQL statement.

    Operation Type

    Type of an SQL statement operation

    Result

    Response to an SQL statement.

    Generated

    Time when an SQL statement is generated.

    Operation

    Operations that can be performed on an SQL statement.

    • Add to Whitelist: You can add SQL statements to the whitelist. The database audit function will ignore the whitelisted SQL statements.

Checking SQL Statement Details

  1. Click the SQL statement.
  2. View the SQL statement information in the StatementDetails dialog box. For details about related parameters, see Table 2.

    Figure 2 Statement dialog box
    Table 2 Parameters for details of SQL statements

    Parameter

    Description

    Session ID

    ID of an SQL statement, which is automatically generated

    Database Instance

    Database where an SQL statement is executed

    Database Type

    Type of the database where an SQL statement is executed

    Database User

    Database user for executing an SQL statement

    Client MAC Address

    MAC address of the client where an SQL statement is executed

    Database MAC Address

    MAC address of the database where an SQL statement is executed

    Client IP Address

    IP address of the client where an SQL statement is executed

    Database IP Address/Domain Name

    IP address or the domain name of the database where an SQL statement is executed

    Client Port

    Port of the client where an SQL statement is executed

    Database Port

    Port of the database where the SQL statement is executed

    Client Name

    Name of the client where an SQL statement is executed

    Operation Type

    Type of an SQL statement operation

    Operation Object Type

    Type of an SQL statement operation object

    Response Result

    Response to an SQL statement

    Affected Rows

    Number of rows affected by executing an SQL statement

    Started

    Time when an SQL statement starts to be executed

    Ended

    Time when the SQL statement execution ends

    SQL Statement

    Name of an SQL statement

    Request Result

    Result of requesting for executing an SQL statement

Exporting SQL Statements

  1. To export specified SQL statements, perform the following steps:

    • Select a time range (All time, 30 minutes, 1 hour, 24 hours, 7 days, or 30 days) or customize the start time and end time. The SQL statements in the time period are displayed in the list.
    • Click and select a filter or enter a keyword.

  2. Click Export.
  3. In the displayed dialog box, click Figure 3 to export the SQL statements.

    Figure 3 Exporting SQL statements

References