Read Consolidated Backup Information for any SQL version (2005 - 2017) database backup file

 

Purpose: Get Consolidated SQL DB Backup (.bak (or) .trn) file information

Compatible & Tested SQL Versions: 2005, 2008, 2008 R2, 2012, 2014, 2016 & 2017

 

Usage

1. Open SQL Server Management Studio (SSMS) and connect to SQL Server.

2. Click on “New Query”, copy the complete code, paste it & run (Complete code). 

3. Enter the Perameter values as explained below (SQL Backup file with path (Local)

SQL
Edit|Remove
  @DB_Backup_File = '*.bak  ' <-- Enter the Backup file path & name 
  @Backup_File_id = 1         <-- If specific backup file contains multiple backups on same file. you may specify specific Position to analyze

Description:

 This Script reads [ READHEADERONLY & FILELISTONLY ] information of any SQL Server database backup (Full, Differential, Log, File  Group, Differential File, Partial, Differential) File information and consolidates and provides below result.


 

Complete logic is reads below mentioned SQL commands and display's consolidated result from both

 

 

SQL
Edit|Remove
RESTORE HEADERONLY FROM DISK = '*.bak'
 
SQL
Edit|Remove
RESTORE FILELISTONLY FROM DISK = '*.bak'