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.

Chapter 5: Log <strong>Backup</strong>s<br />

important consideration <strong>and</strong>, as was demonstrated for full backups in Chapter 3, use of<br />

backup compression can be beneficial. In Chapter 8, we'll compare the backup speeds<br />

<strong>and</strong> compression ratios obtained for native log backups, versus log backups with native<br />

compression, versus log backups with <strong>SQL</strong> <strong>Backup</strong> compression.<br />

Right now, though, we'll just look at the log backup size. Browse to the C:\<strong>SQL</strong><strong>Backup</strong>s\<br />

Chapter5\ folder, or wherever it is that you stored the log backup file <strong>and</strong> simply note the<br />

size of the file. In my case, it was 85 KB.<br />

T-<strong>SQL</strong> log backups<br />

Now that we have taken a log backup using the GUI method, we'll insert some new rows<br />

into our DatabaseForLog<strong>Backup</strong>s table <strong>and</strong> then take a second log backup, this time<br />

using a T-<strong>SQL</strong> script. Rerun DBCC <strong>SQL</strong>PERF(LOGSPACE)before we start. Since we've only<br />

added a small amount of data, <strong>and</strong> have performed a log backup, the live log file is still 50<br />

MB in size, <strong>and</strong> less than 1% full.<br />

Listing 5-6 shows the script to insert our new data; this time we're inserting considerably<br />

more rows into each of the three tables (1,000 into the first table, 10,000 into the second<br />

<strong>and</strong> 100,000 into the third) <strong>and</strong> so our subsequent transaction log backup should also be<br />

much larger, as a result.<br />

Notice that we print the date <strong>and</strong> time after inserting the rows into MessageTable2,<br />

<strong>and</strong> then use the WAITFOR DELAY comm<strong>and</strong> before proceeding with the final INSERT<br />

comm<strong>and</strong>; both are to help us when we come to perform some point-in-time restores, in<br />

Chapter 6.<br />

166

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

Saved successfully!

Ooh no, something went wrong!