Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does backup work in SQL server?

Let's say I have a very large database. Its backup starts at midnight and finishes at 02:00 am.

When I recover that backup am I gonna have the state of the database at midnight or 02:00 (or something else)?

Going one step further, let's say that I have multiple databases which contain references to each other's elements. If I backup all databases in parallel starting at the same time, when I recover all of them am I going to have the state of all databases at the same point in time?

like image 990
Joao Silva Avatar asked Jun 30 '09 15:06

Joao Silva


People also ask

What are the main 3 types of backups in SQL?

A backup of data in a complete database (a database backup), a partial database (a partial backup), or a set of data files or filegroups (a file backup).

How full backup works in SQL Server?

A full database backup backs up the whole database. This includes part of the transaction log so that the full database can be recovered after a full database backup is restored. Full database backups represent the database at the time the backup finished.

Does backing up a SQL database take it offline?

You don't need to take a database offline to back it up. The backup process will create a . BAK file, which you can use in a restore operation. If you're using SQL Server Management Studio (SSMS), right-click the database, select "Tasks", then "Back up".


1 Answers

The backup process in SQL Server backs up the data files and portions of the transaction log, so it'll be the state of the database at 2am.

You can only guarantee consistency of committed transactions across databases if the backup stops at exactly the same time. This is probably not something you want to rely on, so I'd recommend using frequent transaction log backups in addition to whatever nightly full strategy you're using.

like image 169
Jeremy Smyth Avatar answered Sep 23 '22 17:09

Jeremy Smyth