All Products
Search
Document Center

Database Autonomy Service:GetQueryOptimizeExecErrorSample

Last Updated:Jun 10, 2026

Mengkueri pernyataan SQL yang gagal pada templat SQL.

Deskripsi operasi

  • If you use Alibaba Cloud SDK, make sure that the aliyun-sdk-core version is later than V2.1.8. We recommend that you use the latest version.

  • The version of your Database Autonomy Service (DAS) SDK must be V2.1.8 or later.

  • If you use an SDK to call API operations of DAS, you must set the region ID to cn-shanghai.

  • This operation supports the following database engines:

    • ApsaraDB RDS for MySQL

    • PolarDB for MySQL

    • ApsaraDB RDS for PostgreSQL

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

hdm:GetQueryOptimizeExecErrorSample

get

*All Resource

*

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

Engine

string

Yes

Mesin database. Nilai valid:

  • MySQL

  • PolarDB Basis Data Relasional Cloud-Native MySQL

  • PostgreSQL.

MySQL

InstanceId

string

Yes

ID instans.

rm-2ze8g2am97624****

SqlId

string

Yes

ID templat SQL. Anda dapat memanggil operasi GetQueryOptimizeExecErrorStats untuk memperoleh ID templat SQL.

2e8147b5ca2dfc640dfd5e43d96a****

Time

string

Yes

Tanggal yang akan dikueri. Atur parameter ini ke Stempel waktu UNIX yang merepresentasikan jumlah milidetik yang telah berlalu sejak 1 Januari 1970, 00:00:00 UTC.

1642953600000

Elemen respons

Element

Type

Description

Example

object

Code

string

The HTTP status code returned.

200

Message

string

The returned message.

Successful

Data

object

The detailed information.

Total

integer

The total number of entries returned.

2

PageNo

integer

A reserved parameter.

None

PageSize

integer

A reserved parameter.

None

Extra

string

A reserved parameter.

None

List

array<object>

The queried data.

object

OrigHost

string

The IP address of the client that executes the SQL statement.

100.104.XX.XX

User

string

The username of the client that executes the SQL statement.

test01

Dbname

string

The name of the database.

testdb01

SqlId

string

The SQL template ID.

2e8147b5ca2dfc640dfd5e43d96a****

SqlText

string

The content of the SQL statement that failed to be executed.

select * from test1

ErrorCode

string

The error code returned.

1146

Timestamp

integer

The point in time when the failed SQL statement was executed. The value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1643020306739

RequestId

string

The request ID.

B6D17591-B48B-4D31-9CD6-9B9796B2****

Success

string

Indicates whether the request was successful. Valid values:

  • true

  • false

true

Contoh

Respons sukses

JSONformat

{
  "Code": "200",
  "Message": "Successful",
  "Data": {
    "Total": 2,
    "PageNo": 0,
    "PageSize": 0,
    "Extra": "None",
    "List": [
      {
        "OrigHost": "100.104.XX.XX",
        "User": "test01",
        "Dbname": "testdb01",
        "SqlId": "2e8147b5ca2dfc640dfd5e43d96a****",
        "SqlText": "select * from test1",
        "ErrorCode": "1146",
        "Timestamp": 1643020306739
      }
    ]
  },
  "RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B2****",
  "Success": "true"
}

Kode kesalahan

HTTP status code

Error code

Error message

Description

400 InvalidParams The request parameters are invalid.
403 NoPermission You are not authorized to do this action.

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.