The log for database 'DBNAME' is not available.

  • Hello,

    I have a database problem since yesterday.

    --------------------------------------------------------------------------------------------------------------------------------------------------

    The error is:

    -----------------------------------------------------

    Message

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

    Cannot close event log because there are still event handle users active.

    Message

    Error: 9001, Severity: 21, State: 1.

    -----------------------------------------------------

    What I do:

    -----------------------------------------------------

    exec('ALTER DATABASE [' + @DBName + '] SET OFFLINE WITH ROLLBACK IMMEDIATE')

    print '*** Taken ' + @DBName + ' offline .'

    exec('ALTER DATABASE [' + @DBName + '] SET ONLINE ')

    print '*** Brought ' + @DBName + ' online .'

    declare @logName varchar(100)

    select @logname=name from master.dbo.sysaltfiles

    where groupid=0 and dbid=(select dbid from master.dbo.sysdatabases where name=@DBName)

    exec ('USE [' + @DBName + '] DBCC checkdb with ALL_ERRORMSGS ,EXTENDED_LOGICAL_CHECKS,NO_INFOMSGS ')

    print '*** Checked ' + @DBName

    -----------------------------------------------------

    We have in this moment:

    -----------------------------------------------------

    2300 databases on the specific SQL Instance.

    The version is SQL SERVER 2008 R2 SP2.

    -----------------------------------------------------

    Please HELP!!! I' don't know what to do.

    Thank you very much.

  • Have you checked the path which the DB thinks where the log is, is actually where the log is, or someone hasn't deleted the log?

    Do you have any backups for the DB?

  • Yes, everything is in place.

    I do have backups.

    Another immediate solution to what is happening is to detach/attach database, but I'm currently looking for a definitive one.

    Any suggestions?

    Thank you very much

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply