Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Restoring with move

Author  Topic 

1fred
Posting Yak Master

158 Posts

Posted - 2002-05-30 : 11:34:21
I have a backup file with .bak extension. This file is downloaded every day and I would like to restore it at my job server.

Here is the code I'm using.

declare @path as varchar(100)
set @path= N'f:\download\prd_live\PRD_Live_db_200205300900.BAK'

RESTORE DATABASE dev_calul
FROM disk = @path
WITH
RECOVERY,
move 'PRD_Live_Data' TO 'D:\mssql\mssql\data\dev_calcul_data.mdf',
move 'PRD_Live_Log' TO 'D:\mssql\mssql\data\dev_calcul_log.ldf',
replace

After looking in the help and the forum, this was the code I expected to work. But here is the error message I get.

Server: Msg 1834, Level 16, State 1, Line 7
The file 'D:\mssql\mssql\data\dev_calcul_data.mdf' cannot be overwritten. It is being used by database 'Dev_Calcul'.
Server: Msg 3156, Level 16, State 1, Line 7
File 'PRD_Live_Data' cannot be restored to 'D:\mssql\mssql\data\dev_calcul_data.mdf'. Use WITH MOVE to identify a valid location for the file.
Server: Msg 1834, Level 16, State 1, Line 7
The file 'D:\mssql\mssql\data\dev_calcul_log.ldf' cannot be overwritten. It is being used by database 'Dev_Calcul'.
Server: Msg 3156, Level 16, State 1, Line 7
File 'PRD_Live_Log' cannot be restored to 'D:\mssql\mssql\data\dev_calcul_log.ldf'. Use WITH MOVE to identify a valid location for the file.
Server: Msg 3013, Level 16, State 1, Line 7
RESTORE DATABASE is terminating abnormally.

I was hoping that the 'with replace' clause, was used to avoid this error message. Any help is greatly appreciated!

Fred

1fred
Posting Yak Master

158 Posts

Posted - 2002-05-30 : 11:55:33
Ok sorry guys, don't waste time helping me, I made a spelling mistake, restore dev_calul is not working, you should read restore dev_calcul, so the sql statement is working now!

Go to Top of Page
   

- Advertisement -