

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

# 從 RDS Custom for SQL Server 資料庫快照還原
<a name="custom-backup-sqlserver.restoring"></a>

還原 RDS Custom for SQL Server 資料庫執行個體時，您要提供資料庫快照的名稱和新執行個體的名稱。您無法從快照還原至現有的 RDS Custom 資料庫執行個體。還原時，會建立新的 RDS Custom for SQL Server 資料庫執行個體。

從快照還原會將儲存體磁碟區還原至拍攝快照的時間點。這將包括 `(D:)` 磁碟區上存在的所有資料庫和任何其他檔案。

## 主控台
<a name="custom-backup-sqlserver.restoring.console"></a>

**若要從資料庫快照還原 RDS Custom 資料庫執行個體**

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

1. 在導覽窗格中，選擇 **Snapshots** (快照)。

1. 選擇想要從中還原的資料庫執行個體。

1. 針對 **Actions** (動作)，選擇 **Restore snapshot** (還原快照)。

1. 在 **Restore DB Instance** (還原資料庫執行個體) 頁面上，針對 **DB Instance Identifier (資料庫執行個體識別符)**，輸入您還原的 RDS Custom 資料庫執行個體的名稱。

1. 選擇 **Restore DB instance** (還原資料庫執行個體)。

## AWS CLI
<a name="custom-backup-sqlserver.restoring.CLI"></a>

您可以使用 [restore-db-instance-from-db-snapshot](https://docs.aws.amazon.com/cli/latest/reference/rds/restore-db-instance-from-db-snapshot.html) AWS CLI 命令來還原 RDS Custom 資料庫快照。

如果您要從中還原的快照適用於私有資料庫執行個體，請務必指定正確的 `db-subnet-group-name` 和 `no-publicly-accessible`。否則，資料庫執行個體預設為可公開存取。下列選項是必要的：
+ `db-snapshot-identifier` – 識別要從中進行還原的快照
+ `db-instance-identifier` – 指定要從資料庫快照建立之 RDS Custom 資料庫執行個體的名稱
+ `custom-iam-instance-profile` – 指定與 RDS Custom 資料庫執行個體的基礎 Amazon EC2 執行個體關聯的執行個體設定檔。

下列程式碼會為 `my-custom-instance` 還原名稱為 `my-custom-snapshot` 的快照。

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

```
aws rds restore-db-instance-from-db-snapshot \
  --db-snapshot-identifier my-custom-snapshot \
  --db-instance-identifier my-custom-instance \
  --custom-iam-instance-profile AWSRDSCustomInstanceProfileForRdsCustomInstance \
  --no-publicly-accessible
```
在 Windows 中：  

```
aws rds restore-db-instance-from-db-snapshot ^
  --db-snapshot-identifier my-custom-snapshot ^
  --db-instance-identifier my-custom-instance ^
  --custom-iam-instance-profile AWSRDSCustomInstanceProfileForRdsCustomInstance ^
  --no-publicly-accessible
```