How to fix Error 3163 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3163 — “The Transaction Log Was Damaged” (SQL Server 2025)

Why This Error Happens

This error occurs when SQL Server detects that the transaction log backup chain has been broken, corrupted, or is missing required LSNs (Log Sequence Numbers) needed to continue a restore sequence. It commonly happens when a full or differential backup restore was interrupted, skipped, or performed out of order, leaving the data files in a state that doesn’t match what the log backup expects. Physical corruption on disk (due to storage failures, antivirus interference, or improper file handling) can also trigger this error by invalidating the log’s internal consistency checks.

Step-by-Step Resolution Guide

Step 1: Verify the Full Restore Sequence

  • Confirm you restored a valid FULL backup first using RESTORE DATABASE [YourDB] FROM DISK = 'C:\Backups\YourDB_Full.bak' WITH NORECOVERY.
  • Ensure no RECOVERY option was applied prematurely in earlier restore steps, as this closes the database to further log restores.
  • Check backup history in msdb.dbo.backupset to confirm the correct LSN chain (firstlsn, lastlsn) between full, differential, and log backups.

Step 2: Check for Missing or Out-of-Order Log Backups

  • Run RESTORE HEADERONLY FROM DISK = 'C:\Backups\YourDB_Log.trn' to inspect backup metadata and LSN ranges.
  • Ensure differential backups (if used) are applied with WITH NORECOVERY before attempting log restores.
  • Reapply log backups strictly in chronological order; skipping even one .trn file will trigger Error 3163.

Step 3: Inspect Storage and File Integrity

  • Open Windows Event Viewer (eventvwr.msc) and check the System and Application logs for disk I/O errors (Event ID 7, 9, or 51) coinciding with the backup/restore window.
  • Run CHKDSK C: /F /R on the volume hosting your .bak/.trn files to rule out physical disk corruption.
  • Confirm antivirus or backup agents (e.g., Windows Defender, VSS writers) are not locking or modifying files during the backup process — exclude the SQL Server data/log directories from real-time scanning.

Step 4: Rebuild the Restore Chain from a Clean Full Backup

  • If the log file is confirmed corrupted, discard the broken .trn file and take a fresh FULL backup once the database is operational.
  • Use RESTORE DATABASE [YourDB] FROM DISK = 'NewFullBackup.bak' WITH NORECOVERY, then reapply only backups taken after this new full backup.
  • Document the new backup chain in your maintenance plan to prevent future sequence breaks.

Alternative or Verification Steps

  • After completing the restore chain, run RESTORE DATABASE [YourDB] WITH RECOVERY and verify the database comes online without errors; check status via sys.databases (state_desc should read ONLINE).
  • If corruption persists, use DBCC CHECKDB('YourDB') WITH NO_INFOMSGS, ALL_ERRORMSGS on the restored copy to confirm no further integrity issues exist before resuming production use.