Restore PRIMARY Filegroup only on a database using full backup

-> I had to restore a database of size 26 TB in my Development server. This database had 2 filegroups namely PRIMARY and BLOB. Primary Filegroup has tables of size 3 TB and BLOB filegroup has tables of size 23 TB.

-> My requirement for this restore was to just restore PRIMARY filegroup and not BLOB filegroup.

-> Below TSQL can be used to restore PRIMARY Filegroup only from the full database backup.


USE [master]
RESTORE DATABASE [JB_DB] FILEGROUP='PRIMARY'
FROM  DISK = N'C:\DB\JB_DB_01of06.bak',
DISK = N'C:\DB\JB_DB_02of06.bak',
DISK = N'C:\DB\JB_DB_03of06.bak',
DISK = N'C:\DB\JB_DB_04of06.bak',
DISK = N'C:\DB\JB_DB_05of06.bak',
DISK = N'C:\DB\JB_DB_06of06.bak'
WITH PARTIAL, RECOVERY, FILE = 1, NOUNLOAD, STATS = 1, REPLACE
GO

Thank You,
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s