Solved

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

Posted on 2007-03-19
14
2,239 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 68

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 68

Expert Comment

by:Qlemo
ID: 18750683
I guess it's not logical file name 'maxprod' but 'maxprod_data' ...
0
 

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 68

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Full Text Search string 5 33
C# Application Local DB Connection String 23 58
Complex SQL 10 33
Access recordset not updateable 8 38
In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
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.
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…
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.

708 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

19 Experts available now in Live!

Get 1:1 Help Now