Friday, 18 January 2013

Transaction Log Retrieval Information

Reference: http://www.sqlservercentral.com/blogs/livingforsqlserver/2012/11/19/time-pass-with-transaction-log-part-3-fn-dblog/ Syntax: fn_dblog({BeginLSN | NULL}, {EndLSN | NULL}) Note: 1) LSN in T-Log is in 3 part Hexa-decimal format. but in this function, we have to pass LSN in 3 part decimal format. For example: if Hex LSN is 0000001a:0000001b:0001 then convert this as decimal an pass it as 00000026:00000027:0001 2) NULL to return all T-Log records (*within its range) Examples: select * from fn_dblog(NULL, NULL) -- returns all available T-Log records select * from fn_dblog(NULL, '00000026:00000027:0009') -- returns all available T-Log records upto LSN '00000026:00000027:0009' select * from fn_dblog('00000026:00000027:0009', NULL) -- returns all T-Log records starting from LSN '00000026:00000027:0009' select * from fn_dblog('00000026:00000027:0001','00000026:00000027:0009') -- returns T-Log records between these LSNs fn_dblog function has 116 columns (SQL 2008 R2). Just try below command and check how many columns are familiar to you. sp_help fn_dblog

No comments:

Post a Comment