Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to restore SQL Server dump file

Posted on 2004-04-02
3
Medium Priority
?
17,061 Views
Last Modified: 2007-12-19
Hi Guru:

I work with Oracle but is completedly new to SQL Server. I was required to create database and restore from a dump file (I would think that it likes oracle's import). The dump file was created by SQL Server's backup command(I would think it likes oracle's export). But I got errors like:

Server: Msg 5105, Level 16, State 2, Line 3
Device activation error. The physical file name 'C:\Program Files\Microsoft SQL Server\MSSQL\data\dev_Data.MDF' may be incorrect.
Server: Msg 3156, Level 16, State 1, Line 3
File 'vwdev_Data' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\dev_Data.MDF'. Use WITH MOVE to identify a valid location for the file.
Server: Msg 5105, Level 16, State 1, Line 3

I use the command as:

restore database  dev
from disk = 'C:\TEMP\James\dev.bak'
go

Any suggestions, thanks.
0
Comment
Question by:http29
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Accepted Solution

by:
ChrisFretwell earned 300 total points
ID: 10746304
run this command first. It gives you the details of what you need to know about that backup.

restore filelistonly from disk = 'c:\temp\james\dev.bak'

this will tell you about the mdf and ldf and their logical names. then you can run the restore with move.

it sounds like you want to restore to somewhere other than where the original was. for this you need to use with move like this

move '[logical_file_name]' to '[operating_system_file_name]'

so based on what your filelistonly shows you, you can

restore database dev
from disk = 'c:\temp\james\dev.bak'
with move 'dev' to 'c:\dev_data.mdf',
move 'dev_log' to 'c:\dev_log.ldf'

Chris
0
 
LVL 34

Expert Comment

by:arbert
ID: 10746393
Agree with chris--if you're restoring to a different directory structure, you're going to have to use MOVE...TO.  Also, if the directory structure is the same and you're restoring over an existing database, you need to use the WITH REPLACE option.

Brett
0
 
LVL 43

Expert Comment

by:Eugene Z
ID: 10759729
just one thing:
logical name is not alwayse like databse name - looks like (from error above) you have not 'dev' but 'vwdev_Data'
for dat file:

restore database dev            
from disk = 'c:\temp\james\dev.bak'
with move 'vwdev_Data' ' to 'c:\dev_data.mdf',
move 'dev_log' to 'c:\dev_log.ldf'   ---

--to see logical name of the dtabase - run in Query Analyzer -
use yourdatabsenamesource
go
select name,filename  from sysfiles
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

715 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