Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Jan 21 '12 at 15:02

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.