what''s wrong with this code

  • RESTORE LOG TEST

    FROM DISK = '\\TESTServer\d$\Log\Test_LOG.TRN'

    WITH

    DBO_ONLY,

    STANDBY = '\\TestServer\d$\MSSQL\BACKUP\LOG\TEST\undo_Test_LOG.TRN'

    WAITFOR DELAY '00:00:05'

    EXEC sp_dboption 'Test', 'single user', true

     

    i am getting error saying that

    Server: Msg 4306, Level 16, State 1, Line 5

    The preceding restore operation did not specify WITH NORECOVERY or WITH STANDBY. Restart the restore sequence, specifying WITH NORECOVERY or WITH STANDBY for all but the final step.

    Server: Msg 3013, Level 16, State 1, Line 5

    RESTORE LOG is terminating abnormally.

  • Did your previous restore steps (including RESTORE DATABASE) include either WITH STANDBY or WITH NORECOVERY? If not, this message is expected. All of the steps, except the final restore step, must include one of these commands for the restore sequence to function.

  • Try replacing "STANDBY" with "RECOVERY"

    OR

    Try replacing "DBO_ONLY" with "RESTRICTED_USER" as "DBO_ONLY" is available only for backward compatibility.

     

    ------------
    Prakash Sawant

    http://psawant.blogspot.com

  • the previous was the Full restore from back up!!

     

    thanks

  • Okay. But did it include WITH NORECOVERY or WITH STANDBY? It probably didn't. That means you can't add any more backup files.

    RESTORE DATABASE mydb

    FROM Blah

    That defaults to WITH RECOVERY. That's it....the database is fully recovered.

    RESTORE DATABASE mydb

    FROM Blah

    WITH NORECOVERY

    Okay...I've restored the full backup and now I'm waiting to restore another backup.

    RESTORE LOG mydb

    FROM Blah

    WITH RECOVERY

    Okay, now I'm all done. I've restored a Full backup and one log backup.

    -SQLBill

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply