Troubleshooting Guide: Error 3048 – BACKUP LOG WITH TRUNCATE_ONLY Fails on Mirrored Database
Why This Error Happens
This error occurs because BACKUP LOG WITH TRUNCATE_ONLY (and the equivalent NO_LOG option) was deprecated and is fundamentally incompatible with the full recovery model requirements of database mirroring. SQL Server 2025 enforces this restriction because truncating the transaction log without a proper backup chain would break the log stream that mirroring depends on to synchronize the principal and mirror databases. Essentially, the command conflicts with the continuous log-shipping mechanism that mirroring uses to keep both database copies in sync.
Step-by-Step Resolution Guide
Step 1: Verify the Mirroring Configuration Status
- Open SQL Server Management Studio (SSMS) and connect to the instance running on Windows Server 2025.
- Run the following query to confirm the database mirroring state:
SELECT name, mirroring_state_desc FROM sys.database_mirroring WHERE database_id = DB_ID('YourDatabaseName');
- Confirm
mirroring_state_descreturns a value other thanNULL(e.g.,SYNCHRONIZED), which confirms mirroring is active.
Step 2: Replace TRUNCATE_ONLY with a Proper Log Backup
- Abandon the deprecated
TRUNCATE_ONLYsyntax entirely, as it is not supported for mirrored databases by design. - Execute a standard transaction log backup instead to properly clear the log:
BACKUP LOG [YourDatabaseName] TO DISK = 'C:\SQLBackups\YourDatabaseName_Log.trn';
- Ensure the target directory (e.g.,
C:\SQLBackups\) exists and the SQL Server service account has write permissions to it.
Step 3: Schedule Regular Log Backups via SQL Agent
- Open SQL Server Agent in SSMS and create a new Job under Jobs > New Job.
- Configure a recurring schedule (e.g., every 15-30 minutes) to run the
BACKUP LOGcommand from Step 2, preventing the log file from growing uncontrollably. - Verify the SQL Server Agent service is running in Services.msc on Windows Server 2025, as a stopped Agent service will prevent the schedule from executing.
Step 4: Temporarily Remove Mirroring (If Log Truncation is Still Required)
- If you absolutely must break the log chain, you will need to pause or remove mirroring first using:
ALTER DATABASE [YourDatabaseName] SET PARTNER OFF;
- Perform your log maintenance, then reconfigure mirroring by re-establishing the endpoint and partner relationship once finished.
Alternative or Verification Steps
- Verify the fix by checking the log file size via
DBCC SQLPERF(LOGSPACE);after running the scheduled backup job to confirm the log is being truncated correctly. - If mirroring is no longer a business requirement, consider migrating to Always On Availability Groups, which offers more modern log management flexibility compared to legacy database mirroring.