Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Synatx Restore 1

Status
Not open for further replies.

DrSql

Programmer
Jul 16, 2000
615
0
0
US
I use the folwing syntax to restore
and get an error. Any idea why?

RESTORE DATABASE ADDSDemo
FROM DISK = '\\cdcsqlnode02\e$\Backup\node2\ADDSDemo.bak'
WITH STANDBY= 'E:\MSSQL\Data\undoADDSDemo_log.ldf',
MOVE 'ADDSDemo' TO 'D:\MSSQL\Data\ADDSDemo.mdf',
MOVE 'ADDSDemo_log' TO 'E:\MSSQL\Data\ADDSDemo_log.ldf'

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


Dr.Sql
Good Luck.
 
Your logical filename are incorrect. To a RESTORE FILELISTONLY from disk='filename.bak' to get the logical filenames for the database.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(Not quite so old any more.)
 
It tried the follwing still its giving me the same error.
Can you clarify which line I am going wrong.
Basically I am trying to restore from a diff server.

RESTORE FILELISTONLY
FROM DISK = '\\cdcsqlnode02\e$\Backup\node2\ADDSDemo.bak'
RESTORE DATABASE ADDSDemo
FROM DISK = '\\cdcsqlnode02\e$\Backup\node2\ADDSDemo.bak'
--WITH STANDBY= 'E:\MSSQL\Data\undoADDSDemo_log.ldf',
WITH REPLACE,
MOVE 'ADDSDemo' TO 'D:\MSSQL\Data\ADDSDemo.mdf',
MOVE 'ADDSDemo_log' TO 'E:\MSSQL\Data\ADDSDemo_log.ldf'

Dr.Sql
Good Luck.
 
Run just this part.
Code:
RESTORE FILELISTONLY 
   FROM DISK = '\\cdcsqlnode02\e$\Backup\node2\ADDSDemo.bak'
That will tell you the logical name of the files. You then need to modify the red parts of the restore database.
Code:
RESTORE DATABASE ADDSDemo 
FROM DISK = '\\cdcsqlnode02\e$\Backup\node2\ADDSDemo.bak'
--WITH STANDBY= 'E:\MSSQL\Data\undoADDSDemo_log.ldf',
WITH REPLACE, 
MOVE '[COLOR=red]ADDSDemo[/color]' TO 'D:\MSSQL\Data\ADDSDemo.mdf',
MOVE '[COLOR=red]ADDSDemo_log[/color]' TO 'E:\MSSQL\Data\ADDSDemo_log.ldf'

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(Not quite so old any more.)
 
I tried the below restore command and it worked for me. May be issues with the server access... Just guessing..

RESTORE DATABASE dbname
FROM disk='\\server\D$\path\filename.bak'
WITH STANDBY='D:\path\name.sby',
MOVE 'logical_datafile_name' TO 'D:\sqldata\file.mdf',
MOVE 'logical_logfile_name' TO 'E:\sqllog\file.ldf'
GO

 
Thanks Denny.. it worked.. I have been struggling for few hours to figure out what was wrong with my syntax.

Dr.Sql
Good Luck.
 
No problem.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(Not quite so old any more.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top