How to Read the backup file of SQL Server
This is tricky doubt we used to get when we start putting our legs deeper and deeper in SQL Server and its concepts.Can we read the backup file (.bak or .trn) file of a database ?
Answer is YES
It is binary format file, but we can still get some idea by reading the file. We cannot understand all what is written in the backup file. But after going through this article completely you will surely come to some conclusion to find out what transactions actually happen in the file.
Query for reading the backup of database or backup log of database is :
SELECT * FROM fn_dump_dblog (
NULL, NULL, 'DISK', 1, 'D:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\DBATEST.trn',
DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT,
DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT,
DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT,
DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT,
DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT,
DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT,
DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT,
DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT,
DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT);
/* Change the file that you needed, backup or transaction log backup file */
Hope the above information helps
Thanks