aws rds监控慢sql

This article will review about the recovery models backups and restore options in available AWS RDS SQL Server.

本文将介绍可用的AWS RDS SQL Server中的恢复模型备份和还原选项。

恢复模型 (Recovery Models)

使用自动备份: (With Automatic Backups:)

By default, when a new database is created it is created in simple recovery model. If the automatic backups are enabled on the database instance, with in five minutes the newly created database which is in simple recovery model will be changed to full recovery model.

默认情况下,创建新数据库时,将以简单恢复模型创建它。 如果在数据库实例上启用了自动备份,则五分钟之内将以简单恢复模式创建的新数据库将更改为完全恢复模式。

If the database is put into simple recovery model from full recovery model and the automatic backups are enabled on the database instance, after 5 minutes the database is put back into full recovery model and a snapshot of the AWS RDS SQL Server database instance is taken.

如果将数据库从完全恢复模型设置为简单恢复模型,并在数据库实例上启用了自动备份,则5分钟后,数据库将恢复为完全恢复模型,并拍摄了AWS RDS SQL Server数据库实例的快照。

没有自动备份: (Without Automatic Backups:)

When the database instance is launched without automatic backups, the new database created will be in simple recovery model. If we change the recovery model from simple to full, after 5 minutes the database is put back into simple recovery model.

如果在没有自动备份的情况下启动数据库实例,则创建的新数据库将处于简单恢复模型中。 如果将恢复模式从简单恢复模式更改为完全恢复模式,则5分钟后,数据库将恢复为简单恢复模式。

使用多可用区部署: ( With Multi-AZ deployment: )

When the database is deployed in multiple AZ. The database is always in full recovery model. If you try to change the database to simple recovery model, AWS RDS immediately changes the recovery model back to full and rebuilds the mirror automatically. During the rebuild the secondary is degraded until it is ready for failover.

当数据库部署在多个可用区中时。 数据库始终处于完全恢复模式。 如果您尝试将数据库更改为简单恢复模型,则AWS RDS会立即将恢复模型重新更改为完全恢复并自动重建镜像。 在重建期间,辅助节点将降级,直到可以进行故障转移为止。

So, do not change the recovery model on your databases even though AWS RDS SQL Server allows you to change.

因此,即使AWS RDS SQL Server允许您进行更改,也不要更改数据库上的恢复模型。

后备 (Backups)

AWS RDS takes backup of your database instances automatically and save these backups as per retention period you selected while creating the instances.

AWS RDS自动获取数据库实例的备份,并根据您在创建实例时选择的保留期限保存这些备份。

A full snapshot of your database instance is taken every day during the specified backup window and incremental snapshots are taken every 5 minutes. These backups include entire database instance not the individual databases. The automated backups can be taken when the database instance is in ACTIVE state only.

每天在指定的备份窗口内拍摄数据库实例的完整快照,并每5分钟拍摄一次增量快照。 这些备份包括整个数据库实例,而不是单个数据库。 仅当数据库实例处于活动状态时,才能进行自动备份。

启用自动备份: (Enable Automatic Backups:)

To enable automatic backups, we must select a positive value greater than zero in backup retention period while creating the database instance

要启用自动备份,我们在创建数据库实例时必须在备份保留期内选择一个大于零的正值。

We can also modify the retention period after creating the database instance by selecting the database instance and click on Modify.

我们也可以在创建数据库实例后修改保留期,方法是选择数据库实例,然后单击“修改”。

To get the latest backup information Navigate to Automated backups. You can the list of active backups by instance wise.

要获取最新的备份信息,请导航到自动备份。 您可以按实例选择活动备份的列表。

禁用自动备份: (Disable Automatic Backups:)

To disable automatic backups, select the retention period as zero while creating the database instance or modify the database instance if it is already created.

要禁用自动备份,请在创建数据库实例时将保留期限选择为零,或者如果已创建数据库实例,则将其修改。

手动备份: (Manual Backups:)

Click on Databases and select the database instance you want to backup. Click on the Actions drop down and select Take Snapshot

单击数据库,然后选择要备份的数据库实例。 单击“ 操作”下拉菜单,然后选择“ 拍摄快照”

In Take DB Snapshot window, Input the snapshot name and click on Take Snapshot.

在“ 获取数据库快照”窗口中,输入快照名称,然后单击“ 获取快照”

Now navigate to Snapshots and you can see the list of available snapshots of your database instances.

现在,导航到“ 快照” ,您可以看到数据库实例的可用快照列表。

恢复 (Restore)

从快照还原: (Restore from snapshots:)

You can always restore the backup/snapshot to a new database instance by providing the name of the new database instance. You cannot restore the snapshot to existing database instance.

您始终可以通过提供新数据库实例的名称将备份/快照还原到新数据库实例。 您无法将快照还原到现有数据库实例。

Navigate to Snapshots, select the snapshot you want to restore to a new instance. Click on Actions drop down and select Restore Snapshot

导航到“快照”,选择要还原到新实例的快照。 单击“操作”下拉列表,然后选择“还原快照”

In Restore DB instance page, Provide the new database instance name, other configurations and click on Restore DB instance at bottom of the page. Navigate to the Databases and you can see the new database which you restored.

在“还原数据库实例”页面中,提供新的数据库实例名称,其他配置,然后单击页面底部的“还原数据库实例”。 导航到数据库,您可以看到还原的新数据库。

The default security group is associated with the restored instance. Once the restore is completed you must select the database instance and modify it to associate with your custom security group.

默认安全组与还原的实例关联。 恢复完成后,您必须选择数据库实例并对其进行修改以与您的自定义安全组关联。

从自动备份还原: (Restoring from Automated Backups:)

The database instance can be restored to point in time based on the retention period you have set. Restoring the database instance to point in time recovery will create a new database instance. The new instance will be created with default security group and you must modify the database instance to have custom security group.

可以根据您设置的保留期限将数据库实例还原到时间点。 还原数据库实例以进行时间点恢复将创建一个新的数据库实例。 将使用默认安全组创建新实例,并且您必须将数据库实例修改为具有自定义安全组。

Navigate to the Automated backups. You can see the details of backup like earliest restorable time and latest restorable time. You can restore the database instance to any point between the earliest restorable time and latest restorable time. These timing depend on the retention period you set for the database instance.

导航到自动备份。 您可以查看备份的详细信息,例如最早的可恢复时间和最新的可恢复时间。 您可以将数据库实例还原到最早的可恢复时间和最近的可恢复时间之间的任何时间。 这些时间取决于您为数据库实例设置的保留期限。

Navigate to the Databases. Select the database you want to restore the point in time. Click on the Actions drop down and select Restore to point in time.

导航到数据库。 选择要还原时间点的数据库。 单击“操作”下拉菜单,然后选择“还原”以指定时间点。

In Launch DB Instance page, select the latest restorable time if you want to restore the database instance to latest possible time. You can choose Custom and specify the date and time you want to restore the database instance to specific time.

如果要将数据库实例还原到最新的可能时间,请在“启动数据库实例”页面中选择最新的可还原时间。 您可以选择“自定义”,然后指定要将数据库实例还原到特定时间的日期和时间。

Input the new database instance name and other options and click on Launch DB Instance at bottom of the page. A new database instance is created with new instance provided.

输入新的数据库实例名称和其他选项,然后单击页面底部的启动数据库实例。 使用提供的新实例创建一个新的数据库实例。

本机备份 (Native Backups)

AWS RDS SQL Server provides an option to backup the individual databases of the instance to S3. We cannot issue a backup command on the database take backup the databases to physical drives as you can access the drives and Backup Database permission is denied on the database.

AWS RDS SQL Server提供了将实例的各个数据库备份到S3的选项。 我们无法在数据库上发出备份命令,因此无法将数据库备份到物理驱动器,因为您可以访问驱动器,并且数据库上的“备份数据库”权限被拒绝。

Below are the steps to take database backups to S3.

以下是将数据库备份到S3的步骤。

  • Configure the Option Groups 配置选项组
  • Modify the database instance to use the new option group 修改数据库实例以使用新的选项组
  • Backup and Restore using procedures 使用过程进行备份和还原

配置选项组: (Configure Option Groups:)

Navigate to Option Groups and click on Create Group. Give the name, description, SQL Server engine and the version and click Create.

导航到选项组 ,然后单击创建组。 提供名称,描述,SQL Server引擎和版本,然后单击“ 创建”。

Navigate to Options Group, select the group you created and click on Add option.

导航到选项组,选择您创建的组,然后单击添加选项。

In option details page, select the option SQLSERVER_BACKUP_RESTORE option. Select the IAM role if you already have one or create new IAM role. Select the S3 backut where backup is stored.

在选项详细信息页面中,选择选项SQLSERVER_BACKUP_RESTORE选项。 如果您已经拥有一个IAM角色,则选择它,或者创建新的IAM角色。 选择存储备份的S3背景。

Select Yes for Apply immediately and click on Add Option.

为立即应用选择 ,然后单击添加选项。

修改数据库实例: (Modify the database instance:)

Once the option is added to Option group, Navigate to Database and select the database instance. Click on Modify. In database options section, select the new option group you created and click Continue at the bottom of the page. Select Apply Immediately in scheduling of the modification and click on Modify DB Instance.

将选项添加到“选项”组后,导航到“数据库”并选择数据库实例。 单击修改。 在“数据库选项”部分中,选择您创建的新选项组,然后单击页面底部的“ 继续 ”。 在计划修改时间中选择立即应用 ,然后单击修改数据库实例。

备份数据库: (Backup database:)

Now login to AWS RDS SQL Server instance from SQL Server management studio using the endpoint of the database instance.

现在,使用数据库实例的终结点从SQL Server Management Studio登录到AWS RDS SQL Server实例。

In msdb database, execute rds_backup_database to backup your database to S3. Replace the S3 arn and database name with yours.

在msdb数据库中,执行rds_backup_database将数据库备份到S3。 用您的替换S3 arn和数据库名称。

Navigate to Amazon S3, Select the bucket to get the arn of the bucket Click on Copy Buck ARN to copy the S3 arn and use it in the procedure.

导航到Amazon S3,选择存储桶以获取存储桶的arn。单击Copy Buck ARN复制S3 arn并在该过程中使用它。

Below is the T-SQL script to back up the database to S3.

下面是将数据库备份到S3的T-SQL脚本。

EXEC rds_backup_database @source_db_name = 'SampleDatabase',@S3_arn_to_backup_to = 'arn:aws:s3:::nativebackups3/SampleDatabase.bak',@overwrite_S3_backup_file = 1

Once you execute this procedure a task is created, and the status of the backup is updated in lifecycle column.

执行此过程后,将创建一个任务,并在生命周期列中更新备份状态。

You can check the status of the task by executing the rds_task_status procedure with database or task id parameter.

您可以通过执行带有数据库或任务id参数的rds_task_status过程来检查任务的状态。

Once the status is success, the backup file is stored in S3 bucket you specified. Navigate to the S3 bucket and check for the backup file.

状态为成功后,备份文件将存储在您指定的S3存储桶中。 导航到S3存储桶并检查备份文件。

恢复数据库: (Restore database:)

Similarly, AWS RDS SQL Server provides rds_restore_database to restore the DATABASE from backup stored in S3

同样,AWS RDS SQL Server提供rds_restore_database来从存储在S3中的备份中还原数据库

Login to database instance from SQL Server management studio and in msdb execute the stored procedure by replacing the database name and s3 bucket arn.

从SQL Server Management Studio登录到数据库实例,然后在msdb中通过替换数据库名称和s3 bucket arn执行存储过程。

Below is the T-SQL script to restore database from backup in S3 bucket.

以下是从S3存储桶中的备份还原数据库的T-SQL脚本。

EXEC rds_restore_database @restore_db_name = 'NewSampleDB',@s3_arn_to_restore_from = 'arn:aws:s3:::nativebackups3/SampleDatabase.bak'

Once you execute this procedure, a restore task is created and you can check the status of task using rds_task_status procedure.

执行此过程后,将创建一个还原任务,您可以使用rds_task_status过程检查任务的状态。

翻译自: https://www.sqlshack.com/aws-rds-sql-server-recovery-models-backups-and-restores/

aws rds监控慢sql

aws rds监控慢sql_AWS RDS SQL Server恢复模型,备份和还原相关推荐

  1. sql安装弹出sqlcmd_讨论使用SQLCMD和SQL Server代理进行备份和还原自动化

    sql安装弹出sqlcmd Database administrators are often requested to refresh a database, mostly to create a ...

  2. sql server伪列_伪简单SQL Server恢复模型

    sql server伪列 This article gives an overview of the Pseudo Simple SQL Server Recovery Model. It also ...

  3. aws rds监控慢sql_AWS RDS SQL Server中的初始Windows身份验证配置

    aws rds监控慢sql In this article, we will be exploring the process of enabling Windows authentication i ...

  4. aws rds监控慢sql_AWS RDS SQL Server入门

    aws rds监控慢sql This article describes the concepts and steps to setup AWS RDS SQL Server(Relational D ...

  5. aws rds监控慢sql_AWS RDS SQL Server的多可用区配置

    aws rds监控慢sql Amazon provides AWS RDS SQL Server as a managed relational database service. You can d ...

  6. aws rds监控慢sql_AWS RDS SQL Server –监视数据库实例

    aws rds监控慢sql In this article, we will review how to monitor AWS RDS SQL Server database instances a ...

  7. aws rds监控慢sql_AWS RDS SQL Server中的本机差异备份概述

    aws rds监控慢sql This article explores the differential backups in AWS RDS SQL Server using recovery sc ...

  8. aws rds监控慢sql_AWS RDS SQL Server中的高级Windows身份验证配置

    aws rds监控慢sql This article will cover advanced configurations for Windows Authentication in AWS RDS ...

  9. aws rds监控慢sql_AWS RDS SQL Server –启动新的数据库实例

    aws rds监控慢sql This article will review on how to launch an AWS RDS SQL Server instance and how to co ...

最新文章

  1. 只需两步,Tomcat JVM 参数性能迅速调到最优!
  2. 为什么我们很难看到代码 5 分钟前的样子?
  3. java断点续传上传_java断点续传上传文件,突然关闭然后再上传文件为什么不是从之前上传的进度上传...
  4. Leetcode题解(十七)
  5. kafka原理_kafka入门(原理搭建简单使用)
  6. C或C 如何通过程序执行shell命令并获取命令执行结果?
  7. Kafka 命令行操作
  8. 分布式存储系统设计 - Gossip
  9. 安装 SQL Server 2005 时出现性能计数器要求安装错误的解决办法
  10. 20200606:最长连续序列(leetcode128)
  11. Ubuntu enca命令可以用来查看文件的编码格式
  12. H3C VLAN显示及维护
  13. 关于hibernate的缓存使用
  14. java set region_Java Tile.setRegion方法代碼示例
  15. Python做一个简单的在线编辑器
  16. css磨砂效果背景和特殊背景
  17. python实战篇(七)---一寸照换背景
  18. 利用Python实现自动投票以及自动爬虫IP代理
  19. 一次不常见的等待事件:RECO进程enq: DR - contention
  20. 国科大学习资料--多媒体分析与理解(卢汉请)-2019期末考试题

热门文章

  1. 从Chrome源码看DNS解析过程
  2. 报错TypeError: $(...).live is not a function解决方法
  3. easyui validatebox设置默认值时 去掉校验
  4. RPC框架实现思路浅析
  5. matlab中输入x. 与x的区别
  6. java处理获取到的Elasticsearch数据
  7. 对象内存布局 (15)
  8. 如何关闭子线程?征集析构函数与多线程的讨论!
  9. 关于Windows 2003 sp1不能打开CHM文件的问题
  10. 手写深浅拷贝(js)