Search

Thursday, March 7, 2013

The .TUF & .WRK files in Log Shipping

.TUF File

.TUF file is the Transaction Undo File, which is created when performing log shipping to a server in Standby mode.
 When the database is in Standby mode the database recovery is done when the log is restored; and this mode also creates a file on destination server with .TUF extension which is the transaction undo file.

This file contains information on all the modifications performed at the time backup is taken.

The file plays a important role in Standby mode… the reason being very obvious while restoring the log backup all uncommited transactions are recorded to the undo file with only commited transactions written to disk which enables the users to read the database. So when we restore next transaction log backup; SQL server will fetch all the uncommited transactions from undo file and check with the new transaction log backup whether commited or not.

If found to be commited the transactions will be written to disk else it will be stored in undo file until it gets commited or rolledback.

.WRK File

The .wrk files are produced when the transaction log backups are copied from the backup location to the secondary server (by the agent job on the secondary).  The files are named .wrk during the copy operation; when they have been completely copied they are renamed to have the .trn extension.  The temporary naming using the .wrk extension ensures that the files are not picked up by the restore job until successfully copied.

So, if the .wrk file you are seeing is there all the time it is likely to be an old copy that failed for some reason.  So for normal operation, you'll see a .wrk file when each transaction log backup file is copied and then that will be renamed to a .trn file.
 

No comments:

Post a Comment