SQL Server Performance

sql error trapping the restore command

Discussion in 'General DBA Questions' started by patelsur, Sep 16, 2004.

  1. patelsur New Member

    Hi

    I have a sql statement

    RESTORE LOG crm3 FROM DISK =@myfile WITH NORECOVERY

    And this works fine.

    But sometimes (intentionally) I specify a file that is either too young or
    too old for the database
    to restore. Essentially I am going through a series of files which need
    applying. Some of them
    are irrelevant. When one of these files is eno****ered the above command
    yields

    Error on Server:, Source:.Net SqlClient Data Provider
    Class:16, Msg 4326, State 0, Line 36
    The log in this backup set terminates at LSN 2565000000217200001, which is
    too early to apply to the database. A more recent log backup that includes
    LSN 2569000000078800001 can be restored.

    The above error message is also fine. I simply now want to continue with the
    rest of my sql commands.
    But I cant seem to trap the error message so my script does NOT stop.

    I have tried using @@error <> 0 but it seems to be ignored.

    Does anyone know how to continue processing sql after such an event?

    Any help with this appreciated

    Regards
    Suresh
  2. satya Moderator

    It wil not continue until the sequential process of log restores completes the process.

    Satya SKJ
    Moderator
    http://www.SQL-Server-Performance.Com/forum
    This posting is provided “AS IS” with no rights for the sake of knowledge sharing.

Share This Page