22

I tried to use the registration page for my site after not changing anything, and suddenly this error message appeared:

The log for database "x" is not available. Check the event log for related error messages. Resolve any errors and restart the database.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

I tried to reopen the program & database, tried to refresh the database, but nothing worked. What can be the problem?

TZHX
  • 5,291
  • 15
  • 47
  • 56
user2235692
  • 261
  • 2
  • 3
  • 5

3 Answers3

47
  • Take the database offline.
  • Bring it back online.
  • Run DBCC checkdb to make sure everything is good.
  • Set Auto Close = False.
Eric Higgins
  • 690
  • 5
  • 9
4

It is possible that the database was set to AutoClose, or was set OFFLINE, or while the SQL Server service wasn't running, an .ldf file was deleted or corrupted/compressed by other people or tools.

Make a copy of the MDF file and you can try to attach it using:

CREATE DATABASE mydb_copy ON (filename = 'C:\path to.mdf')
  FOR ATTACH_REBUILD_LOG;

Otherwise, start looking for a backup...

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
2

Too many things can cause this. I had same problem, you can try take database offline and bring back online (or restart MSSQL). Usually it could help. If this won't help you try these solutions:

  1. For SQL Server 2008 and 2005 try install the latest SP
  2. Run DBCC CHECKDB ('DatabaseName') and review founded errors
  3. Check Windows Log and SQL Server Logs for more specific Error code
  4. Some people find solution of setting Auto Close option on database to FALSE
  5. Reason behind this scenario could be due to poor IO or memory of your server
Milan Matějka
  • 2,654
  • 1
  • 21
  • 23