Restoring Log Showing 2 Different Result. Which one should I trust?

  • Hi everyone,

    I have been using this forum for the past 3 days for my log shipping problem. and I have read lot of articles and columns here and on different forums as well. But, couldn't find the answer to my problems. I hope this time I could find the answer. Thanx for everyone who provided their valuable thoughts and knowledge to me since then.

    Now here is my question.

    When I tried to restore the transaction log using the following command:

    Restore log ApplicationTEST

    from disk=''

    with

    standby=''

    gives me this, once the command is successful:

    Deleting database file 'D:\Solomon\ApplicationTEST\Backup\LOGS\UNDO\UNDO_ApplicationTEST.DAT'.

    RESTORE LOG successfully processed 0 pages in 0.636 seconds (0.000 MB/sec).

    (Notice 0 pages processed)

    Now if I use the same above command to restore my transaction log adding the FILE option as follows:

    Restore log ApplicationTEST

    from disk=''

    with

    file=87,

    standby=''

    now gives me this:

    Deleting database file 'E:\Backups\LOGS\UNDO\UNDO_Application.DAT'.

    Processed 109 pages for database 'Application', file 'Application_Log' on file 87

    (Notice the 109 pages processed)

    I'm using the same method on the same transaction log. This transaction log has many logs file=87 is just an example. I was expecting more than 109 pages to be processed once I just want to restore the whole file in one go.

    I'll appreciate any help in this regards.

    Thanx

    Muneeb.

  • The first method is actually file=1.

    Try to restore whole file in one go, you have to restore every file in the log.

    Use restore header only to get number of files in the log.

    Loop to restore every file in the log.

     

  • For a custom log shipping I am using

    RESTORE LOG [database]

    FROM [dump device]

    WITH STANDBY

    is working fine for me.

  • correction

    RESTORE LOG [database]

    FROM [dump device]

    WITH STANDBY [standby file]

  • Could someone please help me how I can write a stored procedure to loop through the transaction file and return the File number.

    for example:

    If I'm using the following command to restore my logs.

    RESTORE LOG application FROM

    DISK=''

    WITH

    FILE=(STORE PROCEDURE THAT RETURN FILE NUMBER),

    STANDBY=''

    where the FILE option above Instead of assigning some number and increment it manually I use the store procedure that loops through the Transaction log file and return the number automatically.

    Thanx.

    Muneeb.

  • You can try to restore the transaction log then move it to another folder that will assure that you will always have only one file on that folder/backup device.

  • You can specify 'WITH INIT' to your BACKUP LOG statement to overwrite the backup device with latest backup. After the restore is successful on the destination server save the file with datetime appended to the name. Then you delete these files as they age out ( manually or with a job )

Viewing 7 posts - 1 through 6 (of 6 total)

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