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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restore Database WITH MOVE 1

Status
Not open for further replies.

Trudye

Programmer
Sep 4, 2001
932
US
I accidently deleted one of my database. I am now trying to restore it using a .BAK file. While trying to use EM I received the following error msg:
Use WITH MOVE to identify a valid location for the file.

I attempetd to write a script and use QA but that failed too, here is my script:
RESTORE DATABASE REPS2000
FROM 'C:REPS2000_db_200403160202.BAK'
WITH RECOVERY,

MOVE 'reps2000_dat'
TO 'C:reps2000.mdf',
MOVE 'reps2000_log'
TO 'reps2000_log.ldf'

My error msg states:
Incorrect syntax near 'C:REPS2000_db_200403160202.BAK'

I looked up the syntax and discovered that the 'DEVICE' should be named there. I went back to EM and according to EM that is how the device is stated, it is the drive/path/filename of the back up.

Can anyone tell me what should be in the FROM parm?

Thank you,
Trudye


 
RESTORE DATABASE REPS2000
FROM 'C:\REPS2000_db_200403160202.BAK'
WITH RECOVERY,


Thanks

J. Kusch
 
Trudye,

In case you can't tell the difference between what you have and what Jay suggests...there's a slant after the C:

-SQLBill
 

Thanks guys but I'm sorry that was my fault I should have pasted my SQL statement in. I made a typing boo-boo, there is a back-slash in my original statement.

See anything else?

Trudye

 
What is the REAL error message then? You say it's:
My error msg states:
Incorrect syntax near 'C:REPS2000_db_200403160202.BAK'

But if you REALLY have the backslash, then that can't be the error message.

BTW - the backslash is missing from the MOVE section:
MOVE 'reps2000_dat'
TO 'C:reps2000.mdf',

-SQLBill
 
Here is the msg in its entirety:
Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near 'C:\REPS2000\REPS2000_db_200403160202.BAK'.

I move the files trying to isolate the problem here is the code and I am still getting the above msg:


RESTORE DATABASE REPS2000
FROM 'C:\REPS2000\REPS2000_db_200403160202.BAK'
WITH RECOVERY,

MOVE 'reps2000_dat'
TO 'C:\REPS2000\Old Files\reps2000.mdf',
MOVE 'reps2000_log'
TO 'C:\REPS2000\Old Files\reps2000_log.ldf'

Thanks SQLBILL for responding
Trudye

 
you have to use this:

FROM DISK = 'C:\REPS2000\REPS2000_db_200403160202.BAK'

Zhavic


---------------------------------------------------------------
In the 1960s you needed the power of two Comodore64s to get a rocket to the moon. Now you need a machine which is a vast number of times more powerful just to run the most popular GUI.
 
Thanks so much to everyone who provided input. A special thanks to Zhavic you answer did the trick.

Trudye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top