Solved

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

Posted on 2007-03-19
14
2,270 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
  • 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 69

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 69

Expert Comment

by:Qlemo
ID: 18750683
I guess it's not logical file name 'maxprod' but 'maxprod_data' ...
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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 69

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 500 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
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.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

809 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