 To restore files and filegroups
To restore files and filegroups
Important The system administrator restoring the files and filegroups must be the only person currently using the database to be restored.
The transaction log backups, if applied, must cover the time when the files and filegroups were backed up.
This example restores the files and filegroups for the MyNwind database. Two transaction logs will also be applied, to restore the database to the current time.
USE master
GO
-- Restore the files and filesgroups for MyNwind.
RESTORE DATABASE MyNwind
    FILE = 'MyNwind_data_1',
    FILEGROUP = 'new_customers',
    FILE = 'MyNwind_data_2',
    FILEGROUP = 'first_qtr_sales'
    FROM MyNwind_1
    WITH NORECOVERY
GO
-- Apply the first transaction log backup.
RESTORE LOG MyNwind
    FROM MyNwind_log1
    WITH NORECOVERY
GO
-- Apply the last transaction log backup.
RESTORE LOG MyNwind
    FROM MyNwind_log2
    WITH RECOVERY
GO
| RESTORE | Restoring File or Filegroup Backups |