管理保留的備份
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本頁面說明如何啟用、停用及管理 Cloud SQL 執行個體的保留備份。
保留備份是指在刪除執行個體後保留的備份。這些備份包括在執行個體上線時建立的隨選和自動備份。如要進一步瞭解保留備份的運作方式,請參閱「保留備份」。
您隨時可以編輯執行個體,為執行個體啟用保留備份。您也可以將保留的備份還原至新的或現有的執行個體。
事前準備
如要管理 Google Cloud 專案中的保留備份,您必須具備下列權限:
工作 |
所需權限 |
列出備份 |
cloudsql.backupRuns.list |
說明備份 |
cloudsql.backupRuns.get |
更新備份 |
cloudsql.backupRuns.update |
刪除備份 |
cloudsql.backupRuns.delete |
如要管理 Google Cloud 專案中的保留備份,您必須具備下列權限:
動作 |
指令 |
所需權限 |
列出備份 |
gcloud sql backups list |
cloudsql.backupRuns.list |
說明備份 |
gcloud sql backups describe |
cloudsql.backupRuns.get |
更新備份 |
gcloud sql backups patch |
cloudsql.backupRuns.update |
刪除備份 |
gcloud sql backups delete |
cloudsql.backupRuns.delete |
REST
如要管理 Google Cloud 專案中的保留備份,您必須具備下列權限:
動作 |
方法 |
所需權限 |
列出備份 |
backups.listBackup |
cloudsql.backupRuns.list |
說明備份 |
backups.getBackup |
cloudsql.backupRuns.get |
更新備份 |
backups.updateBackup |
cloudsql.backupRuns.update |
刪除備份 |
backups.deleteBackup |
cloudsql.backupRuns.delete |
為執行個體啟用保留備份
您可以在建立執行個體或編輯現有執行個體時,在執行個體的「資料保護」設定選項中啟用保留備份。
查看所有保留備份的清單
您可以使用Google Cloud 控制台、gcloud CLI 或 Cloud SQL API,查看 Google Cloud 專案保留的所有備份清單。備份會包含詳細資料,例如備份名稱、備份所屬的執行個體、備份類型,以及執行個體的刪除時間。由於已刪除的執行個體名稱可重複使用,建議您使用 instance deletion time
欄位,區分特定備份屬於哪個執行個體。對於實際執行個體,這個欄位會是空白。
主控台
前往 Google Cloud 控制台的「Cloud SQL 備份」頁面。
前往 Cloud SQL 備份
按一下要查看備份的已刪除執行個體名稱。
您會看到所有保留和最終備份的清單,以及刪除的例項詳細資料。
gcloud
如要取得與 Google Cloud 專案相關聯的所有備份清單,請使用 gcloud sql backups list 指令:
gcloud sql backups list
--project=PROJECT_ID
更改下列內容:
PROJECT_ID
: Google Cloud 專案的 ID。
如要查看特定保留備份的詳細資料,請使用 gcloud sql backups describe 指令:
gcloud sql backups describe BACKUP_NAME
--project=PROJECT_ID
更改下列內容:
BACKUP_NAME
:保留備份的名稱。
PROJECT_ID
: Google Cloud 專案的 ID。
REST v1
取得所有保留回溯資料的清單
您可以使用這個範例,取得與Google Cloud 專案相關聯的所有保留備份清單。如需此呼叫的完整參數清單,請參閱 backups.listBackups
頁面。
使用任何要求資料之前,請先替換以下項目:
HTTP 方法和網址:
GET https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups
如要傳送要求,請展開以下其中一個選項:
curl (Linux、macOS 或 Cloud Shell)
執行下列指令:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups"
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/backups" | Select-Object -Expand Content
您應該會收到如下的 JSON 回應:
回應
{
"name": "projects/PROJECT_ID/backups/BACKUP_ID",
"kind": "sql#backup",
"state": "SUCCESSFUL",
"backupInterval": {
"startTime": "2020-01-21T11:25:33.858Z",
"endTime": "2020-01-21T11:26:18.663Z",
}
"type": "FINAL",
"instance": "INSTANCE_ID",
"selfLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups/BACKUP_ID",
"location": "us"
"description": "This is a final backup.",
"backupKind": "SNAPSHOT",
"dataDiskSizeGB": "10",
"expiryTime": "2020-01-30T11:26:18.663Z",
"backup_run": "projects/PROJECT_ID/instances/INSTANCE_ID/backupRuns/BACKUP_RUN_ID",
"satisfies_pzs": false,
"satisfies_pzi": false
}
查看保留備份的詳細資料
請參考這個範例,瞭解如何查看保留備份的詳細資料。如需此呼叫的完整參數清單,請參閱 backup.getBackup
頁面。
使用任何要求資料之前,請先替換以下項目:
- PROJECT_ID:專案 ID。
- BACKUP_ID:備份 ID。您可以從執行上一個呼叫的輸出內容取得這個 ID。
HTTP 方法和網址:
GET https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups/BACKUP_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/backups/BACKUP_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/backups/BACKUP_ID" | Select-Object -Expand Content
您應該會收到如下的 JSON 回應:
回應
{
"name": "projects/PROJECT_ID/backups/BACKUP_ID",
"kind": "sql#backup",
"status": "SUCCESSFUL",
"backupInterval": {
"startTime": "2020-01-21T11:25:33.858Z",
"endTime": "2020-01-21T11:26:18.663Z",
}
"type": "FINAL",
"instance": "INSTANCE_ID",
"selfLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups/BACKUP_ID",
"location": "us"
"description": "final backup",
"backupKind": "SNAPSHOT",
"dataDiskSizeGB": "10",
"expiryTime": "2020-01-30T11:26:18.663Z",
"backup_run": "projects/PROJECT_ID/instances/INSTANCE_ID/backupRuns/BACKUP_RUN_ID",
"satisfies_pzs": false,
"satisfies_pzi": false
}
REST v1beta4
取得所有保留回溯資料的清單
您可以使用這個範例,取得與Google Cloud 專案相關聯的所有保留備份清單。如需此呼叫的完整參數清單,請參閱 backups.listBackups
頁面。
使用任何要求資料之前,請先替換以下項目:
HTTP 方法和網址:
GET https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups
如要傳送要求,請展開以下其中一個選項:
curl (Linux、macOS 或 Cloud Shell)
執行下列指令:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups"
PowerShell (Windows)
執行下列指令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups" | Select-Object -Expand Content
您應該會收到如下的 JSON 回應:
回應
{
"name": "projects/PROJECT_ID/backups/BACKUP_ID",
"kind": "sql#backup",
"state": "SUCCESSFUL",
"backupInterval": {
"startTime": "2020-01-21T11:25:33.858Z",
"endTime": "2020-01-21T11:26:18.663Z",
}
"type": "FINAL",
"instance": "INSTANCE_ID",
"selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID",
"location": "us"
"description": "This is a final backup.",
"backupKind": "SNAPSHOT",
"dataDiskSizeGB": "10",
"expiryTime": "2020-01-30T11:26:18.663Z",
"backup_run": "projects/PROJECT_ID/instances/INSTANCE_ID/backupRuns/BACKUP_RUN_ID",
"satisfies_pzs": false,
"satisfies_pzi": false
}
查看保留備份的詳細資料
請參考這個範例,瞭解如何查看保留備份的詳細資料。如需此呼叫的完整參數清單,請參閱 backups.getBackup
頁面。
使用任何要求資料之前,請先替換以下項目:
- PROJECT_ID:專案 ID。
- BACKUP_ID:備份 ID。您可以從執行上一個呼叫的輸出內容取得這個 ID。
HTTP 方法和網址:
GET https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID
如要傳送要求,請展開以下其中一個選項:
curl (Linux、macOS 或 Cloud Shell)
執行下列指令:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID"
PowerShell (Windows)
執行下列指令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID" | Select-Object -Expand Content
您應該會收到如下的 JSON 回應:
回應
{
"name": "projects/PROJECT_ID/backups/BACKUP_ID",
"kind": "sql#backup",
"status": "SUCCESSFUL",
"backupInterval": {
"startTime": "2020-01-21T11:25:33.858Z",
"endTime": "2020-01-21T11:26:18.663Z",
}
"type": "FINAL",
"instance": "INSTANCE_ID",
"selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID",
"location": "us"
"description": "final backup",
"backupKind": "SNAPSHOT",
"dataDiskSizeGB": "10",
"expiryTime": "2020-01-30T11:26:18.663Z",
"backup_run": "projects/PROJECT_ID/instances/INSTANCE_ID/backupRuns/BACKUP_RUN_ID",
"satisfies_pzs": false,
"satisfies_pzi": false
}
更新保留備份的說明
您隨時可以更新保留備份的說明,方便辨識備份。
主控台
前往 Google Cloud 控制台的「Cloud SQL 備份」頁面。
前往 Cloud SQL 備份
按一下要查看備份的已刪除執行個體名稱。
您會看到所有保留和最終備份的清單,以及刪除的例項詳細資料。
找出要更新的保留備份,然後點選「更多動作」圖示
,再選取「編輯說明」。
在「Edit Backup Description」視窗中,更新備份的說明。
按一下 [Update]。
gcloud
如要更新保留備份的說明,請使用 gcloud sql backups patch 指令:
gcloud sql backups patch BACKUP_NAME
--description=BACKUP_DESCRIPTION
更改下列內容:
BACKUP_NAME
:保留備份的名稱。
BACKUP_DESCRIPTION
:您要新增至保留備份的說明。
REST v1
取得所有保留回溯資料的清單
您可以使用這個範例,取得與Google Cloud 專案相關聯的所有保留備份清單。如需此呼叫的完整參數清單,請參閱 backups.listBackups
頁面。
使用任何要求資料之前,請先替換以下項目:
HTTP 方法和網址:
GET https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups
如要傳送要求,請展開以下其中一個選項:
curl (Linux、macOS 或 Cloud Shell)
執行下列指令:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups"
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/backups" | Select-Object -Expand Content
您應該會收到如下的 JSON 回應:
回應
{
"name": "projects/PROJECT_ID/backups/BACKUP_ID",
"kind": "sql#backup",
"state": "SUCCESSFUL",
"backupInterval": {
"startTime": "2020-01-21T11:25:33.858Z",
"endTime": "2020-01-21T11:26:18.663Z",
}
"type": "FINAL",
"instance": "INSTANCE_ID",
"selfLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups/BACKUP_ID",
"location": "us"
"description": "This is a final backup.",
"backupKind": "SNAPSHOT",
"dataDiskSizeGB": "10",
"expiryTime": "2020-01-30T11:26:18.663Z",
"backup_run": "projects/PROJECT_ID/instances/INSTANCE_ID/backupRuns/BACKUP_RUN_ID",
"satisfies_pzs": false,
"satisfies_pzi": false
}
更新說明
請參考以下範例,更新保留備份的說明。如需此呼叫的完整參數清單,請參閱 backups.updateBackup
頁面。
使用任何要求資料之前,請先替換以下項目:
- PROJECT_ID:專案 ID。
- BACKUP_ID:備份 ID。您可以從執行上一個呼叫的輸出內容取得這個 ID。
- DESCRIPTION:最終備份的更新說明。
HTTP 方法和網址:
PATCH https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups/BACKUP_ID?update_mask=description
JSON 要求主體:
{
"backup": {
"description": DESCRIPTION,
},
}
如要傳送要求,請展開以下其中一個選項:
curl (Linux、macOS 或 Cloud Shell)
將要求主體儲存在名為 request.json
的檔案中,然後執行下列指令:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups/BACKUP_ID?update_mask=description"
PowerShell (Windows)
將要求主體儲存在名為 request.json
的檔案中,然後執行下列指令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups/BACKUP_ID?update_mask=description" | Select-Object -Expand Content
您應該會收到如下的 JSON 回應:
回應
{
"kind": "sql#operation",
"targetLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups/BACKUP_ID",
"status": "DONE",
"user": "[email protected]",
"insertTime": "2024-02-15T00:10:22.078Z",
"operationType": "UPDATE_BACKUP",
"name": "OPERATION_ID",
"targetId": "BACKUP_ID",
"selfLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/operations/OPERATION_ID",
"targetProject": "PROJECT_ID"
}
REST v1beta4
取得所有保留回溯資料的清單
您可以使用這個範例,取得與Google Cloud 專案相關聯的所有保留備份清單。如需此呼叫的完整參數清單,請參閱 backups.listBackups
頁面。
使用任何要求資料之前,請先替換以下項目:
HTTP 方法和網址:
GET https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups
如要傳送要求,請展開以下其中一個選項:
curl (Linux、macOS 或 Cloud Shell)
執行下列指令:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups"
PowerShell (Windows)
執行下列指令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups" | Select-Object -Expand Content
您應該會收到如下的 JSON 回應:
回應
{
"name": "projects/PROJECT_ID/backups/BACKUP_ID",
"kind": "sql#backup",
"state": "SUCCESSFUL",
"backupInterval": {
"startTime": "2020-01-21T11:25:33.858Z",
"endTime": "2020-01-21T11:26:18.663Z",
}
"type": "FINAL",
"instance": "INSTANCE_ID",
"selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID",
"location": "us"
"description": "This is a final backup.",
"backupKind": "SNAPSHOT",
"dataDiskSizeGB": "10",
"expiryTime": "2020-01-30T11:26:18.663Z",
"backup_run": "projects/PROJECT_ID/instances/INSTANCE_ID/backupRuns/BACKUP_RUN_ID",
"satisfies_pzs": false,
"satisfies_pzi": false
}
更新說明
請參考以下範例,更新保留備份的說明。如需此呼叫的完整參數清單,請參閱 backups.updateBackup
頁面。
使用任何要求資料之前,請先替換以下項目:
- PROJECT_ID:專案 ID。
- BACKUP_ID:備份 ID。您可以從執行上一個呼叫的輸出內容取得這個 ID。
- DESCRIPTION:最終備份的更新說明。
HTTP 方法和網址:
PATCH https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID?update_mask=description
JSON 要求主體:
{
"backup": {
"description": DESCRIPTION,
},
}
如要傳送要求,請展開以下其中一個選項:
curl (Linux、macOS 或 Cloud Shell)
將要求主體儲存在名為 request.json
的檔案中,然後執行下列指令:
curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID?update_mask=description"
PowerShell (Windows)
將要求主體儲存在名為 request.json
的檔案中,然後執行下列指令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID?update_mask=description" | Select-Object -Expand Content
您應該會收到如下的 JSON 回應:
回應
{
"kind": "sql#operation",
"targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID",
"status": "DONE",
"user": "[email protected]",
"insertTime": "2024-02-15T00:10:22.078Z",
"operationType": "UPDATE_BACKUP",
"name": "OPERATION_ID",
"targetId": "BACKUP_ID",
"selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/operations/OPERATION_ID",
"targetProject": "PROJECT_ID"
}
刪除保留的備份
您可以使用 Google Cloud 控制台、gcloud CLI 或 Cloud SQL API 刪除保留的備份。
主控台
前往 Google Cloud 控制台的「Cloud SQL 備份」頁面。
前往 Cloud SQL 備份
按一下要查看備份的已刪除執行個體名稱。
您會看到所有保留和最終備份的清單,以及刪除的例項詳細資料。
針對要刪除的保留備份,按一下更多動作圖示
,然後選取「Delete」(刪除)。
在「Delete backup」視窗中輸入要刪除的執行個體名稱,然後按一下「Delete」。
REST v1
取得所有保留回溯資料的清單
您可以使用這個範例,取得與Google Cloud 專案相關聯的所有保留備份清單。如需此呼叫的完整參數清單,請參閱 backups.listBackups
頁面。
使用任何要求資料之前,請先替換以下項目:
HTTP 方法和網址:
GET https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups
如要傳送要求,請展開以下其中一個選項:
curl (Linux、macOS 或 Cloud Shell)
執行下列指令:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups"
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/backups" | Select-Object -Expand Content
您應該會收到如下的 JSON 回應:
回應
{
"name": "projects/PROJECT_ID/backups/BACKUP_ID",
"kind": "sql#backup",
"state": "SUCCESSFUL",
"backupInterval": {
"startTime": "2020-01-21T11:25:33.858Z",
"endTime": "2020-01-21T11:26:18.663Z",
}
"type": "FINAL",
"instance": "INSTANCE_ID",
"selfLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups/BACKUP_ID",
"location": "us"
"description": "This is a final backup.",
"backupKind": "SNAPSHOT",
"dataDiskSizeGB": "10",
"expiryTime": "2020-01-30T11:26:18.663Z",
"backup_run": "projects/PROJECT_ID/instances/INSTANCE_ID/backupRuns/BACKUP_RUN_ID",
"satisfies_pzs": false,
"satisfies_pzi": false
}
刪除保留的備份
請使用這個範例刪除保留的備份。如需此呼叫的完整參數清單,請參閱 backups.deleteBackup
頁面。
使用任何要求資料之前,請先替換以下項目:
- PROJECT_ID:專案 ID。
- BACKUP_ID:備份 ID。您可以從執行上一個呼叫的輸出內容取得這個 ID。
HTTP 方法和網址:
DELETE https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups/BACKUP_ID
如要傳送要求,請展開以下其中一個選項:
curl (Linux、macOS 或 Cloud Shell)
執行下列指令:
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups/BACKUP_ID"
PowerShell (Windows)
執行下列指令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups/BACKUP_ID" | Select-Object -Expand Content
您應該會收到如下的 JSON 回應:
回應
{
"kind": "sql#operation",
"targetLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/backups/BACKUP_ID",
"status": "PENDING",
"user": "[email protected]",
"insertTime": "2020-01-21T22:43:37.981Z",
"operationType": "DELETE_BACKUP",
"name": "OPERATION_ID",
"targetId": "BACKUP_ID",
"selfLink": "https://sqladmin.googleapis.com/v1/projects/PROJECT_ID/operations/OPERATION_ID",
"targetProject": "PROJECT_ID"
}
REST v1beta4
取得所有保留回溯資料的清單
您可以使用這個範例,取得與Google Cloud 專案相關聯的所有保留備份清單。如需此呼叫的完整參數清單,請參閱 backups.listBackups
頁面。
使用任何要求資料之前,請先替換以下項目:
HTTP 方法和網址:
GET https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups
如要傳送要求,請展開以下其中一個選項:
curl (Linux、macOS 或 Cloud Shell)
執行下列指令:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups"
PowerShell (Windows)
執行下列指令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups" | Select-Object -Expand Content
您應該會收到如下的 JSON 回應:
回應
{
"name": "projects/PROJECT_ID/backups/BACKUP_ID",
"kind": "sql#backup",
"state": "SUCCESSFUL",
"backupInterval": {
"startTime": "2020-01-21T11:25:33.858Z",
"endTime": "2020-01-21T11:26:18.663Z",
}
"type": "FINAL",
"instance": "INSTANCE_ID",
"selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID",
"location": "us"
"description": "This is a final backup.",
"backupKind": "SNAPSHOT",
"dataDiskSizeGB": "10",
"expiryTime": "2020-01-30T11:26:18.663Z",
"backup_run": "projects/PROJECT_ID/instances/INSTANCE_ID/backupRuns/BACKUP_RUN_ID",
"satisfies_pzs": false,
"satisfies_pzi": false
}
刪除保留的備份
請使用這個範例刪除保留的備份。如需此呼叫的完整參數清單,請參閱 backups.deleteBackup
頁面。
使用任何要求資料之前,請先替換以下項目:
- PROJECT_ID:專案 ID。
- BACKUP_ID:備份 ID。您可以從執行上一個呼叫的輸出內容取得這個 ID。
HTTP 方法和網址:
DELETE https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID
如要傳送要求,請展開以下其中一個選項:
curl (Linux、macOS 或 Cloud Shell)
執行下列指令:
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID"
PowerShell (Windows)
執行下列指令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID" | Select-Object -Expand Content
您應該會收到如下的 JSON 回應:
回應
{
"kind": "sql#operation",
"targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/backups/BACKUP_ID",
"status": "PENDING",
"user": "[email protected]",
"insertTime": "2020-01-21T22:43:37.981Z",
"operationType": "DELETE_BACKUP",
"name": "OPERATION_ID",
"targetId": "BACKUP_ID",
"selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/PROJECT_ID/operations/OPERATION_ID",
"targetProject": "PROJECT_ID"
}
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-05-16 (世界標準時間)。
[[["容易理解","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-05-16 (世界標準時間)。"],[],[]]