Avamar: How to Use Avamar SQL Plug‑in T‑SQL Scripts During Troubleshooting

Summary: This article describes how to use common Microsoft SQL Server T‑SQL scripts to assist with troubleshooting Avamar SQL Plug‑in backup issues. These scripts help identify backup history, validate log sequence number (LSN) continuity, and investigate log gap errors. ...

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

Generate Complete Database Backup History

Use this script to retrieve the full backup history for a database over a defined time period.
This script helps determine if and when a specific database was last backed up and the size of each backup.

  1. Open SQL Server Management Studio.
  2. Connect to the SQL Server instance.
  3. Run the following T‑SQL query.
    SELECT msdb.dbo.backupset.database_name,
    msdb.dbo.backupset.backup_start_date,
    msdb.dbo.backupset.backup_size,
    msdb.dbo.backupset.backup_finish_date,
    msdb.dbo.backupset.type,
    msdb.dbo.backupset.database_backup_lsn,
    msdb.dbo.backupset.first_lsn,
    msdb.dbo.backupset.last_lsn
    FROM msdb.dbo.backupmediafamily
    INNER JOIN msdb.dbo.backupset
    ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id 
    WHERE database_name IN ('sql_database_name_here')
    --and msdb.dbo.backupset.backup_finish_date between '1/20/2000' and '10/14/2022'
    ORDER BY 
    2 DESC,
    3 DESC
     
  4. Replace sql_database_name_here with the actual database name.
  5. Optionally enable the date range filter to narrow the results.

Validate SQL Log Sequence Number (LSN) Continuity

Use these scripts when Avamar SQL Plug‑in logs report log gap errors.
These queries help determine whether the SQL transaction log chain is broken.

  1. Run the following query to list log backup LSN values.

    SELECT last_lsn, type, user_name FROM msdb..backupset WHERE database_name=N'sql_database_name_here' AND type LIKE 'L' ORDER by last_lsn DESC
  2. Run the following query to retrieve the last log backup LSN recorded by SQL Server.
    SELECT last_log_backup_lsn FROM sys.database_recovery_status "WHERE database_id = DB_ID(N’sql_database_name_here')"
  3. Replace all instances of sql_database_name_here with the database name being analyzed.
  4. Compare the LSN values returned by these queries.

Compare LSN Information with Avamar Metadata

  1. Locate the Avamar SQL Plug‑in metadata file.
  2. Review the sqlmeta.xml file for stored LSN information.
  3. Compare the LSN values in sqlmeta.xml with the SQL Server query results.
  4. Identify gaps or mismatches that indicate a broken log chain.

Additional Information

Additional Information / Notes

  • Manual or third‑party SQL backups can break the log chain used by the Avamar SQL Plug‑in.
  • Always verify SQL backup activity outside of Avamar during log gap investigations.
  • LSN validation is critical before attempting log restores or GLR operations.
Article Properties
Article Number: 000207317
Article Type: How To
Last Modified: 03 Apr 2026
Version:  4
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.