3

For some reason I need to read the LSN from the T-SQL logs backups without restoring them or even their headers (I assume even restoring only their headers will change the LSN on the database side too, but I'm not sure).

So is the T-SQL log backup files encrypted or does they have special structure? Any information as to where should I start?

Could anyone confirm or denies that restoring the header only wouldn't affect the sys.fn_dblog or anything else?

2 Answers 2

10

Could anyone confirm or denies that restoring the header only wouldn't affect the sys.fn_dblog or anything else?

RESTORE HEADERONLY doesn't target any database in its syntax:

RESTORE HEADERONLY FROM <backup_device>   

It reads the backup device and returns data to the client about what's in the backup. It won't affect your databases in any way.

0

The log backup MAY be encrypted, depending on your setup. (Ref)

The structure of the log backup is likely proprietary, so the only reliable/recommended way to read it is via SQL Server/Microsoft-provided functions (ex. Transact-SQL RESTORE HEADERONLY, or SMO ReadBackupHeader, etc.)

There are possible side effects, though likely none to worry about.

And definitely none affecting the LSN values of a database.

For instance

RESTORE HEADERONLY FROM <inacessible_backup_device>   

will log an error in the SQL Server log, of course, and if you have alerts for severity 016 set up it will trigger an alert, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.