Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Backup all Filegroups

By Richard Doering,

Introduction :

A simple script to backup all filegroups within a database.

This will help in environments where filegroups and partioning are used to let a database span volumes for archive or performance reasons.

It will only work against databases using the FULL recovery mode.

Usage :

1) Change the @destinationpath parameter at line 12 to reflect your environment.

2) Execute the script against the database you want to backup.

Output :

The script displays and executes the appropriate backup commands to generate separate backup files for each filegroup.

Note :

I've commented out line 23, where (in my environment) I have my non-clustered indexes stored in a filegroup called NCIndexes,

In non live environments I script these rather than back them up to save space.


Let me know what you think,



Richard Doering

Total article views: 1183 | Views in the last 30 days: 1
Related Articles

Backup FileGroup and Restore on Secondary Database

Backup FileGroup and Restore on Secondary Database with same filegroups


Restoring database - Filegroups

Restoring database - Filegroups


Filegroup Restore

Database Restoring using Filegroup Backup


Transactional backup in filegroup

Transactional backup in filegroup



backup filegroup

backup / restore    

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones