Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

RESTORE DATABASE Server: Msg 3234, Level 16, State 2, Line 2

Posted on 2007-03-19
14
Medium Priority
?
2,374 Views
Last Modified: 2010-08-05
I am trying to RESTORE a SQL2003 database and receiving the following error:

Server: Msg 3234, Level 16, State 2, Line 2
Logical file 'maxprod' is not part of database 'maxdev'. Use RESTORE FILELISTONLY to list the logical file names.
Server: Msg 3013, Level 16, State 1, Line 2
RESTORE DATABASE is terminating abnormally.

I referenced this solution http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/knowledgeBaseEntry.jsp?qid=21493697

But I'm not able to get past the first step to achieve the next which is to rename the files.


Here is my statement:

RESTORE DATABASE maxdev
   FROM DISK='C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\maxprod_bak'

   WITH MOVE 'maxprod' TO 'D:\maxdevdatabase\maxprod.mdf',
   MOVE 'maxprod_log' TO 'D:\maxdevlogs\maxprod_log.ldf'
GO

I can NOT use the same named database because it already exists in the enterprise.  Generally speaking what I'm trying to accomplish is to have a development version of my production database "maxprod".

Thanks.
0
Comment
Question by:psueoc
[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
  • 5
  • 5
  • 3
14 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18750653
it seems like the name "MaxPod" is not in the list , just run    

RESTORE FILELISTONLY MaxDev

this will list the logical files, which you need to put in your restore command

RESTORE DATABASE maxdev
   FROM DISK='C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\maxprod_bak'

   WITH MOVE 'PutTheLogicalFilenameHere' TO 'D:\maxdevdatabase\maxprod.mdf',  ---------------------- 1
   MOVE 'maxprod_log' TO 'D:\maxdevlogs\maxprod_log.ldf'
GO
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 18750663
Do a restore filelistonly first, as stated. When restoring, I suggest changing the target file names to (not only the directory). This means:

restore filelistonly from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\maxprod_bak';
restore database maxdev
 from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\maxprod_bak'
with
 move 'maxprod' to 'D:\maxdevdatabase\maxdev.mdf',
 move 'maxprod_log' to 'D:\maxdevdatabase\maxdev.ldf'




0
 
LVL 71

Expert Comment

by:Qlemo
ID: 18750683
I guess it's not logical file name 'maxprod' but 'maxprod_data' ...
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

Author Comment

by:psueoc
ID: 18750844
I'm receiving the following error:


(2 row(s) affected)

Server: Msg 3234, Level 16, State 2, Line 2
Logical file 'maxprod' is not part of database 'maxdev'. Use RESTORE FILELISTONLY to list the logical file names.
Server: Msg 3013, Level 16, State 1, Line 2
RESTORE DATABASE is terminating abnormally.
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 18750921
as aneeshattingal described, the logical file name might not be correct. Check that (see above)
0
 

Author Comment

by:psueoc
ID: 18751101
Tried:
RESTORE FILELISTONLY maxdev

Receive error:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'FILELISTONLY'.
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18751120
try this

RESTORE FILELISTONLY
FROM DISK='C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\maxprod_bak'
0
 

Author Comment

by:psueoc
ID: 18751243
Executed:
RESTORE FILELISTONLY
FROM DISK='C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\maxprod_bak'

Resulted:
maxdev_Data      D:\maxproddatabase\maxprod.mdf      D      PRIMARY      47382528      35184372080640
maxdev_Log      D:\maxprodlogs\maxprod_log.ldf      L      NULL      704905216      35184372080640

Executed:
restore filelistonly from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\maxprod_bak';
restore database maxdev
 from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\maxprod_bak'
with
 move 'maxprod' to 'D:\maxdevdatabase\maxdev_Data.mdf',
 move 'maxprod_log' to 'D:\maxdevdatabase\maxdev_Log.ldf'

Results:
Server: Msg 3234, Level 16, State 2, Line 2
Logical file 'maxprod' is not part of database 'maxdev'. Use RESTORE FILELISTONLY to list the logical file names.
Server: Msg 3013, Level 16, State 1, Line 2
RESTORE DATABASE is terminating abnormally.

I must be missing something here?
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18751279
restore database maxdev
 from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\maxprod_bak'
with
 move 'maxdev_Data' to 'D:\maxdevdatabase\maxdev_Data.mdf',
 move 'maxprod_log' to 'D:\maxdevdatabase\maxdev_Log.ldf'
0
 

Author Comment

by:psueoc
ID: 18751333
Executed:
restore database maxdev
 from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\maxprod_bak'
with
 move 'maxdev_Data' to 'D:\maxdevdatabase\maxdev_Data.mdf',
 move 'maxprod_log' to 'D:\maxdevdatabase\maxdev_Log.ldf'

Results:
Server: Msg 3234, Level 16, State 2, Line 1
Logical file 'maxprod_log' is not part of database 'maxdev'. Use RESTORE FILELISTONLY to list the logical file names.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 1500 total points
ID: 18751364
restore database maxdev
 from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\maxprod_bak'
with
 move 'maxdev_Data' to 'D:\maxdevdatabase\maxdev_Data.mdf',
 move 'maxdev_log' to 'D:\maxdevdatabase\maxdev_Log.ldf'


---you can see the Logical file names from the above restore filelistonly command
0
 

Author Comment

by:psueoc
ID: 18751582
aneeshattingal:

Your solution was almost correct.
The statement needed to include the "WITH REPLACE" option as shown below:

restore database maxdev
 from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\maxprod_bak'
with replace,
 move 'maxdev_Data' to 'D:\maxdevdatabase\maxdev_Data.mdf',
 move 'maxdev_log' to 'D:\maxdevdatabase\maxdev_Log.ldf'


I sincerely appreciate all of your prompt responses.

0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18751592
:)
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

610 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