SQL Server error 9001: The log for database is not available
SQL Server lost access to the database's transaction log, usually because of an I/O failure on the log file, and took the database offline.
- Error number
9001- Severity
- 21
- Category
- Corruption and I/O
What it means
Every change goes through the transaction log, so when SQL Server can't read or write the log it can't safely continue. Error 9001 (severity 21) takes the database out of service. The operating system error that caused it is in the error log just before 9001.
Common causes
- The disk or volume holding the log file failed or became unavailable.
- Storage errors while writing the log.
- In some cases, an auto-closed database whose log can't be reopened.
How to fix it
-
Check the SQL Server error log and the operating system event log for the I/O error that preceded 9001, and fix the storage.
-
Once the storage is healthy, try to bring the database back online.
ALTER DATABASE SalesDb SET OFFLINE WITH ROLLBACK IMMEDIATE; ALTER DATABASE SalesDb SET ONLINE;
-
Run
DBCC CHECKDBafterwards. If the log is damaged, restore from backup. -
If
AUTO_CLOSEis on, turn it off.ALTER DATABASE SalesDb SET AUTO_CLOSE OFF;
Related errors
9002Transaction log for database is full823Operating system returned an I/O error824Logical consistency-based I/O error5120Unable to open the physical file
More corruption and i/o errors
The code and message text are from the Microsoft Database Engine events and errors reference. Browse the full SQL Server error list or search every database error.
Work on SQL Server in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQL Server and the other databases you use.