Although it??™s possible to have file backups in Simple Recovery mode, I won??™t be
exploring that scenario. I??™m only going to cover Full Recovery and Bulk-Logged Recovery
modes.
With SQL Server 2005 Enterprise Edition, you can do file restores online. All other
editions require the database to be offline to perform the restore.
As it should always be in a restore situation, the first step is to back up the tail of the
transaction log. The command is simply a BACKUP LOG statement:
BACKUP LOG AWSample
TO DISK='E:\BackupData\AWSample_TailLog.bak'
WITH NORECOVERY, NO TRUNCATE
From there, the restore process is similar to any other database restore. Be sure to
specify NORECOVERY throughout the restore until you??™re sure you??™re finished. The following
code walks through restoring a single data file:
RESTORE DATABASE AWSample
FILE='D:\DATA\AWSData2.ndf'
FROM DISK='E:\DATA\AWSData2.bak'
WITH NORECOVERY
-- Continue to restore any application transaction logs
-- Apply the tail-log backup
RESTORE LOG AWSample
FROM DISK 'E:\BackupData\AWSample_TailLog.bak'
WITH NORECOVERY
-- I prefer to do recovery as a separate step
RESTORE DATABASE AWSample
WITH RECOVERY
As I mentioned in Chapter 3, I prefer to recover the database as a separate step.
Pages:
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195