Log Restore

  • Could someone please tell me what i am doing wrong here?

    I set pubs to be Full Recovery method;

    PUBS and LOGPUBS are backup devices to the SQL backup directory;

    use master

    go

    backup database pubs TO PUBS

    USE pubs

    go

    create table _table ( col1 char(2) primary key )

    go

    insert into _table select 'aa'

    go

    backup log pubs to LOGPUBS

    --want to remove the record so when i restore the log, the record will be in the table again.

    select * from _table -- make sure record is there

    delete from _table

    select * from _table -- make sure record is gone

    use master

    go

    restore database pubs from pubs with norecovery

    restore log pubs from logpubs with file = 1, recovery

    use pubs

    go

    RESULTS:

    Processed 168 pages for database 'pubs', file 'pubs' on file 1.

    Processed 3 pages for database 'pubs', file 'pubs_log' on file 1.

    RESTORE DATABASE successfully processed 171 pages in 0.400 seconds (3.482 MB/sec).

    Server: Msg 4305, Level 16, State 1, Line 2

    The log in this backup set begins at LSN 41000000018300001, which is too late to apply to the database. An earlier log backup that includes LSN 41000000017800001 can be restored.

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

    RESTORE LOG is terminating abnormally.

    Server: Msg 927, Level 14, State 2, Line 3

     

    This is driving me Crazy.. please tell me what i am doing wrong here.. Thanks!

    Regards, Jim C

  • At first sight I would say you don't do anything wrong, and executing the code works. What could cause your problem is the "with file = 1" option.

    If your backup device contains more backups, this option would rstore the oldest backup. If this is a backup taken before your full database backup you will get this kind of an error.

    M

    [font="Verdana"]Markus Bohse[/font]

Viewing 2 posts - 1 through 1 (of 1 total)

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