...bringing you notes from the field...

Tag Cloud


How do I restore a SQL Server database from a backup *.bak file?

If you aren't sure what is actually in the backup file, or even if you think you are sure--execute this statement from a fresh query window:

RESTORE FILELISTONLY
FROM DISK = 'X:\MDD\Clients\Lg\H4\H4L.bak'

 The information about the mdf/ldf files will show up looking like this:

 

In this example, I was restoring a client's database to one of my servers--so I had to 'MOVE' the location paths to represent the drives I had available. If I were restoring to the same location, I would NOT have needed the 'MOVE' condition.

RESTORE DATABASE HumRes4
FROM DISK = 'X:\MDD\Clients\Lg\H4\H4.bak'
WITH REPLACE, MOVE 'Final_LM_Data' TO 'F:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\HumRes4.MDF',
MOVE 'Final_LM_Log' TO 'G:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\HumRes4_Log.LDF'



Feedback

No comments posted yet.