What happens during a live SQL Server backup?How can I backup an SQL server (2000 and 2005) database?mysqldump for sql serverIs the master database backup crucial for restoring MS SQL server in the event where you have to restore from backup and build database server from scratch?SQL Server Database Backups using VSS versus native SQL ServerBest way to backup a SQL Server database nightly?SQL Server 2005 Default Backup PlanHow to backup a specific SQL Server Schema's table?Windows Server 2008 R2 backup includes volume with MSSQL dataQueries re SQL Backup, log files and Log ShippingSQL Server - sensitive data in backup after truncate table
Is it possible to have a wealthy country without a middle class?
Giant Steps - Coltrane and Slonimsky
Wooden cooking layout
Proof that 1-P(B|C)=P(~B|C). Is everything correct?
The use of かります in a sentence
Were Alexander the Great and Hephaestion lovers?
What makes Ada the language of choice for the ISS's safety-critical systems?
What ways have you found to get edits from non-LaTeX users?
Paying more mana for a Flashed creature
Meaning of 'lose their grip on the groins of their followers'
Is it expected that a reader will skip parts of what you write?
Using "subway" as name for London Underground?
Prime Sieve and brute force
How to tell your grandparent to not come to fetch you with their car?
How do I create a Sector in Stellaris?
What do abbreviations in movie scripts stand for?
A IP can traceroute to it, but can not ping
How can I get an unreasonable manager to approve time off?
Why the DOS extender and DPMI were unavailable to DOS programs on 286 standard mode of Windows 3.0
What's up with this leaf?
Pre-1972 sci-fi short story or novel: alien(?) tunnel where people try new moves and get destroyed if they're not the correct ones
How is water heavier than petrol, even though its molecular weight is less than petrol?
How to create a pyramidal panel for a door?
Is it legal for a bar bouncer to confiscate a fake ID
What happens during a live SQL Server backup?
How can I backup an SQL server (2000 and 2005) database?mysqldump for sql serverIs the master database backup crucial for restoring MS SQL server in the event where you have to restore from backup and build database server from scratch?SQL Server Database Backups using VSS versus native SQL ServerBest way to backup a SQL Server database nightly?SQL Server 2005 Default Backup PlanHow to backup a specific SQL Server Schema's table?Windows Server 2008 R2 backup includes volume with MSSQL dataQueries re SQL Backup, log files and Log ShippingSQL Server - sensitive data in backup after truncate table
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Some of my coworkers were surprised when I told them that I can back up an SQL Server database while it's still running and wondered how that's possible. I know that SQL Server is capable of backing up a database while it is still online but I'm not sure how to explain why it's possible. My question is what effect does this have on the database?
If data is modified (by an insert, update, or delete) while the backup is running, will the backup contain those changes or will it be added to the database afterwards?
I'm assuming that the log file plays an important role here but I'm not quite sure how.
edit: Just as a note, my case involves backing up the databases using SQL Server Agent and the effects of database modifications during this process.
sql-server backup
add a comment |
Some of my coworkers were surprised when I told them that I can back up an SQL Server database while it's still running and wondered how that's possible. I know that SQL Server is capable of backing up a database while it is still online but I'm not sure how to explain why it's possible. My question is what effect does this have on the database?
If data is modified (by an insert, update, or delete) while the backup is running, will the backup contain those changes or will it be added to the database afterwards?
I'm assuming that the log file plays an important role here but I'm not quite sure how.
edit: Just as a note, my case involves backing up the databases using SQL Server Agent and the effects of database modifications during this process.
sql-server backup
add a comment |
Some of my coworkers were surprised when I told them that I can back up an SQL Server database while it's still running and wondered how that's possible. I know that SQL Server is capable of backing up a database while it is still online but I'm not sure how to explain why it's possible. My question is what effect does this have on the database?
If data is modified (by an insert, update, or delete) while the backup is running, will the backup contain those changes or will it be added to the database afterwards?
I'm assuming that the log file plays an important role here but I'm not quite sure how.
edit: Just as a note, my case involves backing up the databases using SQL Server Agent and the effects of database modifications during this process.
sql-server backup
Some of my coworkers were surprised when I told them that I can back up an SQL Server database while it's still running and wondered how that's possible. I know that SQL Server is capable of backing up a database while it is still online but I'm not sure how to explain why it's possible. My question is what effect does this have on the database?
If data is modified (by an insert, update, or delete) while the backup is running, will the backup contain those changes or will it be added to the database afterwards?
I'm assuming that the log file plays an important role here but I'm not quite sure how.
edit: Just as a note, my case involves backing up the databases using SQL Server Agent and the effects of database modifications during this process.
sql-server backup
sql-server backup
edited Jan 7 '10 at 17:49
Sean Howat
asked Jan 7 '10 at 15:52
Sean HowatSean Howat
1,55441733
1,55441733
add a comment |
add a comment |
5 Answers
5
active
oldest
votes
Full backup contains both the data and log. For data, it simply copies each page of the database into the backup, as is at the moment it reads the page. It then appends into the backup media all the 'relevant' log. This includes, at the very least, all the log between the LSN at the start of the backup operation and the LSN at the end of the backup operation. In reality there is more log usually, as it has to include all active transactions at the start of backup and log needed by replication. See Debunking a couple of myths around full database backups.
When the database is restored, all the data pages are copied out into the database files, then all the log pages are copied out into the log file(s). The database is inconsistent at this moment, since it contains data page images that may be out of sync with one another. But now a normal recovery is run. Since the log contains all the log during the backup, at the end of the recovery the database is consistent.
1
Great post and the link helped provide a good example. Thanks.
– Sean Howat
Jan 7 '10 at 17:41
Very concise. Good job!
– allen1
Oct 28 '15 at 19:43
add a comment |
During backup, snapshot will be created for the database and the data will be read for backup from that snapshot. The actual live DB operations won't affect the backup operation.
add a comment |
You can't just copy it over since there can be alterations to the database mid-copy as you alluded to in the question.
It has to be done with agents that are aware of the database functionality and then take a "snapshot" via OS functions or can use a utility to dump the database in a safe state (like mysqldump, if using mysql).
Otherwise you get a backup that can be corrupted and you won't know it until you restore it. I think Joel and Jeff recently talked about it a little on a recent StackOverflow podcast.
And you're right in that the log file is important. If the journal/log file is out of sync with the actual data, restoring the files will result in corruption.
It boils down to a backup taken using a safe state of the database, either through a database-aware agent or snapshot application or application that is aware of how to properly hook the database into dropping data without interfering with updates during the data dump then backing up the resulting file.
This is a more generalized answer but I forgot to include that I was working through SQL Server Agent at first. It still provided some good details as to what might be going on during this process despite the method so it helped anyways! Thanks.
– Sean Howat
Jan 7 '10 at 17:47
add a comment |
There are so many ways to do this (generally speaking, no idea how MSSQL normally does it) like simply dumping the database to file while appending any changes to a log file which is committed after the dump is completed - to utilizing file system specific snapshot features like VSS on Windows.
Also databases that are MVCC based from the ground up (like PostGres) can make use of that set of behaviours to maintain a snapshot that the backup copies from while still allowing updates to the datafiles by transactions that start during the backup run. As you say there are several methods, the one used depends upon the core design of the data storage engine and transaction processing features.
– David Spillett
Jan 7 '10 at 22:41
add a comment |
You can take whats known as a copy-only backup. Wont affect the database while its online
What is a copy-only backup? How is it performed? Are there any caveats to consider? Any links to examples of such a beast being run? If you're going to submit an answer imagine what might be helpful to find if someone had this question in 2-3 years.
– rnxrx
Dec 19 '16 at 5:24
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f100490%2fwhat-happens-during-a-live-sql-server-backup%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
Full backup contains both the data and log. For data, it simply copies each page of the database into the backup, as is at the moment it reads the page. It then appends into the backup media all the 'relevant' log. This includes, at the very least, all the log between the LSN at the start of the backup operation and the LSN at the end of the backup operation. In reality there is more log usually, as it has to include all active transactions at the start of backup and log needed by replication. See Debunking a couple of myths around full database backups.
When the database is restored, all the data pages are copied out into the database files, then all the log pages are copied out into the log file(s). The database is inconsistent at this moment, since it contains data page images that may be out of sync with one another. But now a normal recovery is run. Since the log contains all the log during the backup, at the end of the recovery the database is consistent.
1
Great post and the link helped provide a good example. Thanks.
– Sean Howat
Jan 7 '10 at 17:41
Very concise. Good job!
– allen1
Oct 28 '15 at 19:43
add a comment |
Full backup contains both the data and log. For data, it simply copies each page of the database into the backup, as is at the moment it reads the page. It then appends into the backup media all the 'relevant' log. This includes, at the very least, all the log between the LSN at the start of the backup operation and the LSN at the end of the backup operation. In reality there is more log usually, as it has to include all active transactions at the start of backup and log needed by replication. See Debunking a couple of myths around full database backups.
When the database is restored, all the data pages are copied out into the database files, then all the log pages are copied out into the log file(s). The database is inconsistent at this moment, since it contains data page images that may be out of sync with one another. But now a normal recovery is run. Since the log contains all the log during the backup, at the end of the recovery the database is consistent.
1
Great post and the link helped provide a good example. Thanks.
– Sean Howat
Jan 7 '10 at 17:41
Very concise. Good job!
– allen1
Oct 28 '15 at 19:43
add a comment |
Full backup contains both the data and log. For data, it simply copies each page of the database into the backup, as is at the moment it reads the page. It then appends into the backup media all the 'relevant' log. This includes, at the very least, all the log between the LSN at the start of the backup operation and the LSN at the end of the backup operation. In reality there is more log usually, as it has to include all active transactions at the start of backup and log needed by replication. See Debunking a couple of myths around full database backups.
When the database is restored, all the data pages are copied out into the database files, then all the log pages are copied out into the log file(s). The database is inconsistent at this moment, since it contains data page images that may be out of sync with one another. But now a normal recovery is run. Since the log contains all the log during the backup, at the end of the recovery the database is consistent.
Full backup contains both the data and log. For data, it simply copies each page of the database into the backup, as is at the moment it reads the page. It then appends into the backup media all the 'relevant' log. This includes, at the very least, all the log between the LSN at the start of the backup operation and the LSN at the end of the backup operation. In reality there is more log usually, as it has to include all active transactions at the start of backup and log needed by replication. See Debunking a couple of myths around full database backups.
When the database is restored, all the data pages are copied out into the database files, then all the log pages are copied out into the log file(s). The database is inconsistent at this moment, since it contains data page images that may be out of sync with one another. But now a normal recovery is run. Since the log contains all the log during the backup, at the end of the recovery the database is consistent.
edited May 22 at 16:45
Lockszmith
1054
1054
answered Jan 7 '10 at 16:51
Remus RusanuRemus Rusanu
7,9381522
7,9381522
1
Great post and the link helped provide a good example. Thanks.
– Sean Howat
Jan 7 '10 at 17:41
Very concise. Good job!
– allen1
Oct 28 '15 at 19:43
add a comment |
1
Great post and the link helped provide a good example. Thanks.
– Sean Howat
Jan 7 '10 at 17:41
Very concise. Good job!
– allen1
Oct 28 '15 at 19:43
1
1
Great post and the link helped provide a good example. Thanks.
– Sean Howat
Jan 7 '10 at 17:41
Great post and the link helped provide a good example. Thanks.
– Sean Howat
Jan 7 '10 at 17:41
Very concise. Good job!
– allen1
Oct 28 '15 at 19:43
Very concise. Good job!
– allen1
Oct 28 '15 at 19:43
add a comment |
During backup, snapshot will be created for the database and the data will be read for backup from that snapshot. The actual live DB operations won't affect the backup operation.
add a comment |
During backup, snapshot will be created for the database and the data will be read for backup from that snapshot. The actual live DB operations won't affect the backup operation.
add a comment |
During backup, snapshot will be created for the database and the data will be read for backup from that snapshot. The actual live DB operations won't affect the backup operation.
During backup, snapshot will be created for the database and the data will be read for backup from that snapshot. The actual live DB operations won't affect the backup operation.
answered Mar 6 '12 at 13:28
AravindAravind
1312
1312
add a comment |
add a comment |
You can't just copy it over since there can be alterations to the database mid-copy as you alluded to in the question.
It has to be done with agents that are aware of the database functionality and then take a "snapshot" via OS functions or can use a utility to dump the database in a safe state (like mysqldump, if using mysql).
Otherwise you get a backup that can be corrupted and you won't know it until you restore it. I think Joel and Jeff recently talked about it a little on a recent StackOverflow podcast.
And you're right in that the log file is important. If the journal/log file is out of sync with the actual data, restoring the files will result in corruption.
It boils down to a backup taken using a safe state of the database, either through a database-aware agent or snapshot application or application that is aware of how to properly hook the database into dropping data without interfering with updates during the data dump then backing up the resulting file.
This is a more generalized answer but I forgot to include that I was working through SQL Server Agent at first. It still provided some good details as to what might be going on during this process despite the method so it helped anyways! Thanks.
– Sean Howat
Jan 7 '10 at 17:47
add a comment |
You can't just copy it over since there can be alterations to the database mid-copy as you alluded to in the question.
It has to be done with agents that are aware of the database functionality and then take a "snapshot" via OS functions or can use a utility to dump the database in a safe state (like mysqldump, if using mysql).
Otherwise you get a backup that can be corrupted and you won't know it until you restore it. I think Joel and Jeff recently talked about it a little on a recent StackOverflow podcast.
And you're right in that the log file is important. If the journal/log file is out of sync with the actual data, restoring the files will result in corruption.
It boils down to a backup taken using a safe state of the database, either through a database-aware agent or snapshot application or application that is aware of how to properly hook the database into dropping data without interfering with updates during the data dump then backing up the resulting file.
This is a more generalized answer but I forgot to include that I was working through SQL Server Agent at first. It still provided some good details as to what might be going on during this process despite the method so it helped anyways! Thanks.
– Sean Howat
Jan 7 '10 at 17:47
add a comment |
You can't just copy it over since there can be alterations to the database mid-copy as you alluded to in the question.
It has to be done with agents that are aware of the database functionality and then take a "snapshot" via OS functions or can use a utility to dump the database in a safe state (like mysqldump, if using mysql).
Otherwise you get a backup that can be corrupted and you won't know it until you restore it. I think Joel and Jeff recently talked about it a little on a recent StackOverflow podcast.
And you're right in that the log file is important. If the journal/log file is out of sync with the actual data, restoring the files will result in corruption.
It boils down to a backup taken using a safe state of the database, either through a database-aware agent or snapshot application or application that is aware of how to properly hook the database into dropping data without interfering with updates during the data dump then backing up the resulting file.
You can't just copy it over since there can be alterations to the database mid-copy as you alluded to in the question.
It has to be done with agents that are aware of the database functionality and then take a "snapshot" via OS functions or can use a utility to dump the database in a safe state (like mysqldump, if using mysql).
Otherwise you get a backup that can be corrupted and you won't know it until you restore it. I think Joel and Jeff recently talked about it a little on a recent StackOverflow podcast.
And you're right in that the log file is important. If the journal/log file is out of sync with the actual data, restoring the files will result in corruption.
It boils down to a backup taken using a safe state of the database, either through a database-aware agent or snapshot application or application that is aware of how to properly hook the database into dropping data without interfering with updates during the data dump then backing up the resulting file.
answered Jan 7 '10 at 16:04
Bart SilverstrimBart Silverstrim
29.5k95684
29.5k95684
This is a more generalized answer but I forgot to include that I was working through SQL Server Agent at first. It still provided some good details as to what might be going on during this process despite the method so it helped anyways! Thanks.
– Sean Howat
Jan 7 '10 at 17:47
add a comment |
This is a more generalized answer but I forgot to include that I was working through SQL Server Agent at first. It still provided some good details as to what might be going on during this process despite the method so it helped anyways! Thanks.
– Sean Howat
Jan 7 '10 at 17:47
This is a more generalized answer but I forgot to include that I was working through SQL Server Agent at first. It still provided some good details as to what might be going on during this process despite the method so it helped anyways! Thanks.
– Sean Howat
Jan 7 '10 at 17:47
This is a more generalized answer but I forgot to include that I was working through SQL Server Agent at first. It still provided some good details as to what might be going on during this process despite the method so it helped anyways! Thanks.
– Sean Howat
Jan 7 '10 at 17:47
add a comment |
There are so many ways to do this (generally speaking, no idea how MSSQL normally does it) like simply dumping the database to file while appending any changes to a log file which is committed after the dump is completed - to utilizing file system specific snapshot features like VSS on Windows.
Also databases that are MVCC based from the ground up (like PostGres) can make use of that set of behaviours to maintain a snapshot that the backup copies from while still allowing updates to the datafiles by transactions that start during the backup run. As you say there are several methods, the one used depends upon the core design of the data storage engine and transaction processing features.
– David Spillett
Jan 7 '10 at 22:41
add a comment |
There are so many ways to do this (generally speaking, no idea how MSSQL normally does it) like simply dumping the database to file while appending any changes to a log file which is committed after the dump is completed - to utilizing file system specific snapshot features like VSS on Windows.
Also databases that are MVCC based from the ground up (like PostGres) can make use of that set of behaviours to maintain a snapshot that the backup copies from while still allowing updates to the datafiles by transactions that start during the backup run. As you say there are several methods, the one used depends upon the core design of the data storage engine and transaction processing features.
– David Spillett
Jan 7 '10 at 22:41
add a comment |
There are so many ways to do this (generally speaking, no idea how MSSQL normally does it) like simply dumping the database to file while appending any changes to a log file which is committed after the dump is completed - to utilizing file system specific snapshot features like VSS on Windows.
There are so many ways to do this (generally speaking, no idea how MSSQL normally does it) like simply dumping the database to file while appending any changes to a log file which is committed after the dump is completed - to utilizing file system specific snapshot features like VSS on Windows.
edited Jan 7 '10 at 16:18
answered Jan 7 '10 at 16:13
Oskar DuvebornOskar Duveborn
10.6k32948
10.6k32948
Also databases that are MVCC based from the ground up (like PostGres) can make use of that set of behaviours to maintain a snapshot that the backup copies from while still allowing updates to the datafiles by transactions that start during the backup run. As you say there are several methods, the one used depends upon the core design of the data storage engine and transaction processing features.
– David Spillett
Jan 7 '10 at 22:41
add a comment |
Also databases that are MVCC based from the ground up (like PostGres) can make use of that set of behaviours to maintain a snapshot that the backup copies from while still allowing updates to the datafiles by transactions that start during the backup run. As you say there are several methods, the one used depends upon the core design of the data storage engine and transaction processing features.
– David Spillett
Jan 7 '10 at 22:41
Also databases that are MVCC based from the ground up (like PostGres) can make use of that set of behaviours to maintain a snapshot that the backup copies from while still allowing updates to the datafiles by transactions that start during the backup run. As you say there are several methods, the one used depends upon the core design of the data storage engine and transaction processing features.
– David Spillett
Jan 7 '10 at 22:41
Also databases that are MVCC based from the ground up (like PostGres) can make use of that set of behaviours to maintain a snapshot that the backup copies from while still allowing updates to the datafiles by transactions that start during the backup run. As you say there are several methods, the one used depends upon the core design of the data storage engine and transaction processing features.
– David Spillett
Jan 7 '10 at 22:41
add a comment |
You can take whats known as a copy-only backup. Wont affect the database while its online
What is a copy-only backup? How is it performed? Are there any caveats to consider? Any links to examples of such a beast being run? If you're going to submit an answer imagine what might be helpful to find if someone had this question in 2-3 years.
– rnxrx
Dec 19 '16 at 5:24
add a comment |
You can take whats known as a copy-only backup. Wont affect the database while its online
What is a copy-only backup? How is it performed? Are there any caveats to consider? Any links to examples of such a beast being run? If you're going to submit an answer imagine what might be helpful to find if someone had this question in 2-3 years.
– rnxrx
Dec 19 '16 at 5:24
add a comment |
You can take whats known as a copy-only backup. Wont affect the database while its online
You can take whats known as a copy-only backup. Wont affect the database while its online
answered Dec 17 '16 at 0:59
darotweilerdarotweiler
1
1
What is a copy-only backup? How is it performed? Are there any caveats to consider? Any links to examples of such a beast being run? If you're going to submit an answer imagine what might be helpful to find if someone had this question in 2-3 years.
– rnxrx
Dec 19 '16 at 5:24
add a comment |
What is a copy-only backup? How is it performed? Are there any caveats to consider? Any links to examples of such a beast being run? If you're going to submit an answer imagine what might be helpful to find if someone had this question in 2-3 years.
– rnxrx
Dec 19 '16 at 5:24
What is a copy-only backup? How is it performed? Are there any caveats to consider? Any links to examples of such a beast being run? If you're going to submit an answer imagine what might be helpful to find if someone had this question in 2-3 years.
– rnxrx
Dec 19 '16 at 5:24
What is a copy-only backup? How is it performed? Are there any caveats to consider? Any links to examples of such a beast being run? If you're going to submit an answer imagine what might be helpful to find if someone had this question in 2-3 years.
– rnxrx
Dec 19 '16 at 5:24
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f100490%2fwhat-happens-during-a-live-sql-server-backup%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown