DBCC REBUILD_LOG equivalent in MSSQL 2005

Carla Romere
Carla Romere used Ask the Experts™
on
I have an Openfire database that was originally installed on sql 2000 that periodically just goes haywire and lands itself in SUSPECT status, PENDING RECOVERY. I have a series of commands I run that resolve the problem. My issue now, is we've moved this to a 2005 server and one of the commands isn't working. This is the command I used to use:

DBCC REBUILD_LOG(Openfire,'D:\Databases\Openfire_Log.ldf')

That command was apparently retired with sql2000. How do I accomplish the same thing in sql2005?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
i think the command DBCC REBUILD_LOG has replaced with attach_rebuild_log in sql server 2005..

try the following snippet

CREATE DATABASE AdventureWorks2008R2

ON (FILENAME = ‘D:\SQLData\AdventureWorks2008R2_Data.mdf‘)

FOR ATTACH_REBUILD_LOG ;

Open in new window

Commented:
replaced with proper quotes!

CREATE DATABASE AdventureWorks2008R2
ON (FILENAME = 'D:\SQLData\AdventureWorks2008R2_Data.mdf')
FOR ATTACH_REBUILD_LOG ;

Open in new window

Director of Information Technology
Commented:
While I was waiting on a response, I kept digging and found this article that worked perfectly.
http://www.sqlskills.com/blogs/paul/post/checkdb-from-every-angle-emergency-mode-repair-the-very-very-last-resort.aspx

The command that actually did the trick was:

ALTER DATABASE Openfire SET SINGLE_USER;
GO
DBCC CHECKDB (Openfire, REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS;
GO

I will save your command and try it again if I run into this problem again. I'd love to figure out why the log just seems to disappear on this database. It's the only one I've got that "loses its log". It's very bizarre.
Carla RomereDirector of Information Technology

Author

Commented:
Found the solution while I was waiting for comments here. The solution worked perfectly and got the database back online.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial