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

Error- Restore database

Status
Not open for further replies.

techipa

Programmer
Feb 12, 2007
85
US
Hi all,

I get the error when I restore the database from last night's backup.

I use the following cmd:
RESTORE DATABASE ABCRESTORE
FROM DISK = f:\SQLBackups\ABC\ABC_db_200703010508.BAK'
WITH MOVE 'abcdata' TO 'f:\data\abcdata.mdf',
MOVE 'abclog' TO 'f:\data\abclog.ldf'
go

error:
Server: Msg 3156, Level 16, State 1, Line 1
File 'abcdata' cannot be restored to 'f:\data\abcata.mdf'. Use WITH MOVE to identify a valid location for the file.
Server: Msg 3156, Level 16, State 1, Line 1
File 'abclog' cannot be restored to 'f:\data\abclog.ldf'. Use WITH MOVE to identify a valid location for the file.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.


Can anyone tell if what is wrong with ym cmd?

Thanks,
-techiPA
 
At a glance, I would say you need to first get rid of the existing log and data files, or restore to a different name?

Ignorance of certain subjects is a great part of wisdom
 
Thanks AlexCuse, that was the issue. I changed the physical file names and the restore was successful. Those files names were already there on the drive.

Thanks,
-techiPA
 
Do I have to be in the Master database when I restore the database?

Thanks,
 
I am not sure of that. Since the command doesn't really have any database context, I don't think it would matter (or it would transfer you to the database automatically).

When I need to run a backup or restore database command, I don't change what database my QA session is in, but I cannot say for sure what it is afterwards. I am sure someone will be able to answer this question though.

Sorry I can't be of more help,

Alex

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top