Solved

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

Posted on 2008-06-14
7
1,429 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 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

20 Experts available now in Live!

Get 1:1 Help Now