Troubleshooting Guide: Error 3446 – Primary Log File Not Available
Why This Error Happens
Error 3446 occurs when SQL Server 2025 cannot locate or access the primary log file (LDF) associated with the database, typically because the file has been moved, deleted, or renamed outside of SQL Server’s control. This can also result from underlying storage issues, such as a disconnected volume, a corrupted file system, or antivirus software locking the file. In some cases, insufficient NTFS permissions for the SQL Server service account on the log file directory can trigger this same access failure.
Step-by-Step Resolution Guide
Step 1: Verify the Physical Log File Location
- Open SQL Server Management Studio (SSMS) and run
sys.master_filesto check the expected path of the log file for the affected database. - Navigate to the default data path (e.g.,
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\) in File Explorer to confirm the.ldffile physically exists. - Check Windows Server 2025 Disk Management to ensure the underlying volume (especially if using Storage Spaces or a SAN mount) is online and not in a “Reserved” or “Offline” state.
Step 2: Check NTFS Permissions and Service Account Access
- Right-click the SQL Server DATA folder, select Properties > Security, and ensure the
NT SERVICE\MSSQLSERVER(or your custom service account) has Full Control. - If permissions were recently reset by a Group Policy update on Windows Server 2025, manually re-apply the SQL Server service account permissions.
- Restart the SQL Server service via
services.mscafter applying permission changes to ensure the lock is refreshed.
Step 3: Take the Database Offline and Online to Reset the Handle
- Run the following T-SQL command to force SQL Server to release and re-acquire the file handle:
ALTER DATABASE [YourDB] SET OFFLINE WITH ROLLBACK IMMEDIATE;
ALTER DATABASE [YourDB] SET ONLINE;
- Check the SQL Server Error Log immediately after running this command to see if the engine successfully remounts the log file.
Step 4: Restore the Log File from Backup (If File is Corrupted/Missing)
- If the
.ldffile is confirmed missing or corrupted, stop the SQL Server service completely. - Copy a valid backup of the
.ldffile into the original directory path if available, or prepare to rebuild the log using emergency mode if no backup exists. - Use
DBCC CHECKDBwith theREPAIR_ALLOW_DATA_LOSSoption only as a last resort if standard recovery steps fail.
Alternative or Verification Steps
- Verification: Run
DBCC SQLPERF(LOGSPACE)to confirm the database is reporting valid log space usage, and execute a testBACKUP LOGcommand to ensure the error does not reappear. - Alternative: If the log file remains inaccessible due to a hardware-level lock, detach the database (
sp_detach_db) and re-attach it usingCREATE DATABASE ... FOR ATTACH_REBUILD_LOGto force SQL Server to generate a new transaction log file.