When I execute
SELECT [Current LSN]
FROM sys.fn_dblog(NULL,NULL)
The LSN values are presented in the format
'000000CB:00000055:0002'
However when I try and pass the start and end LSN parameters explicitly to fn_dblog in that format
SELECT *
FROM sys.fn_dblog('000000CB:00000055:0002', '000000CC:00000088:000A')
I get an error, saying...
Msg 9005, Level 16, State 3, Line 1 Either start LSN or end LSN specified in OpenRowset(DBLog, ...) is invalid.
Why doesn't this work and what format do they need to be in?
I did some studies based on this site about LSN and log files... but, or I got an error, or, when I execute the command with the two parameters, I just got 2 rows of informations... I considerate that is intresting, because, when I use a program to read the data-log, I got all the information's.
How I can make to read all the data and informations of log using SQL ?


FYI: As of SQL Server 12 (I haven't tested others but as far back as SQL 2000 by the looks), you can add '0x' to the beginning of the LSN text.
SELECT TOP 1 [Current LSN] FROM fn_dblog('0x000000CB:00000055:0002',null)
Obviously if the query returns with no errors and the same LSN in the result then you should be good to go.
Credit to Art of SQL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With