Amazonrds 简明教程
Amazon RDS - MS SQL DB Export Import
Amazon RDS MSSQL 提供本机备份和还原机制,作为导出和导入 DB 的机制。可以从内部部署数据库创建完整的备份文件,并将其存储在 Amazon S3 中。接下来,将此备份文件还原到运行 SQL 服务器的现有 Amazon RDS DB 实例。我们可以遵循完全类似的步骤,将数据从 Amazon RDS MSSQL 实例导出并将其还原到内部部署的 SQL Server 数据库。
Amazon RDS MSSQL provides native backup and restore as a mechanism to export and import the DB. A full backup file can be created from the on-premise database and stored in Amazon S3. Next this backup file is restored to an existing Amazon RDS DB instance running SQL server. We can follow just the similar steps to export the data from Amazon RDS MSSQL instance and restore it to an on-premise SQL Server database.
下图说明了这一方法。
The below diagram describes the approach.
我们将上面创建的备份文件上载到与目标 RDS MSSQL 数据库所在同一区域中预定的 Amazon S3 存储桶。您可以通过链接: this link 了解如何上传。
We upload the backup file created above to a pre-decided Amazon S3 bucket in the same region where the target RDS MSSQL database is present. You can follow link: this link to learn about how to upload.
此本机备份和还原机制具有以下优势。
This native backup and restore mechanism has the following advantages.
-
Migrate databases to Amazon RDS.
-
Move databases between Amazon RDS SQL Server DB instances.
-
Import and export data.
-
Migrate schemas, stored procedures, triggers and other database code.
-
Backup and restore single databases, instead of entire DB instances.
-
Create copies of databases for testing, training, and demonstrations.
-
Store and transfer backup files into and out of Amazon RDS through Amazon S3, giving you an added layer of protection for disaster recovery.
Backing Up a Database
要备份数据库,您在从 SSMS 客户端软件连接到 Amazon RDS MSSQL 实例后调用 rds_backup_database 存储过程。存储过程使用以下参数执行。
To back up your database, you call the rds_backup_database stored procedure after connecting to the Amazon RDS MSSQL instance from the SSMS client software. The stored procedure is executed using following parameters.
exec msdb.dbo.rds_backup_database
@source_db_name='database_name',
@s3_arn_to_backup_to='arn:aws:s3:::bucket_name/file_name_and_extension',
@kms_master_key_arn='arn:aws:kms:region:account-id:key/key-id',
@overwrite_S3_backup_file=1,
@type='FULL';
成功完成以上存储过程将生成一个备份文件,并将其存储在 S3 的指定存储桶中。
The successful completion of the above stored procedure creates a backup file and stores it in the mentioned bucket of S3.
Restoring a Database
要恢复数据库,请在通过 SSMS 客户端软件连接到 Amazon RDS MSSQL 实例后,调用 rds_restore_database 存储过程。使用以下参数执行存储过程。
To restore your database, you call the rds_restore_database stored procedure after connecting to the Amazon RDS MSSQL instance from the SSMS client software. The stored procedure is executed using following parameters.
exec msdb.dbo.rds_restore_database
@restore_db_name='database_name',
@s3_arn_to_restore_from='arn:aws:s3:::bucket_name/file_name_and_extension',
@kms_master_key_arn='arn:aws:kms:region:account-id:key/key-id';