Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

The log for database 'DBNAME' is not available. Expand / Collapse
Author
Message
Posted Thursday, September 27, 2012 3:05 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, April 19, 2013 5:12 AM
Points: 3, Visits: 25
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.
Post #1365109
Posted Thursday, September 27, 2012 3:09 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 2:20 AM
Points: 5,231, Visits: 5,106
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?




Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1365111
Posted Thursday, September 27, 2012 6:58 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, April 19, 2013 5:12 AM
Points: 3, Visits: 25

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
Post #1365211
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse