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

x
?
Solved

Restore Database With MOVE

Posted on 2010-11-15
6
Medium Priority
?
775 Views
Last Modified: 2012-05-10
Hi guys!  

I'm stumped with this one and I am hoping you could help me.

I am trying to restore a database into another server.  I ran a RESTORE FILELISTONLY and this is what I got.

RESTORE FILELISTONLY FROM DISK = '\\SomeSharedDrive\Backup$\SomeFolder\DummyDB_LIVE.bak'

DB_data      D:\SQLServer\MSSQL\Data\DummyDB_LIVE_data.MDF      D      PRIMARY      292749312      35184372080640
DB_log      E:\SQLServer\MSSQL\Data\DummyDB_LIVE_Log.LDF      L      NULL      104595456      35184372080640


I ran the following command:


Restore database DummyDB_LIVE
from disk = '\\SomeSharedDrive\Backup$\SomeFolder\DummyDB_LIVE.bak'
with move 'DB_data' to 'F:\SQLServer\MSSQL\data\DummyDB_LIVE_data.mdf',
move 'DB_log' to 'G:\SQLServer\MSSQL\data\DummyDB_LIVE_Log.ldf',
replace

I got this error:
Msg 3156, Level 16, State 1, Line 3
File 'DB_log' cannot be restored to 'G:\SQLServer\MSSQL\data\DummyDB_LIVE_Log.ldf'. Use WITH MOVE to identify a valid location for the file.
Msg 3013, Level 16, State 1, Line 3
RESTORE DATABASE is terminating abnormally.


I can confirm that the paths are correct.  The user account used by SQL Server service is permissioned with read/write access to its respective folders.  

SQL server version is SQL Server 2000.

What else am I missing?
0
Comment
Question by:monicai
[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
  • 2
6 Comments
 
LVL 10

Expert Comment

by:GDG_DBA
ID: 34142315
Does it work if you give it a different location?
-G
0
 
LVL 4

Author Comment

by:monicai
ID: 34142348
Btw, this restore is basically overwriting an existing DummyDB_LIVE database (on a different server) which has exactly the same mdf and ldf paths specified in the restore statement.

I did try doing the restore on a new database with the same directory path but slightly different filenames and it works.  

For some reason the RESTORE fails to overwrite the LDF file.
0
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 2000 total points
ID: 34142526
This should work:

Restore database DummyDB_LIVE
from disk = '\\SomeSharedDrive\Backup$\SomeFolder\DummyDB_LIVE.bak'
with move 'DB_data' to 'D:\SQLServer\MSSQL\Data\DummyDB_LIVE_data.MDF',
move 'DB_log' to ' E:\SQLServer\MSSQL\Data\DummyDB_LIVE_Log.LDF',
replace

If you intend to move your MDF and LDF files to F and G drives, then you have to detach your database and copy your MDF and LDF files to F and G drive and attach it to get it done instead of using RESTORE WITH MOVE option.
0
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
LVL 10

Expert Comment

by:GDG_DBA
ID: 34147498
From what you are saying, a different SQL instance is using those files in the location you are trying to restore to.

This will not work.  SQL Server will not let you have the files.  They are in use.  You will have to restore to a different path or a different file name.  

What exactly are you trying to do?  Are you trying to restore over the database on the other instance?

-G
0
 
LVL 4

Author Comment

by:monicai
ID: 34170184
I have resolved this issue by detaching and attaching the database then re-run the same restore query.
0
 
LVL 4

Author Comment

by:monicai
ID: 34170189
Btw thanks to all who has answered this question.  Points has been awarded.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

705 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