データのインポートとエクスポートをキャンセルする
  
      
    
  
  
  
  
  
    
  
  
    
    
    
    
  
  
このページでは、Cloud SQL インスタンスへのデータのインポートとエクスポートをキャンセルする方法について説明します。このデータは SQL ダンプファイルまたは CSV ファイルに含まれています。
始める前に
インポートまたはエクスポートのオペレーションをキャンセルする
インポートやエクスポートのオペレーションをキャンセルするには、gcloud または REST API コマンドを使用します。
gcloud
gcloud sql operations cancel コマンドを使用してオペレーションをキャンセルします。
gcloud sql operations cancel operation-ID
operation-ID 変数は、オペレーションの ID に置き換えます。詳細については、始める前にをご覧ください。
REST v1
  
  
  
  
  
  
    
  
リクエストのデータを使用する前に、次のように置き換えます。
  - project-ID: プロジェクト ID。
 
  - operation-ID: インポートまたはエクスポートのオペレーションの ID。詳細については、始める前にをご覧ください。
 
  HTTP メソッドと URL:
  POST https://sqladmin.googleapis.com/v1/projects/project-ID/operations/operation-ID/cancel
リクエストを送信するには、次のいずれかのオプションを展開します。
  curl(Linux、macOS、Cloud Shell)
  
  
    
      
    
  
  
  次のコマンドを実行します。
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
    
    
  
  
  
  
  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)
  
  
    
      
    
  
  
  次のコマンドを実行します。
  
  
  
  
    
  
  
  
  
  
    
    
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
  
  
  
  
    
  
  $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
    次のような JSON レスポンスが返されます。
    
この REST API 呼び出しはレスポンスを返しません。インポート オペレーションやエクスポート オペレーションのキャンセル ステータスを確認する方法については、キャンセル ステータスを確認するをご覧ください。
REST v1beta4
  
  
  
  
  
  
    
  
リクエストのデータを使用する前に、次のように置き換えます。
  - project-ID: プロジェクト ID。
 
    - operation-ID: インポートまたはエクスポートのオペレーションの ID。詳細については、始める前にをご覧ください。
 
  HTTP メソッドと URL:
  POST https://sqladmin.googleapis.com/v1beta4/projects/project-ID/operations/operation-ID/cancel
リクエストを送信するには、次のいずれかのオプションを展開します。
  curl(Linux、macOS、Cloud Shell)
  
  
    
      
    
  
  
  次のコマンドを実行します。
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
    
    
  
  
  
  
  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)
  
  
    
      
    
  
  
  次のコマンドを実行します。
  
  
  
  
    
  
  
  
  
  
    
    
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
  
  
  
  
    
  
  $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
    次のような JSON レスポンスが返されます。
    
この REST API 呼び出しはレスポンスを返しません。インポート オペレーションやエクスポート オペレーションのキャンセル ステータスを確認する方法については、キャンセル ステータスを確認するをご覧ください。
 
キャンセル ステータスを確認する
gcloud または REST API コマンドを使用して、キャンセルされたインポートまたはエクスポートのオペレーションのステータスを確認できます。
REST v1
  
  
  
  
  
  
    
  
リクエストのデータを使用する前に、次のように置き換えます。
  - project-ID: プロジェクト ID。
 
    - operation-ID: インポートまたはエクスポートのオペレーションの ID。詳細については、始める前にをご覧ください。
 
  HTTP メソッドと URL:
  GET https://sqladmin.googleapis.com/v1/projects/project-ID/operations/operation-ID
リクエストを送信するには、次のいずれかのオプションを展開します。
  curl(Linux、macOS、Cloud Shell)
  
  
    
      
    
  
  
  次のコマンドを実行します。
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  curl -X GET \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     "https://sqladmin.googleapis.com/v1/projects/project-ID/operations/operation-ID"
  PowerShell(Windows)
  
  
    
      
    
  
  
  次のコマンドを実行します。
  
  
  
  
    
  
  
  
  
  
    
    
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
  
  
  
  
    
  
  $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
    次のような JSON レスポンスが返されます。
    
レスポンス
  
{
  "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"
}
REST v1beta4
  
  
  
  
  
  
    
  
リクエストのデータを使用する前に、次のように置き換えます。
  - project-ID: プロジェクト ID。
 
   - operation-ID: インポートまたはエクスポートのオペレーションの ID。詳細については、始める前にをご覧ください。
 
  HTTP メソッドと URL:
  GET https://sqladmin.googleapis.com/v1beta4/projects/project-ID/operations/operation-ID
リクエストを送信するには、次のいずれかのオプションを展開します。
  curl(Linux、macOS、Cloud Shell)
  
  
    
      
    
  
  
  次のコマンドを実行します。
  
  
  
  
    
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  curl -X GET \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     "https://sqladmin.googleapis.com/v1beta4/projects/project-ID/operations/operation-ID"
  PowerShell(Windows)
  
  
    
      
    
  
  
  次のコマンドを実行します。
  
  
  
  
    
  
  
  
  
  
    
    
  
  
  
  
  
  
  
  
  
  
  
  
    
  
  
  
  
  
  
  
  
    
  
  $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
    次のような JSON レスポンスが返されます。
    
レスポンス
  
{
  "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"
}
 
トラブルシューティング
  
    | 問題 | 
    トラブルシューティング | 
  
  
      
    エラー メッセージ: You can't cancel operation [operation-ID] because
      this operation isn't in progress. | 
    
       完了した、失敗した、またはキャンセルされたインポートまたはエクスポートのオペレーションをキャンセルしようとしています。実行中のオペレーションはキャンセルできます。 
     | 
  
        
    エラー メッセージ: You can't cancel operation [operation-ID] because
      Cloud SQL doesn't support the cancellation of an [operation-type]
      operation. | 
    Cloud SQL には、IMPORT または EXPORT 以外のオペレーション タイプがあるため、オペレーションのキャンセルをサポートしていません。 
     |     
  
        
    エラー メッセージ: The [operation-type] operation isn't cancelled. Wait
      and retry in a few seconds. | 
    
       現時点では、Cloud SQL はインポート オペレーションとエクスポート オペレーションをキャンセルできません。しばらくしてから、もう一度お試しください。問題が解決しない場合は、Google Cloud サポートまでご連絡ください。 
     | 
  
  
次のステップ
  
  
  
    
  
  
 
  
    
    
      
       
         
  
       
    
    
  
  
  特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
  最終更新日 2025-10-20 UTC。
  
  
    
    
    
      
  
    
  
  
    
      [[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-10-20 UTC。"],[],[]]