什么是SQL Server日志传送? (What is SQL Server log shipping?)

SQL Server日志传送是一种涉及两个或多个SQL Server实例,并将事务日志文件从一个SQL Server实例复制到另一个实例的技术。 跨SQL Server自动化传输事务日志文件和还原的过程。 作为处理结果,在两个不同的位置有两个数据副本

A log shipping session involves the following steps:

日志传送会话包括以下步骤:

  • primary SQL Server instance SQL Server实例上备份事务日志文件
  • secondary SQL Server instances辅助 SQL Server实例
  • secondary SQL Server instances辅助 SQL Server实例上还原事务日志备份文件

实施实例 (Implementation examples)

One of the common log shipping scenarios is the environment with two servers (SQLServer-1 – primary and SQLServer-2 – secondary), two SQL Server instances (SQLInstance-1 and SQLInstance-2), and one SQL Server database named SQLDB-1 with log shipping running on it

常见的日志传送方案之一是具有两个服务器(SQLServer-1 – 服务器和SQLServer-2 – 辅助服务器),两个SQL Server实例(SQLInstance-1和SQLInstance-2)以及一个名为SQLDB-1SQL Server数据库的环境。在上面运行日志传送

Another common configuration is the environment with three (or more) servers (SQLServer-1 – primary, SQLServer-2 – secondary, and SQLServer-3 – secondary), three SQL Server instances (SQLInstance-1, SQLInstance-2, and SQLInstance-3), and one SQL Server database named SQLDB-1 with log shipping running on it

另一个常见的配置是具有三个(或更多)服务器(SQLServer-1 – 服务器,SQLServer-2 – 辅助服务器和SQLServer-3 – 辅助服务器),三个SQL Server实例(SQLInstance-1,SQLInstance-2和SQLInstance- 3),以及一个名为SQLDB-1SQL Server数据库,并在其上运行日志传送

操作模式 (Operating modes)

There are two available modes and they are related to the state in which the secondary, log shipped, SQL Server database will be:

有两种可用的模式,它们与SQL Server辅助日志发送数据库的状态有关:

    • Users can be forced to disconnect when the restore job commence还原作业开始时,用户可能被迫断开连接
    • The restore job can be delayed until all users disconnect themselves还原作业可以延迟,直到所有用户断开连接
  • Restore mode – the database is not accessible 还原模式–无法访问数据库

使用SQL Server日志传送的优缺点 (Advantages and disadvantages of using SQL Server log shipping)

SQL Server log shipping is primarily used as a disaster recovery solution. Using SQL Server log shipping has multiple benefits: it’s reliable and tested in details, it’s relatively easy to set up and maintain, there is a possibility for failover between SQL Servers, data can be copied on more than one location etc.

SQL Server日志传送主要用作灾难恢复解决方案。 使用SQL Server日志传送有多个好处:它可靠且经过详细测试,相对容易设置和维护,在SQL Server之间可能进行故障转移,可以将数据复制到多个位置等。

Log shipping can be combined with other disaster recovery options such as AlwaysOn Availability Groups, database mirroring, and database replication. Also, SQL Server log shipping has low cost in human and server resources

日志传送可以与其他灾难恢复选项(例如AlwaysOn可用性组,数据库镜像和数据库复制)结合使用。 另外,SQL Server日志传送在人力和服务器资源上的成本较低

The main disadvantages in the SQL Server log shipping technique are: need to manage all the databases separately, there isn’t possibility for an automatic failover, and secondary database isn’t fully readable while the restore process is running

SQL Server日志传送技术的主要缺点是:需要单独管理所有数据库,不可能进行自动故障转移,并且在还原过程运行时辅助数据库无法完全读取

设置数据库日志传送环境 (Setting up the database log shipping environment )

SQL Server log shipping is based on execution of predefined SQL Server jobs. The SQL Server log shipping feature is available in all SQL Server editions except the Express edition. All the databases intended to be used for log shipping must be in the Full or Bulk logged recovery model

SQL Server日志传送基于预定义SQL Server作业的执行。 除Express版本外,所有SQL Server版本均提供SQL Server日志传送功能。 所有打算用于日志传送的数据库必须处于完整或批量日志记录恢复模型中

Another important prerequisite is running SQL Server Agent on both servers. Security policies must be defined in order for SQL Server Agent to have permission to read and write in the backup folder. Note that SQL Server agent on the secondary server must be able to read from the primary server’s backup folder

另一个重要的前提条件是在两台服务器上都运行SQL Server代理。 必须定义安全策略,SQL Server代理才能在备份文件夹中进行读写操作。 请注意,辅助服务器上SQL Server代理必须能够从主服务器的备份文件夹中读取

The database backups can be compressed, but that requires additional CPU time. Most common configurations use network locations for storing the backups

可以压缩数据库备份,但是这需要额外的CPU时间。 最常见的配置使用网络位置来存储备份

The database log shipping setup needs to be initiated from the principal server using the SQL Server Management Studio wizard. The first step defines transaction log backup settings:

需要使用SQL Server Management Studio向导从主体服务器启动数据库日志传送设置。 第一步定义事务日志备份设置:

  • A network path to the backup 备份的网络路径
  • How long backup files should be kept before deleting删除前备份文件应保留多长时间
  • An alert if no backup is taken没有备份时发出警报
    • Schedule type时间表类型
    • Frequency频率
    • Duration持续时间

The next step defines secondary databases which involve choosing the secondary SQL Server instance and secondary database. The full database backup, from the primary database, must be restored on the secondary server before log shipping commences

下一步定义辅助数据库,其中涉及选择辅助SQL Server实例和辅助数据库。 在开始日志传送之前,必须在辅助服务器上还原来自主数据库的完整数据库备份。

After initializing the secondary database you must define the copy folder where the transaction log backups from the primary server will be stored

初始化辅助数据库后,必须定义副本文件夹,该文件夹将存储来自主服务器的事务日志备份

The final step involves choosing from two available modes: The No recovery – Restore mode and Standby mode. You can also delay the restoring process and set up an alert if no restore occurs within the specified time

最后一步涉及从两个可用模式中进行选择:无恢复-还原模式和待机模式。 如果在指定时间内没有还原,您还可以延迟还原过程并设置警报。

Once the log shipping is ready for use, it will run in the background, and if the problem occurs the alert will signalize the problem

一旦准备好使用日志传送,它将在后台运行,并且如果发生问题,警报将发出问题信号。

翻译自: https://www.sqlshack.com/sql-server-log-shipping/

什么是SQL Server日志传送?相关推荐

  1. 使用SQL Server日志传送将SQL数据库移动到其他服务器

    As a SQL Server DBA, we are responsible for moving the customer SQL databases to other servers. Rece ...

  2. 如何创建SQL Server日志传送

    In my last article, I show how to create Database Mirroring for high availability. This time, I will ...

  3. SQL Server 日志传送[转载]

    http://jimshu.blog.51cto.com/3171847/590413 SQL Server 2012 日志传送 一.准备: 数据库为完全恢复模式,并事先做一次完全备份. 共享一个文件 ...

  4. SQL Server 日志传送

    SQL Server 2012 日志传送 一.准备: 数据库为完全恢复模式,并事先做一次完全备份. 共享一个文件夹,主机备份放在这个文件夹,而且客户机有权访问这个共享文件夹. 二.基本配置 1.启动配 ...

  5. 清理SQL Server日志释放文件空间的终极方法

    清理SQL Server日志释放文件空间的终极方法 转自:http://www.cnblogs.com/dudu/archive/2013/04/10/3011416.html [问题场景]有一个数据 ...

  6. SQL Server 日志数据库清理办法

    更新一个SQL Server 日志数据库清理脚本,以备日后用到. USE [master] GO ALTER DATABASE [数据库名称] SET RECOVERY SIMPLE WITH NO_ ...

  7. Sql server日志

    Sql server日常运维需要通过Sql server日志获得数据库报错信息. 那怎么去找日志 1.登录Sql server management studio 2.视图 3.对象资源管理器 4.管 ...

  8. sql server日志占用空间过大的问题

    一.关于日志的基本知识:     在 SQL Server 2000 和 SQL Server 2005 中,每个数据库都至少包含一个数据文件和一个事务日志文件.SQL Server 在该数据文件中以 ...

  9. [转]快速清除SQL Server日志的两种方法

    日志文件满而造成SQL数据库无法写入文件时,可用两种方法: 第一种方法:清空日志. 1.打开查询分析器,输入命令 以下是引用片段: DUMP TRANSACTION 数据库名 WITH NO_LOG ...

最新文章

  1. 手绘风格的数据可视化 Sketchify,让你的图表也萌萌哒
  2. 学习了解online hard example mining在线难例挖掘
  3. java 数组 存储_Java-将数组存储到内存或从内存上传到磁盘
  4. tensorflow 的 Session Exception
  5. React 深度学习:ReactFiberRoot
  6. 微信扫一扫门禁开门小程序开发制作
  7. python 东方财富接口_东方财富 股票数据接口_
  8. EXCEL中怎么把单元格中的数值提取出来?Excel提取单元格数字或某格式的字符串,支持正则式提取的绿色工具
  9. 微众银行AI团队领衔推动人工智能国际标准的制定
  10. Kafka SSL 和 ACL 配置
  11. ubuntu 16.04 桌面修复
  12. 英语单词积累8.10
  13. 小程序自制自带滑动条的表格组件
  14. Locating Elements
  15. 请编写一个函数,接收两颗星星赤经和赤纬的角度作为参数,计算并返回这两颗星星所对弧的角度。
  16. ExcelVBA 之可选参数
  17. 每周推荐短视频:为什么理论正确但得不到预期结果?
  18. Hadoop 深入浅出 ---- 入门 (1)
  19. java毕业设计-酒店管理系统 酒店预定系统
  20. 识别表格变成电子版的软件有什么?这些识别软件分享给你

热门文章

  1. 关于.vbs文件恶搞,小伙伴电脑的
  2. 软件设计开发思想总结
  3. NSUserDefaults 、对象归档
  4. 结构模式--之--享元模式
  5. Android 源代码下载
  6. 传统认知PK网络认知 刚子扯谈烤串认知
  7. LeetCode(985)——查询后的偶数和(JavaScript)
  8. springMVC 格式转换
  9. lte和4g有什么区别
  10. 小学在班里排第几名家长才比较放心?