SQL – How to restore a password protected database back up

If you have backed-up a database with password protection such as:

BACKUP DATABASE [DATABASE] TO  DISK = N‘\\NETWORK_STARAGE_LOCATION\database.BAK’ WITH PASSWORD = ‘PASSWORD’,
NOFORMAT, NOINIT,  NAME = N‘DATABASE-Full Database Backup’, SKIP, NOREWIND, NOUNLOAD, STATS=10
GO

As outlined in a previous post https://robbamforth.wordpress.com/2008/11/07/sql-server-2005-database-backup/

Then you will be required to restore the database programmatically as both Enterprise Manger and SQL Server Management Studio do not support the password option when restoring with the GUI wizard.

To view the files available in the backup:

RESTORE FILELISTONLY FROM DISK='\\NETWORK_STARAGE_LOCATION\database.BAK
WITH PASSWORD = 'password'

To run a full simple backup:

RESTORE DATABASE Northwind FROM DISK='\\NETWORK_STARAGE_LOCATION\database.BAK’
WITH PASSWORD = 'password'

 

This post shows how to restore a backup to a different location to where it was taken: https://robbamforth.wordpress.com/2009/11/18/sql-%e2%80%93-how-to-restore-a-database-backup-to-a-different-location/

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s