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

Troubleshooting Guide: Error 1135 – Log File Size Exceeds Maximum Allowed Size on Azure SQL

Why This Error Happens

This error occurs because Azure SQL Database enforces a hard cap on transaction log file size based on the service tier and compute size of the target database, and the source database’s log file exceeds that threshold. It commonly happens when restoring an on-premises SQL Server 2025 database (with a large or bloated log file due to long-running transactions, uncommitted transactions, or infrequent log backups) into an Azure SQL environment with a lower service tier. The restore engine rejects the operation outright because the destination simply cannot allocate a log file large enough to accommodate the incoming VLF (Virtual Log File) structure.

Step-by-Step Resolution Guide

Step 1: Shrink the Source Database Log File Before Export

  • On the source SQL Server 2025 instance, run DBCC SQLPERF(LOGSPACE) to check current log file size and percent used.
  • Perform a full log backup first: BACKUP LOG [YourDB] TO DISK = 'C:\Backups\YourDB_Log.trn'.
  • Shrink the log file using DBCC SHRINKFILE (YourDB_log, 1024) (adjust target size in MB as needed).
  • Verify no open transactions are holding the log active by checking sys.dm_tran_active_transactions.

Step 2: Switch Database to Simple Recovery Temporarily

  • Open SQL Server Management Studio (SSMS) or run via T-SQL: ALTER DATABASE [YourDB] SET RECOVERY SIMPLE;
  • This truncates the inactive portion of the log immediately, reducing overall log file size before export.
  • Re-run DBCC SHRINKFILE after switching recovery models to reclaim unused space.
  • Once shrink is complete, switch back to Full recovery if required for production use: ALTER DATABASE [YourDB] SET RECOVERY FULL;

Step 3: Scale Up the Target Azure SQL Service Tier

  • Navigate to the Azure Portal > SQL Databases > [Your Target Database] > Compute + Storage.
  • Increase the Service Tier (e.g., from Standard S3 to Premium P2, or increase vCores in General Purpose/Business Critical tiers) since max log size scales with DTUs/vCores.
  • Confirm the new maximum log size limit matches or exceeds your source log file size (reference Microsoft’s DTU/vCore log size documentation table).
  • Retry the restore or import operation using New-AzSqlDatabaseImport (PowerShell) or the Azure Portal Import wizard.

Step 4: Use BACPAC Export/Import Instead of Native Restore

  • If native .bak restore continues to fail, export the source database as a .bacpac file using SqlPackage.exe: SqlPackage.exe /Action:Export /SourceServerName:localhost /SourceDatabaseName:YourDB /TargetFile:C:\Export\YourDB.bacpac
  • Import the .bacpac into Azure SQL via SqlPackage.exe /Action:Import or the Azure Portal, which rebuilds the log file fresh rather than copying the oversized log structure.

Alternative or Verification Steps

  • Verify the fix by checking log file size post-restore in Azure SQL using DBCC SQLPERF(LOGSPACE) — it should display a size within the tier’s documented limit.
  • If scaling up the tier is not cost-feasible, consider migrating to Azure SQL Managed Instance, which supports larger native log file sizes and full .bak restore compatibility without the DTU-based cap.