The search feature allows you to query and export the information about SQL statements. This topic describes how to use the search feature in the SQL insight and audit module.

Prerequisites

  • A database instance is connected to Database Autonomy Service (DAS) and is in the Accessed state.
  • DAS Professional Edition is activated for the instance. For more information, see DAS Professional Edition.
  • DAS provides the SQL Explorer and audit feature only for the following types of database instances:
    • ApsaraDB RDS for MySQL High-availability Edition and Enterprise Edition
    • ApsaraDB RDS for PostgreSQL High-availability Edition
    • Single Node Edition, Archive Database Edition, and Cluster Edition of ApsaraDB PolarDB MySQL-compatible edition
    • ApsaraDB PolarDB PostgreSQL-compatible edition Cluster Edition

Procedure

  1. Log on to the DAS console.
  2. In the left-side navigation pane, click Instance Monitoring. On the Instance Monitoring page, click the name of the instance that you need to manage. The instance details page appears.
    a
  3. In the left-side navigation pane of the page that appears, click SQL Explorer and Audit. Then, on the Search tab, specify the following parameters to set the query criteria.
    Parameter Description
    Time range The time range that is allowed for an online query extends up to 24 hours. This is because the SQL Explorer feature logs a large number of SQL statements. These logs can be used to trace all the operations that are performed on your RDS instance. If the time range for an online query exceeds 24 hours, the query requires a long period of time and may time out.
    Note If you need to query SQL logs over a time range that exceeds 24 hours, we recommend that you asynchronously export SQL logs as a file and download the file to your computer.
    Keyword You can specify multiple keywords. Separate the keywords with spaces. Fuzzy queries are not supported.
    Note Each keyword contains at least four characters.
    User You can specify multiple usernames. For example, you can specify the value in the format of user1,user2,user3.
    Database You can specify multiple databases. For example, you can specify the value in the format of DB1 DB2 DB3.
    Operation type You can filter data by operation type, such as SELECT and INSERT.
    Note You can click Enable Advanced Query to specify more parameters to narrow down the search scope.
  4. Click Query. Then, you can view the information about SQL Statement in the Logs section.
    Note To export SQL log entries, click Export and specify Export Fields.