?
Solved

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

Posted on 2007-03-19
14
Medium Priority
?
2,343 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 70

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 70

Expert Comment

by:Qlemo
ID: 18750683
I guess it's not logical file name 'maxprod' but 'maxprod_data' ...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 70

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

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Suggested Courses

777 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