Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The log for database "x" is not available

Tags:

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?

like image 265
user2235692 Avatar asked Apr 02 '13 18:04

user2235692


People also ask

How do I enable SQL logs?

To enable temporary SQL logging:Go to > General Configuration > Logging and Profiling. Choose Enable SQL Logging.

What is X in SQL query?

SELECT 'x' from table returns the constant value x for all rows. It's often used in EXISTS because the EXISTS predicate doesn't care about values, it's only concerned about whether or not there's a row. SELECT x from table returns the column named x from the table, or an error if there is no column named x.

How do I fix the transaction log for database is full?

If no recent transaction log history is indicated for the database with a full transaction log, the solution to the problem is straightforward: resume regular transaction log backups of the database.


2 Answers

  • Take the database offline.
  • Bring it back online.
  • Run DBCC checkdb to make sure everything is good.
  • Set Auto Close = False.
like image 144
Eric Higgins Avatar answered Oct 14 '22 04:10

Eric Higgins


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...

like image 34
Aaron Bertrand Avatar answered Oct 14 '22 05:10

Aaron Bertrand