我想刪除 Amazon Aurora 資料庫叢集。但我收到錯誤訊息,或 Aurora 和 Amazon Relational Database Service (Amazon RDS) 主控台中的刪除選項無法使用 (顯示為灰色)。
解決方法
**注意:**如果您在執行 AWS Command Line Interface (AWS CLI) 命令時收到錯誤訊息,請參閱 Troubleshooting errors for the AWS CLI (對 AWS CLI 錯誤進行疑難排解)。此外,請務必使用最新版 AWS CLI。
如果刪除 Aurora 資料庫叢集的選項無法使用,則表示叢集中存在您必須先刪除的資料庫執行個體。
**注意:**如果您使用 Aurora 和 RDS 主控台刪除資料庫執行個體,則 Amazon RDS 會在叢集為空時自動刪除該叢集。
刪除所有執行個體後,您可以使用 Amazon RDS 主控台或 AWS CLI 刪除空叢集。
一個資料庫叢集只能有一個寫入器執行個體,和至少一個讀取器執行個體或讀取複寫。當您刪除讀取器執行個體時,不會影響寫入器執行個體和叢集。如果您刪除寫入器執行個體,那麼 Aurora 會自動將讀取器執行個體提升為寫入器執行個體。此容錯移轉作業會導致停機。
如果您在刪除叢集時收到錯誤,請根據收到的錯誤訊息採取以下疑難排解措施。
"Deletion protection option enabled" 錯誤
如果您啟用了叢集的刪除保護,那麼您可能會收到下列錯誤訊息:
"This database has deletion protection option enabled, to be able to delete the last Aurora DB instance, modify the Aurora cluster and disable deletion protection".
若要解決此問題,請完成下列步驟:
- 開啟 Aurora 和 RDS 主控台。
- 在導覽窗格中,選擇 Databases (資料庫),然後選取叢集。
- 選擇 Actions (動作),然後選擇 Modify cluster (修改叢集)。
- 選擇 Disable deletion protection (停用刪除保護),然後選擇 Continue (繼續)。
- 選擇 Apply immediately (立即套用)。
"Deletion protection option enabled" AWS CLI 錯誤
如果您使用 AWS CLI 刪除叢集,那麼您可能會收到以下錯誤訊息:
"An error occurred (InvalidDBClusterStateFault) when calling the DeleteDBCluster operation: Cluster cannot be deleted, it still contains DB instances in non-deleting state".
此錯誤表示叢集中仍有必須刪除的資料庫執行個體。
"FinalDBSnapshotIdentified cannot be specified" AWS CLI 錯誤
如果 AWS CLI 在執行刪除作業之前無法擷取資料庫叢集的最終快照,那麼您將收到以下錯誤訊息:
"InvalidParameterCombination: An error occurred (InvalidParameterCombination) when calling the DeleteDBInstance operation: FinalDBSnapshotIdentifier cannot be specified when deleting a cluster instance".
若要解決此問題,請在執行 delete-db-cluster 命令時,移除 --final-db-snapshot-identifier 選項或使用 --skip-final-snapshot 選項。
如果您無法刪除全域叢集,請執行下列 modify-global-cluster 命令以停用全域叢集中的刪除保護:
aws rds modify-global-cluster --global-cluster-identifier example-id --no-deletion-protection --profile example-profile --region example-region
**注意:**請將 example-id 替換為您的全域叢集識別碼、example-profile 替換為您的使用者設定檔,並將 example-region 替換為您的 AWS 區域。
"Cannot delete the last instance of the read replica" 錯誤
如果要刪除的資料庫叢集是複本,那麼您會收到以下錯誤訊息:
"InvalidDBClusterStateFault: Cannot delete the last instance of the read replica DB cluster.Promote the DB cluster to a standalone DB cluster in order to delete it".
若要解決此問題,請將叢集提升為獨立資料庫叢集,然後刪除叢集。
相關資訊
如何刪除或終止 Amazon RDS 資源?
Managing an Amazon Aurora DB cluster (管理 Amazon Aurora 資料庫叢集)