Halaman ini menjelaskan cara membatalkan impor dan ekspor data ke instance Cloud SQL. Data ini dimuat dalam file dump SQL atau file CSV.
Sebelum memulai
Membatalkan operasi impor atau ekspor
Anda dapat menggunakan perintah gcloud
atau REST API untuk membatalkan operasi impor
atau ekspor.
gcloud sql operations cancel
untuk membatalkan operasi.
gcloud sql operations canceloperation-ID
Sebelum menggunakan data permintaan apa pun, lakukan penggantian berikut:
- project-ID: Project ID.
- operation-ID: ID operasi impor atau ekspor. Untuk mengetahui informasi selengkapnya, lihat Sebelum memulai.
Metode HTTP dan URL:
POST https://sqladmin.googleapis.com/v1/projects/project-ID /operations/operation-ID /cancel
Untuk mengirim permintaan, perluas salah satu opsi berikut:
curl (Linux, macOS, atau Cloud Shell)
Jalankan perintah berikut:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://sqladmin.googleapis.com/v1/projects/project-ID /operations/operation-ID /cancel"
PowerShell (Windows)
Jalankan perintah berikut:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/v1/projects/project-ID /operations/operation-ID /cancel" | Select-Object -Expand Content
Anda akan menerima respons JSON yang mirip dengan yang berikut ini:
Respons
{}
Sebelum menggunakan data permintaan apa pun, lakukan penggantian berikut:
- project-ID: Project ID.
- operation-ID: ID operasi impor atau ekspor. Untuk mengetahui informasi selengkapnya, lihat Sebelum memulai.
Metode HTTP dan URL:
POST https://sqladmin.googleapis.com/v1beta4/projects/project-ID /operations/operation-ID /cancel
Untuk mengirim permintaan, perluas salah satu opsi berikut:
curl (Linux, macOS, atau Cloud Shell)
Jalankan perintah berikut:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://sqladmin.googleapis.com/v1beta4/projects/project-ID /operations/operation-ID /cancel"
PowerShell (Windows)
Jalankan perintah berikut:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/v1beta4/projects/project-ID /operations/operation-ID /cancel" | Select-Object -Expand Content
Anda akan menerima respons JSON yang mirip dengan yang berikut ini:
Respons
{}
Memeriksa status yang dibatalkan
Anda dapat menggunakan perintah gcloud
atau REST API untuk memeriksa status
operasi impor atau ekspor yang dibatalkan.
gcloud sql operations describe
untuk
memeriksa status operasi yang dibatalkan.
gcloud sql operations describeoperation-ID
Sebelum menggunakan data permintaan apa pun, lakukan penggantian berikut:
- project-ID: Project ID.
- operation-ID: ID operasi impor atau ekspor. Untuk mengetahui informasi selengkapnya, lihat Sebelum memulai.
Metode HTTP dan URL:
GET https://sqladmin.googleapis.com/v1/projects/project-ID /operations/operation-ID
Untuk mengirim permintaan, perluas salah satu opsi berikut:
curl (Linux, macOS, atau Cloud Shell)
Jalankan perintah berikut:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/v1/projects/project-ID /operations/operation-ID "
PowerShell (Windows)
Jalankan perintah berikut:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/v1/projects/project-ID /operations/operation-ID " | Select-Object -Expand Content
Anda akan menerima respons JSON yang mirip dengan yang berikut ini:
Tanggapan
{ "kind": "sql#operation", "targetLink": "https://sqladmin.googleapis.com/v1/projects/project-ID ", "status": "DONE", "user": "user@example.com", "insertTime": "2022-11-08T22:12:58.199Z", "startTime": "2022-11-08T22:13:04.798Z", "endTime": "2022-11-08T22:13:45.862Z", "error": { "kind": "sql#operationErrors", "errors": [ { "kind": "sql#operationError", "code": "CANCEL_SUCCESSFUL", "message": "Operation successfully cancelled" } ] }, "operationType": "EXPORT", "exportContext": { "uri": "gs://replica-bucket/source-database.sql", "kind": "sql#exportContext", "sqlExportOptions": { "schemaOnly": false, "mysqlExportOptions": { "masterData": 0 } }, "fileType": "SQL" }, "name": "operation-ID ", "targetId": "cloud-sql-instance-display-name ", "selfLink": "https://sqladmin.googleapis.com/v1/projects/project-ID /operations/operation-ID ", "targetProject": "project-ID ", "instanceUid": "cloud-sql-instance-ID " }
Sebelum menggunakan data permintaan apa pun, lakukan penggantian berikut:
- project-ID: Project ID.
- operation-ID: ID operasi impor atau ekspor. Untuk mengetahui informasi selengkapnya, lihat Sebelum memulai.
Metode HTTP dan URL:
GET https://sqladmin.googleapis.com/v1beta4/projects/project-ID /operations/operation-ID
Untuk mengirim permintaan, perluas salah satu opsi berikut:
curl (Linux, macOS, atau Cloud Shell)
Jalankan perintah berikut:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/v1beta4/projects/project-ID /operations/operation-ID "
PowerShell (Windows)
Jalankan perintah berikut:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/v1beta4/projects/project-ID /operations/operation-ID " | Select-Object -Expand Content
Anda akan menerima respons JSON yang mirip dengan yang berikut ini:
Tanggapan
{ "kind": "sql#operation", "targetLink": "https://sqladmin.googleapis.com/v1beta4/projects/project-ID ", "status": "DONE", "user": "user@example.com", "insertTime": "2022-11-08T22:12:58.199Z", "startTime": "2022-11-08T22:13:04.798Z", "endTime": "2022-11-08T22:13:45.862Z", "error": { "kind": "sql#operationErrors", "errors": [ { "kind": "sql#operationError", "code": "CANCEL_SUCCESSFUL", "message": "Operation successfully cancelled" } ] }, "operationType": "EXPORT", "exportContext": { "uri": "gs://replica-bucket/source-database.sql", "kind": "sql#exportContext", "sqlExportOptions": { "schemaOnly": false, "mysqlExportOptions": { "masterData": 0 } }, "fileType": "SQL" }, "name": "operation-ID ", "targetId": "cloud-sql-instance-display-name ", "selfLink": "https://sqladmin.googleapis.com/v1beta4/projects/project-ID /operations/operation-ID ", "targetProject": "project-ID ", "instanceUid": "cloud-sql-instance-ID " }
Memecahkan masalah
Masalah | Pemecahan masalah |
---|---|
Pesan error: You can't cancel operation [operation-ID] because
this operation isn't in progress. |
Anda mencoba membatalkan operasi impor atau ekspor yang telah selesai, gagal atau dibatalkan. Jika operasi sedang berjalan, Anda dapat membatalkannya. |
Pesan error: You can't cancel operation [operation-ID] because
Cloud SQL doesn't support the cancellation of an [operation-type]
operation. |
Cloud SQL
tidak mendukung pembatalan operasi karena memiliki jenis operasi selain |
Pesan error: The [operation-type] operation isn't cancelled. Wait
and retry in a few seconds. |
Cloud SQL saat ini tidak dapat membatalkan operasi impor atau ekspor. Coba lagi dalam beberapa detik. Jika masalah berlanjut, hubungi Google Cloud Dukungan. |
Langkah berikutnya
- Pelajari lebih lanjut tentang praktik terbaik untuk mengimpor dan mengekspor data.
- Pelajari cara mengekspor dan mengimpor data ke instance Cloud SQL menggunakan file dump SQL.
- Pelajari cara memeriksa status operasi impor dan ekspor.
- Masalah umum untuk impor dan ekspor.