Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restoring from backup to empty database

Status
Not open for further replies.

SteveDingle

Programmer
Jul 26, 2004
254
GB
Hello All,

SQL 2K (I'm a novice) - Someone has sent me a backup of database that I now want to "restore" into an empty copy of the database and I'm not sure how to do that. I have created an empty database of the same name. When I try to Restore, I can't see anywhere that I can select the backup file sent to me.

I can see there is a RESTORE T-SQL command but again I couldn't see where I could point to the backup file.

Any help would be greatly appreciated

Thanks
Steve
 
Steve,

you have 2 options - 1. via Enterprise Manager or 2. using the T-SQL.

Option 1

1. Right click on your shell DB (the empty one you created) and then "all tasks" then "restore Database".
2. Of the 3 radio buttons, click "from device" then click on "select devices".
3. If anything shows in this screen, highlight it then click on "remove".
4. Click on "Add" and you should then be able to navigate (looks like Windows Explorer) to where you saved the .BAK file. Select that .BAK file and click on OK.
5. Click on OK another 2 times so you are back at the main restore DB screen. Click on the options tab.
6. On this screen, firstly click on "force restore over existing DB" and in the section headed "move to physical file name", enter a path that exists on the server (it will be populated with the path of the live files - it might be that that directory exists on your test server in which case no action is needed, but include this instruction for you just in case).


Option 2:

run the following T-SQL

Code:
RESTORE DATABASE MyDatabaseName
FROM DISK = 'D:\BLAH\Backup\DB Backup_Blah.BAK'
WITH RECOVERY, REPLACE
MOVE 'My_Data_File_Name' TO 'd:\FULL_PATH_NAME_FOR PHYSICAL_DATA_FILE.MDF',
MOVE 'My_Log_File_Name' TO 'd:\FULL_PATH_NAME_FOR PHYSICAL_LOG_FILE.LDF'

Rgds,

M.
 
Thanks M.

It was the "from device" in EM and "FROM DISK" in T-SQL that I was missing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top