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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 9: File <strong>and</strong> Filegroup <strong>Backup</strong> <strong>and</strong> <strong>Restore</strong><br />

keeps the database in a restoring state. The first half of the message output from running<br />

this comm<strong>and</strong>, shown in Figure 9-6, tells us that the roll forward start point is at a specific<br />

LSN number but that an additional roll forward is required <strong>and</strong> so more files will have to<br />

be restored to bring the database back online.<br />

The second part of the message simply reports that the restore of the backup for the<br />

secondary data file was successful.<br />

Since we specified that the database should be left in a restoring state after the second<br />

restore comm<strong>and</strong>, <strong>SQL</strong> <strong>Server</strong> doesn't try to recover the database to a usable state (<strong>and</strong> is<br />

unable to do so). If you check your Object Explorer in SSMS, you'll see that Database-<br />

ForFile<strong>Backup</strong>s is still in a restoring state.<br />

After the full file backups, we took a transaction log backup (_TLOG), but since we're<br />

rolling forward past the subsequent differential file backups, where any data changes<br />

will be captured for each filegroup, we don't need to restore the first transaction log, on<br />

this occasion. So, let's go ahead <strong>and</strong> restore the two differential file backups, as shown in<br />

Listing 9-20.<br />

USE master<br />

GO<br />

RESTORE DATABASE [DatabaseForFile<strong>Backup</strong>s] FILE = N'DatabaseForFile<strong>Backup</strong>s'<br />

FROM DISK = N'C:\<strong>SQL</strong><strong>Backup</strong>s\Chapter9\DatabaseForFile<strong>Backup</strong>s_FG1_Diff.bak'<br />

WITH NORECOVERY<br />

GO<br />

RESTORE DATABASE [DatabaseForFile<strong>Backup</strong>s] FILE = N'DatabaseForFile<strong>Backup</strong>s_Data2'<br />

FROM DISK = N'C:\<strong>SQL</strong><strong>Backup</strong>s\Chapter9\DatabaseForFile<strong>Backup</strong>s_FG2_Diff.bak'<br />

WITH NORECOVERY<br />

GO<br />

Listing 9-20: <strong>Restore</strong> the differential file backups.<br />

324

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

Saved successfully!

Ooh no, something went wrong!