

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 管理 Amazon RDS Custom for SQL Server 資料庫執行個體
<a name="custom-managing-sqlserver"></a>

Amazon RDS Custom for SQL Server 支援 Amazon RDS 資料庫執行個體一般管理任務的子集。接著，您可以使用 AWS 管理主控台 和 AWS CLI尋找支援的 RDS Custom for SQL Server 管理任務的指示。

**Topics**
+ [暫停和繼續 RDS Custom 自動化](custom-managing-sqlserver.pausing.md)
+ [修改 RDS Custom for SQL Server 資料庫執行個體](custom-managing.modify-sqlserver.md)
+ [修改 RDS Custom for SQL Server 資料庫執行個體的儲存體](custom-managing-sqlserver.storage-modify.md)
+ [標記 RDS Custom for SQL Server 資源](custom-managing-sqlserver.tagging.md)
+ [刪除 RDS Custom for SQL Server 資料庫執行個體](#custom-managing-sqlserver.deleting)
+ [啟動與停止 RDS Custom for SQL Server 資料庫執行個體](custom-managing-sqlserver.startstop.md)

## 刪除 RDS Custom for SQL Server 資料庫執行個體
<a name="custom-managing-sqlserver.deleting"></a>

若要刪除 RDS Custom for SQL Server 資料庫執行個體，請執行以下操作：
+ 提供資料庫執行個體的名稱。
+ 選擇或清除讓您建立資料庫執行個體最終資料庫快照的選項。
+ 選擇或清除保留自動化備份的選項。

您可以使用主控台或 CLI 刪除 RDS Custom for SQL Server 資料庫執行個體。刪除資料庫執行個體所需的時間會因備份保留期間 (也就是要刪除的備份數量)、刪除的資料量，以及是否要拍攝最終快照而有所不同。

**警告**  
刪除 RDS Custom for SQL Server 資料庫執行個體會永久刪除 EC2 執行個體和相關聯的 Amazon EBS 磁碟區。您不應隨時終止或刪除這些資源，否則刪除和最終快照建立可能會失敗。

**注意**  
如果資料庫執行個體的狀態為 `creating`、`failed`、`incompatible-create`、`incompatible-restore` 或 `incompatible-network`，則無法建立該資料庫執行個體的最終資料庫快照。如需詳細資訊，請參閱[在 檢視 Amazon RDS 資料庫執行個體狀態](accessing-monitoring.md#Overview.DBInstance.Status)。

**重要**  
當您選擇建立最終快照時，建議您避免在資料庫執行個體刪除過程中將資料寫入至資料庫執行個體。一旦啟動了資料庫執行個體刪除，最終快照就不保證會擷取資料變更。

### 主控台
<a name="custom-managing-sqs.deleting.console"></a>

**若要刪除 RDS Custom 資料庫執行個體**

1. 登入 AWS 管理主控台 ，並在 [https://console.aws.amazon.com/rds/](https://console.aws.amazon.com/rds/)：// 開啟 Amazon RDS 主控台。

1. 在導覽窗格中選擇 **Databases** (資料庫)，然後選擇您要刪除的 RDS Custom for SQL Server 資料庫執行個體。RDS Custom for SQL Server 資料庫執行個體會顯示角色 **Instance (RDS Custom for SQL Server)** (執行個體 (RDS Custom for SQL Server))。

1. 對於 **Actions** (動作)，請選擇 **Delete** (刪除)。

1. 若要建立最終快照，請選擇 **Create final snapshot** (建立最終快照)，並提供 **Final snapshot name** (最終快照名稱) 的名稱。

1. 若要保留自動備份，請選擇 **Retain automated backups (保留自動備份)**。

1. 在方塊中輸入 **delete me**。

1. 選擇 **刪除**。

### AWS CLI
<a name="custom-managing-sqs.deleting.CLI"></a>

您可以使用 [delete-db-instance](https://docs.aws.amazon.com/cli/latest/reference/rds/delete-db-instance.html) AWS CLI 命令刪除 RDS Custom for SQL Server 資料庫執行個體。使用所需的參數 `--db-instance-identifier` 識別資料庫執行個體。其餘參數與 Amazon RDS 資料庫執行個體的參數相同。

下列範例會刪除名為 `my-custom-instance` 的 RDS Custom for SQL Server 資料庫執行個體、建立最終快照，並保留自動化備份。

**Example**  
在 Linux、macOS 或 Unix 中：  

```
aws rds delete-db-instance \
    --db-instance-identifier {{my-custom-instance}} \
    --no-skip-final-snapshot \
    --final-db-snapshot-identifier {{my-custom-instance-final-snapshot}} \
    --no-delete-automated-backups
```
在 Windows 中：  

```
aws rds delete-db-instance ^
    --db-instance-identifier {{my-custom-instance}} ^
    --no-skip-final-snapshot ^
    --final-db-snapshot-identifier {{my-custom-instance-final-snapshot}} ^
    --no-delete-automated-backups
```

若要建立最終快照，`--final-db-snapshot-identifier` 為必要選項，且必須加以指定。

若要略過最終快照，請在命令中指定 `--skip-final-snapshot` 選項，而非 `--no-skip-final-snapshot` 和 `--final-db-snapshot-identifier` 選項。

若要刪除自動備份，請在命令中指定 `--delete-automated-backups` 選項，而非 `--no-delete-automated-backups` 選項。