Skip to content

Est. 2011ยทMicrosoft Partner 7033487ยทDelivery under 3 minยทSupport 7 days a week

Your vault is empty.

Free Fix 9001

Error 9001: The Log for the Database Is Not Available After a Crash

13 min read Updated October 4, 2026 SQL Server

Fix it now

The engine cannot get at the transaction log for a database. Microsoft’s own topic names four causes: storage that failed or went away, a physically damaged log file, a Transparent Data Encryption or external key store failure, and a log that is simply full. The route that keeps your committed work is a restore, not a rebuild.

Run these to establish where the database is and whether its files are where it thinks they are

SELECT name, state_desc FROM sys.databases WHERE name = N'MyDb';
SELECT name, physical_name, state_desc FROM sys.master_files WHERE database_id = DB_ID(N'MyDb');
EXEC sys.sp_readerrorlog 0, 1, N'MyDb';
  1. Read the error log entries around the failure and note whether the message is about opening the file or about processing its contents. 9001 rarely arrives alone: 9002, 3313, 3314, 17204, 17053 or 823 usually sit beside it and carry the real diagnosis.
  2. If a 9002 came first, this is a full log rather than a missing one. Free the space, find out why it was not released, and this article’s harder paths do not apply.
  3. If the volume was briefly offline and is back, try ALTER DATABASE [MyDb] SET ONLINE; and watch the error log.
  4. If the database uses TDE with an external key store, check that the key management module is up before touching the files.
  5. If the file is missing, damaged or mismatched, restore from your last backup and roll the log chain forward.

Do not detach the database, and do not rebuild the log, while a restore is still an option. Detaching a database that will not recover can leave you without a route back.

If the database comes online and CHECKDB is clean, you are done. If it will not, the next section explains which phase of recovery is failing.

Why it happens

When a database comes online the engine runs recovery in three phases. Analysis reads the log forward from the last checkpoint to work out what was in flight. Redo replays committed changes that had not reached the data file. Undo rolls back transactions that were still open. All three read the log, which is why a log problem stops a database from starting even when the data file is perfectly healthy.

9001 itself is a statement about the outcome rather than the cause. Its message says the log is not available and to check the operating system error log for related messages, and Microsoft’s own topic is explicit that the error shows the end result and does not explain the underlying reason. It lists four: the log file sits on failed or unavailable storage, the file is physically damaged, the file cannot be accessed because of a Transparent Data Encryption failure, or the log is full because of a large transaction, low disk space or a file size limit.

That TDE cause catches people out. If the database is encrypted with a key held in an external Extensible Key Management module or hardware security module, and that module is unavailable or misbehaving, the engine cannot read the log and reports it as unavailable. No amount of storage investigation finds that, and the remedy is with the key management vendor rather than with the disks.

9003 and 9004 are the more serious neighbours. 9003 says a log scan number passed to log scan is not valid, and it names two causes in this order: this error may indicate data corruption, or that the log file does not match the data file. A mismatched pair after an attach or a partial restore is the common one, but corruption is named first and should not be ruled out. The message adds a third case people forget: if the error occurred during replication, re-create the publication. 9004 is broader still – an error occurred while processing the log – and its own text says restore from backup if possible, and rebuild the log only if a backup is not available.

The storage went away and came back

You have this one if The System event log shows the volume disconnecting, the file is present now, and other databases on the same volume were affected too.

  1. Confirm the volume is mounted and the path in sys.master_files resolves.
  2. Bring the database back: ALTER DATABASE [MyDb] SET ONLINE;
  3. Read the error log and confirm recovery completed all three phases without further errors.
  4. On iSCSI or SAN storage, make the SQL Server service depend on the storage service so it does not start first at boot.

The log file is missing or unreadable

You have this one if 9001 and the path in sys.master_files points at a file that is not there, or that the service account cannot open. A 17204 usually appears alongside.

  1. Check whether the file was moved rather than deleted. A tidy-up or a failed storage migration is a common origin.
  2. If it was moved, take the database offline, point the metadata at the real path with ALTER DATABASE [MyDb] MODIFY FILE (NAME = N'MyDb_log', FILENAME = N'F:\Log\MyDb_log.ldf'); and bring it back online.
  3. If permissions were lost, grant the SQL Server service account Modify on the folder and retry.
  4. Check whether antivirus quarantined the file, and exclude database file extensions from real-time scanning.

An encryption or key store failure

You have this one if 9001 on a TDE-enabled database, with the storage demonstrably healthy and the file present.

  1. Confirm the external key management or hardware security module is up and reachable from this server.
  2. Check that the module and its provider software are current, and work with the vendor if they are not.
  3. Confirm the database master key in master can still be opened automatically: SELECT is_master_key_encrypted_by_server FROM sys.databases WHERE name = 'master';
  4. Only once the key chain is healthy, set the database online again.

The data and log files are from different points in time

You have this one if 9003, usually after an attach, a file copy or a partial restore.

  1. Do not keep trying to attach the pair. A mismatched log cannot be made to fit.
  2. Rule corruption out as well, because 9003 names it first: check the System event log and the I/O path, and run DBCC CHECKDB once the database is online.
  3. Restore the database from backup: full, then differential, then the log chain in order.
  4. If replication was involved, the message’s own remedy is to re-create the publication.
  5. Keep the original files untouched until the restore is verified.

The log content is damaged and there is no backup

You have this one if 3313, 3456 or 3314 persist, no restore is available, and the database will not come online.

  1. Copy the MDF, NDF and LDF files with the instance stopped, so every attempt starts from the same point.
  2. Only then consider emergency-mode repair, understanding that it rebuilds the log and discards uncommitted and possibly committed work.
  3. ALTER DATABASE [MyDb] SET EMERGENCY; then ALTER DATABASE [MyDb] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; then DBCC CHECKDB (N'MyDb', REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS, NO_INFOMSGS;
  4. Return it with ALTER DATABASE [MyDb] SET MULTI_USER;, then run CHECKDB again and reconcile with the application before trusting it.

Treat anything recovered this way as a copy to extract data from, not as a database to keep running. Move the data into a freshly created database once you have it.

Full reference

Where the fault is, by what you see

What you see Where the fault is
9001 and the log file is not at the recorded path The file was moved, renamed, deleted or quarantined
9001 after a storage event, file now present A transient storage outage. The database needs bringing back online
9001 preceded by 9002 A full log, not a missing one. This is a space problem
9001 on a TDE database with healthy storage The external key management or HSM module. Check it before the disks
9003 Data corruption, or a data file and log file from different points in time. Corruption is named first
3313 or 3456 during startup Redo cannot apply a log record. Log or page damage
3314 during startup Undo of an open transaction failed
Recovery stops and the volume is full Not enough space to complete recovery

The recovery phases, and which code belongs to which

Phase What it does Failure code
Analysis Reads the log forward from the last checkpoint to find what was in flight Usually 9003 or 9004
Redo Replays committed changes that had not reached the data file 3313, and 3456 for a specific log record on a specific page
Undo Rolls back transactions that were still open 3314

3456 is worth reading closely when it appears, because it prints the log record LSN, the transaction ID, the page and the page’s own LSN. That is enough to tell whether one page is the problem or the whole log is. Microsoft also documents a consequence that changes the urgency: if a 3456 occurs during redo in tempdb, the SQL Server instance shuts down.

What rebuilding the log actually costs

Rebuilding or discarding a transaction log throws away every transaction that had not yet been written to the data file. The database that results is transactionally inconsistent: rows can be missing, half-applied, or in violation of constraints that the engine will not re-check for you. It is a salvage operation, not a repair, and it is never the first thing to try.

Microsoft’s own ordering in the 9004 message says the same thing more gently: restore from backup if possible, and if a backup is not available it might be necessary to rebuild the log. The second clause exists because sometimes there is no alternative, not because it is a supported way to fix a database you still have backups for.

Getting the state right before you act

  • RECOVERY_PENDING means recovery could not start, usually because a file is missing or inaccessible. Making the file available is often the whole fix.
  • SUSPECT means recovery started and failed. That more often needs a restore.
  • ONLINE with errors in the log means recovery completed and something else is wrong. Run CHECKDB.
  • Read the state before acting: SELECT name, state_desc, is_read_only FROM sys.databases WHERE name = N'MyDb';
  • Do not put a database into EMERGENCY mode to find out what state it is in. That is a one-way step towards repair.

Preventing the repeat

  1. Make the SQL Server service depend on its storage service, so it does not start before iSCSI or SAN volumes are presented.
  2. Exclude database file extensions from real-time antivirus scanning, and check quarantine when a file goes missing.
  3. Monitor free space on the data and log volumes, and alert before recovery needs space it does not have.
  4. Keep the external key management module patched and monitored if the database uses TDE with one.
  5. Test that your backups restore. Every route out of a damaged log that keeps your data goes through a backup you took earlier.

Every code this article covers

Code What it points at Source
9001 The log for the database is not available. Check the operating system error log for related messages, resolve them and restart the database. Microsoft names failed storage, a damaged file, a TDE or key store failure, and a full log as causes Microsoft Learn
9003 The log scan number passed to log scan is not valid. This may indicate data corruption, or that the log file does not match the data file. If it occurred during replication, re-create the publication Microsoft Learn
9004 An error occurred while processing the log for the database. If possible, restore from backup; if a backup is not available, it might be necessary to rebuild the log Microsoft Learn
3314 During undoing of a logged operation an error occurred at a named log record. Restore the database or file from a backup, or repair the database Microsoft Learn
3456 Could not redo a named log record, for a named transaction, on a named page. The database is left SUSPECT; if it happens in tempdb the instance shuts down Microsoft Learn
3313 During redoing of a logged operation an error occurred at a named log record. Restore the database from a full backup, or repair the database Microsoft Learn

Confirm the fix worked

  1. Confirm the database is online: SELECT name, state_desc FROM sys.databases WHERE name = N'MyDb';
  2. Read the error log and confirm recovery reported analysis, redo and undo completing for that database.
  3. Run DBCC CHECKDB (N'MyDb') WITH NO_INFOMSGS, ALL_ERRORMSGS; before returning it to users.
  4. Take a fresh full backup immediately, and confirm RESTORE VERIFYONLY passes against it.
  5. Confirm the service dependency on storage is in place, so a reboot does not repeat the failure.

Questions people ask about this

Is there anything to buy that fixes this?

No. Recovery, restore and the whole log mechanism are core engine functionality in every edition, and no licence or add-on recovers transactions that no longer exist on disk. The thing that saves you here is a backup you took earlier.

I got 9003. Does that mean the files just do not match?

Not necessarily, and assuming so is how people skip a real check. The message names two causes in order: this error may indicate data corruption, or that the log file does not match the data file. Rule corruption out – check the System event log and the I/O path, and run DBCC CHECKDB once the database is online – before settling on a file-pairing mistake.

Can I just delete the log file and let SQL Server make a new one?

You can force the engine to rebuild one, and people do it in desperation, but the result is a database missing whatever the log held, in an inconsistent state. Every restore option should be exhausted first, and the outcome must be validated with CHECKDB and against the application’s own data.

My storage is fine and the file is right there. What else could it be?

If the database uses Transparent Data Encryption with an external key management or hardware security module, an unavailable module makes the log unreadable and SQL Server reports it as unavailable. Microsoft lists that as one of the four causes of 9001. Check the module before the disks.

What is the difference between SUSPECT and RECOVERY_PENDING?

RECOVERY_PENDING means recovery could not start, usually because a file is missing or inaccessible. SUSPECT means recovery started and failed. RECOVERY_PENDING is more often fixed by making the file available; SUSPECT more often needs a restore.

Related error codes

Was this article helpful?

Your feedback helps us improve our documentation.

Related articles

Free Fix Error 18452 and SSPI Handshake Failures: Kerberos, SPNs and Trust License Error Error 40544: The Azure SQL Database Has Reached Its Size Quota License Error Error 948 and 946: The Database Was Created by a Newer SQL Server Version Free Fix Error 17182: TDSSNIClient Initialisation Failed and the Port Never Opens
โ† Back to Knowledge Base