备份期间计划的 SQL Server 作业会发生什么情况?

发布于 2024-12-17 17:58:56 字数 362 浏览 1 评论 0原文

假设问题:

如果维护计划计划在多个数据库在线时运行完整备份,并且在此期间计划运行其他作业(存储过程、SSIS 包等),那么这些作业在备份期间会发生什么情况?

我猜测:

  • 作业暂停,直到备份完成,然后它们按照预定的顺序运行。

或者

  • SQL Server 计算出哪些表将受到每个计划作业的影响,并在作业完成后备份它们?!

或者,

  • SQL Server 在备份开始之前创建所有表的“快照”,对它们的任何更改(包括备份期间运行的作业所做的更改)都会添加到事务日志中,应单独备份事务日志。

……我的想法正确吗?!

Hypothetical question:

If a maintenance plan is scheduled to run a full backup of several databases while they're online, and during this time other jobs are scheduled to run (stored procedures, SSIS packages etc), what happens to these jobs during the backup?

I'm guessing either:

  • The job is paused until the backup is completed, then they're run in the same order they were scheduled to.

Or

  • SQL Server works out what tables will be affected by each scheduled job and backs them up after the job completes?!

Or

  • SQL Server creates a "snapshot" of all the tables before the back up starts, any changes to them (including changes made by the jobs run during the backup) are added to the transaction log, which should be backed up separately.

...are any of my ideas correct?!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我纯我任性 2024-12-24 17:58:56

想法#3 最接近实际发生的情况。关键是当备份操作完成时,备份文件将处于允许数据库恢复到一致状态的状态。

来自文档

执行备份操作对以下事务的影响极小
正在运行;因此,备份操作可以在定期运行
运营。在备份操作期间,SQL Server 复制数据
直接从数据库文件到备份设备。数据是
未更改,并且备份期间运行的事务
从来没有拖延过。因此,您可以使用以下命令执行 SQL Server 备份
对生产工作负载的影响最小。

...

SQL Server 使用在线备份过程来允许数据库
在数据库仍在使用时进行备份。在备份过程中,大多数
可以进行操作;例如,插入、更新或删除
备份操作期间允许使用语句。

Idea #3 is the closest to what happens. The key is that when the backup operation completes, the backup file will be in a state that allows for the restore of the database to a consistent state.

From the documentation:

Performing a backup operation has minimal effect on transactions that
are running; therefore, backup operations can be run during regular
operations. During a backup operation, SQL Server copies the data
directly from the database files to the backup devices. The data is
not changed, and transactions that are running during the backup are
never delayed. Therefore, you can perform a SQL Server backup with
minimal effect on production workloads.

...

SQL Server uses an online backup process to allow for a database
backup while the database is still being used. During a backup, most
operations are possible; for example, INSERT, UPDATE, or DELETE
statements are allowed during a backup operation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文