Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By : Donabel Santos
Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By: Donabel Santos

Overview of this book

Table of Contents (21 chapters)
SQL Server 2014 with PowerShell v5 Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

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 location

Student_PRIMARY

PRIMARY

StudentDB.mdf

Default data directory

Student_FG1

FG1

Student_FG1_data

C:\DATA

Student_FG2

FG2

Student_FG1_data

C:\DATA

Student_TXN

PRIMARY

StudentDB.mdf

Default data directory...