Solved

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

Posted on 2008-06-14
7
1,430 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

919 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now