SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


The log for database 'DBNAME' is not available.


The log for database 'DBNAME' is not available.

Author
Message
dtraian
dtraian
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
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.
anthony.green
anthony.green
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10440 Visits: 6378
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
When a question, really isn't a question - Jeff Smith
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


dtraian
dtraian
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search