Solved

How to restore SQL Server dump file

Posted on 2004-04-02
3
17,018 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
3 Comments
 
LVL 7

Accepted Solution

by:
ChrisFretwell earned 100 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 42

Expert Comment

by:EugeneZ
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how the fundamental information of how to create a table.

920 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