This topic describes how to use the SQL Explorer and Audit feature on an ApsaraDB RDS for MySQL instance. This feature is developed based on the full request feature and the SQL Audit feature. In addition, this feature is integrated with the following four features: Search, SQL Explorer, Security Audit, and Traffic Playback and Stress Test. This feature helps you obtain information about the SQL statements that are executed. You can use the information to troubleshoot various performance issues and identify the sources of high risks.

Prerequisites

  • Database Autonomy Service (DAS) Professional Edition is purchased within your Alibaba Cloud account. For more information about how to purchase DAS Professional Edition, see Purchase DAS Professional Edition.
  • The RDS instance does not run the RDS Basic Edition.
  • If you log on to the RDS instance by using the credentials of a RAM user, the RAM user must be granted the read and write permissions such as AliyunRDSFullAccess on the RDS instance. For more information about how to grant permissions to RAM users, see Use RAM to manage ApsaraDB RDS permissions.

Billing

For more information, see Usage notes on DAS Professional Edition.

Note After the SQL Explorer and Audit feature is enabled, the fees that you must pay for the original SQL Explorer feature are billed to DAS Professional Edition. The fees are no longer billed to your RDS instance. For more information, see Use the SQL Explorer feature on an ApsaraDB RDS for MySQL instance.

Introduction

  • The Search feature is used to query and export the SQL statements that are executed and the information about the SQL statements. The information includes the database, status, and execution duration of each SQL statement. For more information, see the "Use the Search feature" section of this topic.
  • The SQL Explorer feature is used to diagnose the health statuses of SQL statements, troubleshoot performance issues, and analyze business traffic. For more information, see the "Use the SQL Explorer feature" section of this topic.
  • The Security Audit feature is used to identify risks, such as high-risk SQL statements, SQL injection attacks, and new access sources. For more information, see the "Use the SQL audit feature" section of this topic.
  • The Traffic Playback and Stress Test feature supports traffic playback and stress testing. You can use this feature to check whether you need to upgrade your RDS instance to handle traffic spikes during peak hours. For more information, see the "Use the Traffic Playback and Stress Test feature" section of this topic.

Enable the SQL Explorer and Audit feature

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, choose Autonomy Service > SQL Explorer and Audit.
  3. On the page that appears, click Enable. In the dialog box that appears, click Enable Professional Edition.
    Note If the SQL Explorer feature is enabled for the RDS instance, you can directly click Enable Professional Edition in the dialog box to purchase DAS Professional Edition. For more information about the SQL Explorer feature, see Use the SQL Explorer feature on an ApsaraDB RDS for MySQL instance.

Use the Search feature

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, choose Autonomy Service > SQL Explorer and Audit.
  3. On the page that appears, click the Search tab and specify 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 If you want to specify multiple query criteria to narrow the search scope, you can click Enable Advanced Query.
  4. Click Query. Then, you can view the search results in the Logs section.
    Note You can click Export in the upper-right corner of the Logs section, specify Exported Fields, specify Export Time Range, and then click OK to export the log data that is displayed.

Use the SQL Explorer feature

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, choose Autonomy Service > SQL Explorer and Audit.
  3. On the page that appears, click the SQL Explorer tab. Then, you can view the health statuses of the SQL statements that are executed and can troubleshoot performance issues based on the obtained information. For more information about the SQL Explorer feature, see SQL Explorer.

Use the SQL Audit feature

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, choose Autonomy Service > SQL Explorer and Audit.
  3. On the page that appears, click the Security Audit tab. Then, you can identify high-risk SQL statements, SQL injection attacks, and new access sources. For more information about the Security Audit feature, see Security audit.

Use the Traffic Playback and Stress Test feature

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, choose Autonomy Service > SQL Explorer and Audit.
  3. On the page that appears, click the Traffic Playback and Stress Test tab. Then, you can view the information about traffic and stress testing.