What happens to SQL Server jobs that are scheduled during a backup?

白昼怎懂夜的黑 提交于 2019-12-24 14:55:28

问题


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?!


回答1:


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.



来源:https://stackoverflow.com/questions/8258435/what-happens-to-sql-server-jobs-that-are-scheduled-during-a-backup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!