You can call the ModifySQLCollectorPolicy operation to enable or disable the SQL Explorer (SQL Audit) feature for an ApsaraDB RDS instance.

Before you call this operation, make sure that the instance runs one of the following database engines:

  • MySQL
  • SQL Server
  • PostgreSQL
Note If you call this operation by using the credentials of a RAM user, the RAM user must have the read and write permissions such as AliyunRDSFullAccess on the instance. If the RAM user does not have the read and write permissions on the instance, the system displays a message stating that you do not have the permissions to call this operation. For more information about how to grant permissions to a RAM user, see Use RAM to manage ApsaraDB RDS permissions.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ModifySQLCollectorPolicy

The operation that you want to perform. Set the value to ModifySQLCollectorPolicy.

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the instance. You can call the DescribeDBInstances operation to query the IDs of instances.

SQLCollectorStatus String Yes Enable

Specifies whether to enable or disable the SQL Explorer (SQL Audit) feature. Valid values: Enable and Disabled.

ResourceGroupId String No rg-acfmx**********

The ID of the resource group to which the instance belongs. For more information, see View basic information of a resource group.

Response parameters

Parameter Type Example Description
RequestId String 1AD222E9-E606-4A42-BF6D-8A4442913CEF

The ID of the request.


Sample requests

&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK

<?xml version="1.0" encoding="UTF-8" ?>

JSON format

HTTP/1.1 200 OK

    "requestId": "C3565F9F-76E9-4F7E-A662-D1B2488EC2FC", 

Error codes

HTTP status code Error code Error message Description
403 IncorrectDBInstanceState Current DB instance state does not support this operation. The error message returned because this operation is not supported when the instance is in the current state.

For a list of error codes, visit the API Error Center.