Solved

How do you restore a .bak file that was created from a SQL Backup?

Posted on 2008-06-14
7
1,431 Views
Last Modified: 2012-06-27
We have been using a vendor in an ASP environment for some time now.  We have decided to move to an inhouse server and the vendor has sent us our data in a .bak format.  They said it was a backup of our database from SQL.  What command do I use to restore it on my SQL server?

0
Comment
Question by:kwh3856
  • 5
  • 2
7 Comments
 

Author Comment

by:kwh3856
ID: 21786952
The name of the file they sent us is

PM_RW_MDSPED_080430.bak

Thanks
Kenny
0
 

Author Comment

by:kwh3856
ID: 21786988
Ok..I setup a restore device under backup devices and pointed it to my file.  I then entered the following command.

restore Database PM_RW_MDSPED_080430 from MdServe with RECOVERY

I now get the following error messages when you execute the command

Msg 5133, Level 16, State 1, Line 2
Directory lookup for the file "E:\PM_MDF\PM_RW_MDSPED.mdf" failed with the operating system error 3(The system cannot find the path specified.).
Msg 3156, Level 16, State 3, Line 2
File 'PM_RW_Mdsped_Data' cannot be restored to 'E:\PM_MDF\PM_RW_MDSPED.mdf'. Use WITH MOVE to identify a valid location for the file.
Msg 5133, Level 16, State 1, Line 2
Directory lookup for the file "e:\PM_LDF\PM_RW_MDSPED.ldf" failed with the operating system error 3(The system cannot find the path specified.).
Msg 3156, Level 16, State 3, Line 2
File 'PM_RW_Mdsped_Log' cannot be restored to 'e:\PM_LDF\PM_RW_MDSPED.ldf'. Use WITH MOVE to identify a valid location for the file.
Msg 3119, Level 16, State 1, Line 2
Problems were identified while planning for the RESTORE statement. Previous messages provide details.
Msg 3013, Level 16, State 1, Line 2
RESTORE DATABASE is terminating abnormally.



My server does not have a drive letter e:

Is that my primary problem?

Thanks
Kenny
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 21787582
>Is that my primary problem?
yes, and exactly as the error message indicates, you have to use the MOVE :


restore Database PM_RW_MDSPED_080430 from MdServe 
with RECOVERY
 , MOVE 'PM_RW_Mdsped_Data' TO  'C:\PM_MDF\PM_RW_MDSPED.mdf'
 , MOVE 'PM_RW_Mdsped_Log' TO 'C:\PM_LDF\PM_RW_MDSPED.ldf' 
note: the full folder ( C:\PM_MDF ) must exist before the restore, otherwise you will get the same error.

Open in new window

0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

Author Comment

by:kwh3856
ID: 21788510
Angel,
Thanks.  I got this error message when I tried your command.



Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "C:\PM_LDF\PM_RW_MDSPED.ldf" failed with the operating system error 2(The system cannot find the file specified.).
Msg 3156, Level 16, State 3, Line 1
File 'PM_RW_Mdsped_Log' cannot be restored to 'C:\PM_LDF\PM_RW_MDSPED.ldf'. Use WITH MOVE to identify a valid location for the file.
Msg 3119, Level 16, State 1, Line 1
Problems were identified while planning for the RESTORE statement. Previous messages provide details.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 21788539
just to emphasise: the folder C:\PM_LDF HAS to exist BEFORE you try the restore.
sql server will not implicitely try to create the folder!
0
 

Author Comment

by:kwh3856
ID: 21788553
Thanks.  I did not notice there were two seperate directories.

Thanks
Kenny
0
 

Author Closing Comment

by:kwh3856
ID: 31467269
Awesome!!!!

Thanks
Kenny
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question