Performing an online piecemeal restore

In this recipe, we will perform an online piecemeal restore.

Getting ready

We will back up a test database called StudentDB database, which has three filegroups: one primary filegroup and two custom filegroups, FG1 and FG2, in this recipe. FG1 and FG2 will have one secondary data file stored in the C:\DATA folder.

You can use the following script to create your files B04525 - Ch05 - 11 - Performing an Online PieceMeal Restore - Prep.ps1 (this is available in the code bundle available with the book), which is included in the downloadable files for this book. After the script is executed, you should see the following database:

This is how the tables will be structured:

Table

Filegroup

Data file name

Data file ...

Get SQL Server 2014 with PowerShell v5 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.