Basics – Recovering Microsoft SQL Server Databases as Flat Files

You don’t always want to be able to recover a database backup as a live database – either overwriting an existing database or going to another database. Sometimes, you might want to ship the recovered database somewhere else, and sometimes, you’ll find the database administrators wanting to do other work on the recovered database files before bringing them in as a database into a SQL server environment. To facilitate that, you can recover the database files as plain flat files, rather than recovering them into or over a database.

To test this out, I setup a Windows 2016 server, and installed SQL Server 2016 as well. I then created a test database, installed the NetWorker client, and the NetWorker Module for Microsoft with SQL components. Then it was just a case of running the backup.

With the backup done, I launched SQL Server Management Studio, and clicked NetWorker Backup plugin within the GUI. When the plugin launch, I selected to do a database recovery:

01 SSMS Select Database and Redirect to Flat File
01 SSMS Select Database and Redirect to Flat File

In the above screen capture, the options I had to select to progress down the path of recovering flat files were:

  • The NetWorker server
  • The SQL Server host (the machine I was running the recovery from)
  • The SQL Server instance
  • The database

I also clicked the radio button for “Restore backups as files”, and clicked the “…” button so I could change the recovery path. From there, I was presented with a dialog where I could browse to a directory to choose as the recovery destination, or create a new one.

02 SSMS Create new Directory for Recovery
02 SSMS Create new Directory for Recovery

There I created a C:\Temp directory, as shown above, and clicked OK to be presented with an updated view:

03 SSMS Ready to Run Recovery

The next step was to run the recovery, which gave me the following output:

04 SSMS Recovery Complete
04 SSMS Recovery Complete

With the recovery complete, it’s just a case of browsing to the directory and making sure the database had been recovered as flat file:

05 SSMS Recovery in Explorer
05 SSMS Recovery in Explorer

You don’t have to use SSMS to perform a flat file recovery, though. Here’s an example of it being run from the command line on the SQL server, as well:

06 Recovery from Command Line
06 Recovery from Command Line

And there you have it – recovering a Microsoft SQL Server database to a flat file, rather than immediately back into a database.

3 thoughts on “Basics – Recovering Microsoft SQL Server Databases as Flat Files”

    1. I don’t believe there’s an option for this with DB2 as there is for MSSQL. I can see reference in the NetWorker Module for Databases and Applications (NMDA) administration guide for prefetching log files to the local filesystem prior to running a DB2 recovery, but I can’t see other options relating to file-based recovery.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.