views:

219

answers:

1

I am trying to restore a database from a backup file on a SQL Server 2008 instance using the following SQL command:

BEGIN 
    RESTORE DATABASE [MyDataBase] 
    FROM DISK=@db_location 
    WITH STATS=5, 
    FILE=1, 
    MOVE @db_OldName TO @db_NewFile, 
    MOVE @db_OldLogName TO @db_NewLogFile, 
    NOREWIND, NOUNLOAD, RESTART, RECOVERY 
END

and it fails with the following error:

Msg 3264, Level 16, State 1, Line 19 The operation did not proceed far enough to allow RESTART. Reissue the statement without the RESTART qualifier. Msg 3013, Level 16, State 1, Line 19 RESTORE DATABASE is terminating abnormally.

If I do not use the RESTART option the backup is successful. On SQL Server 2005 it works even with the RESTART parameter.

Since the SQL command is issued by a program I cannot change it. Is there a way to work around this issues on SQL Server 2008?

A: 

Has this ever worked?

RESTART is only specified when you want to continue an interrupted restore. If you can't change the SQL, then you can only somehow break a first restore to generate an error condition.

Because of this, you can't be sure that it's the same on SQL 2005 unless it happens every time. Or they changed behaviour.

gbn