SQL Server–Creating a new database from a .bak file

Backing up a database and restoring a database from a backup copy is something we do on a regular basis without much attention.  However, today I was trying to create a new database from the one that I already had for testing purposes.  So I backed-up the original database lets call it ‘xyz.mdf’, created a new fresh database ‘abc.mdf’ and preceded to restore it from xyz.bak file.  SQL Server Management Studio throws a nasty error (‘good luck reading those error’) and now I am stuck.  So, after much research and a bottle of Mountain Dew I finally succeeded in my mission to beat that error.  Here are the precise steps that I took:

  1. Create a new database (abc.mdf)
  2. Right click abc.mdf and select Task > Restore > Database.
  3. Under (Specify the source and location of backup sets to restore) select ‘From device’ and from the pop-up window click ‘Add’ then locate and select the xyz.bak file – click OK.
  4. Select the checkbox for the database source, then click ‘Options’ from the left Menu.
  5. Check (Overwrite the existing database), then under (Restore the database files as) click the right Ellipses buttons and select ‘abc.mdf’ for the database and abc.ldf for the log file.  Now click OK and wait for the sweet sound of success.

Good Luck Smile



Leave a comment