30.06.2013 Views

SQL Server Backup and Restore - Simple Talk

SQL Server Backup and Restore - Simple Talk

SQL Server Backup and Restore - Simple Talk

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Base backup<br />

Chapter 7: Differential <strong>Backup</strong> <strong>and</strong> <strong>Restore</strong><br />

As discussed earlier, just as we can't take log backups without first taking a full backup<br />

of a database, so we also can't take a differential backup without taking a full base<br />

backup. Any differential backup is useless without a base. Listing 7-2 performs the<br />

base full backup for our DatabaseForDiff<strong>Backup</strong>s database <strong>and</strong> stores it in the<br />

C:\<strong>SQL</strong><strong>Backup</strong>s\Chapter7 folder. Again, feel free to modify this path as appropriate f<br />

or your system.<br />

USE [master]<br />

GO<br />

BACKUP DATABASE [DatabaseForDiff<strong>Backup</strong>s]<br />

TO DISK = N'C:\<strong>SQL</strong><strong>Backup</strong>s\Chapter7\DatabaseForDiff<strong>Backup</strong>s_Full_Native.bak'<br />

WITH NAME = N'DatabaseForDiff<strong>Backup</strong>s-Full Database <strong>Backup</strong>', STATS = 10<br />

GO<br />

Listing 7-2: Base full backup for DatabaseForDiff<strong>Backup</strong>s.<br />

We are not going to worry about the execution time for this full backup, so once the<br />

backup has completed successfully, you can close this script without worrying about the<br />

output. However, we will take a look at the backup size though, which should come out<br />

to just over 20 MB. We can take a look at how our differential backup file sizes compare,<br />

as we pump more data into the database.<br />

Taking Differential <strong>Backup</strong>s<br />

As per our usual scheme, we're going to demonstrate how to take differential backups the<br />

"GUI way," in SSMS, <strong>and</strong> by using native T-<strong>SQL</strong> <strong>Backup</strong> comm<strong>and</strong>s. In Chapter 8, you'll<br />

see how to perform differential backups, as part of a complete <strong>and</strong> scheduled backup<br />

routine using the Red Gate <strong>SQL</strong> <strong>Backup</strong> tool.<br />

218

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!