You can call the ModifySQLCollectorPolicy operation to enable or disable the SQL Explorer (SQL Audit) feature for an instance.
Before you call this operation, make sure that the instance runs one of the following database engines:
- MySQL
- SQL Server
- PostgreSQL
Debugging
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 ID of the instance. |
| 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. 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. |
Examples
Sample requests
http(s)://rds.aliyuncs.com/?Action=ModifySQLCollectorPolicy
&DBInstanceId=rm-uf6wjk5xxxxxxx
&SQLCollectorStatus=Enable
&<Common request parameters>
Sample success responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<?xml version="1.0" encoding="UTF-8" ?>
<ModifySQLCollectorPolicyResponse>
<requestId>C3565F9F-76E9-4F7E-A662-D1B2488EC2FC</requestId>
</ModifySQLCollectorPolicyResponse>
JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"requestId" : "C3565F9F-76E9-4F7E-A662-D1B2488EC2FC"
}
Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 400 | InvalidSqlLog.Malformed | The specified parameter SqlLog is not valid. | The error message returned because the value of the SqlLog parameter is invalid. |
| 400 | InvalidConfigName | The ConfigName is not valid. | The error message returned because the value of the ConfigName parameter is invalid. |
| 400 | InvalidConfigValue | The ConfigValue is not valid. | The error message returned because the specified parameter configuration is invalid. |
| 400 | IncorrectPerfFrequencyType | Current DB instance does not support this perf frequency. | The error message returned because the instance does not support the performance frequency. |
| 400 | InvalidParameters.Format | Specified parameter is not valid | The error message returned because the format of a specified parameter is invalid. |
| 400 | ErrorMxsServiceInsNum.Error | The Maxscale serviceIns num must be 1. | The error message returned because the number of proxies must be 1. |
| 400 | IncorrectSQLLogVersion | Current DB instance SQL log version does not support this operation. | The error message returned because this operation is not supported for the SQL log version of the current instance. |
| 400 | IncorrectSQLLogActiveStatus | Current DB instance SQL log active status does not support this operation. | The error message returned because this operation is not supported when the instance is running. |
| 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. |
| 403 | IncorrectDBType | The current DB type does not support this operation. | The error message returned because this operation is not supported by the database engine of the instance. Specify a different database engine. |
| 403 | IncorrectDBInstanceType | Current DB instance type does not support this operation. | The error message returned because this operation is not supported when the instance is in the current state. |
| 403 | IncorrectDBInstanceCharacterType | Current DB Instance character_type does not support this operation. | The error message returned because the character type of the current instance does not support this operation. |
| 403 | InvalidSqlRetention.Malformed | Specified sql retention is not valid. | The error message returned because the retention period of SQL logs is invalid. |
| 404 | InvalidDBInstanceName.NotFound | The database instance does not exist. | The error message returned because the name of the instance cannot be found. Verify the instance name and try again. |
For a list of error codes, visit the API Error Center.