Hi Friends,
This is my 24th blog on SQL Server Trace Flag 2537 in the series of One Trace Flag a Day. You can go to all blogs under that series by clicking here.

Function fn_dblog() is provided by microsoft to read the transaction log. Keep in mind that this trace flag can only read active portion of transaction log not In-active portion of transaction log. We can use this function to read the transaction log to find out some specific transaction. Now what happen if we are trying to read transaction information that is not the part of active transaction log? Simple, we will not be able to read that information. In such kind of situation you can use trace flag 2537. By using this trace flag, function fn_dblog() will read both active and inactive portions. Let e show you this practically:

Run the below TSQL code and note down the output to compare with same TSQL code using Trace Flag.

The output is mention below. These numbers of rows are showing total number of rows in active portion of transaction log first for a checkpoint operation only and for second including inserted 10 rows:

SQL_Server_Trace_Flag_2537

Now you can run the below TSQL code to check the use of trace flag 2537.

The output is mention below. Now you can check the number of records returned by fn_dblog() function with use of trace flag 2537. These numbers of records are higher than the previous numbers because these are counts including active and inactive records from transaction log.

SQL_Server_Trace_Flag_2537_2

PS: Do not use trace flags in production environment without testing it on non production environments and without consulting because everything comes at a cost.

HAPPY LEARNING!

Regards:
Prince Kumar Rastogi

Like us on FaceBook | Join the fastest growing SQL Server group on FaceBook

Follow Prince Rastogi on Twitter | Follow Prince Rastogi on FaceBook