--piecemeal Restore: Database corruption is relatively large, we have to restore the entire database across multiple data files or even across filegroups.
--If the database is particularly large, the database recovery time will be very long. However, we can use the piecemeal restore provided by SQL Server to gradually recover the database. --back up the tail log first:BACKUP LOG [AdventureWorks] to DISK =N'D:\BACKUP_TEST\LOG_BACK_TAIL.trn' withNo_truncate, Norecovery,compression,stats=Ten--Partial Restore PRIMARY filegroup primary:RESTORE DATABASE [AdventureWorks]FILEGROUP=N'PRIMARY' from DISK=N'D:\BACKUP_TEST\AD_FULL.bak' withPartial,norecovery,stats=Ten--To restore a sub-filegroup MST:RESTORE DATABASE [AdventureWorks]FILEGROUP=N'MST' from DISK=N'D:\BACKUP_TEST\AD_FULL.bak' withNorecovery,stats=Ten--Restore the log in turn:RESTORE LOG [AdventureWorks] from DISK=N'D:\BACKUP_TEST\LOG_BACK_1.TRN' withNorecovery,stats=TenRESTORE LOG [AdventureWorks] from DISK=N'D:\BACKUP_TEST\LOG_BACK_2.TRN' withNorecovery,stats=Ten--restore tail logs and restoreRESTORE LOG [AdventureWorks] from DISK=N'D:\BACKUP_TEST\LOG_BACK_TAIL. TRN' withRecovery,stats=Ten--files located in the primary and MST filegroups in the AdventureWorks database are now accessible. --However, tables that are located in other filegroups, such as the TRN filegroup, are not yet accessible. --msg 8653, Level 16, State 1, line 2nd--The query processor cannot generate a schedule for a table or view "* * *" because the table resides in a filegroup that is not online.
--Next, restore the sub-filegroup trn:RESTORE DATABASE [AdventureWorks]FILEGROUP=N'TRN' from DISK=N'D:\BACKUP_TEST\AD_FULL.bak' withNorecovery,stats=10
--If the database is not an Enterprise edition, the above restore will prompt " the Database" AdventureWorks "has not been backed up for the tail of the log. "
--You need to back up the tail of the log again, meaning that the entire database is in the restoring state when you restore the TRN file group. So for non-enterprise editions, only offline piecemeal restore, the personal feel that the meaning is not very big ...--Restore the log in turn:RESTORE LOG [AdventureWorks] from DISK=N'D:\BACKUP_TEST\LOG_BACK_1.TRN' withNorecovery,stats=TenRESTORE LOG [AdventureWorks] from DISK=N'D:\BACKUP_TEST\LOG_BACK_2.TRN' withNorecovery,stats=Ten--restore tail logs and restoreRESTORE LOG [AdventureWorks] from DISK=N'D:\BACKUP_TEST\LOG_BACK_TAIL. TRN' withRecovery,stats=Ten--the table in the sub-filegroup trn is now accessible. --piecemeal restore all complete