If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > attach db fails

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-02-09, 04:34
mrpcguy mrpcguy is offline
Registered User
 
Join Date: Mar 2004
Posts: 130
attach db fails

case: my db was in mode "suspect" and i try to detach db and now i can't attach it at all. I got this error message when im try to attach the db:
"---------------------------
Microsoft SQL-DMO (ODBC SQLState: 42000)
---------------------------
Error 1813: Could not open new database 'db_ControlManager'. CREATE DATABASE is aborted.
Device activation error. The physical file name 'E:\MSSQL\Data\db_ControlManager_log.LDF' may be incorrect.
---------------------------"

The logfile is lost but when i try to attach it says that it might cretate a new log file but it dosen't. There is no problem for me to loose whats in that log file as long as i can access the data in db.

And of course the backup software dosen't work so i have no backup of the db

How can i try to repair the db?

thx in advance for any help

im using sql 2000 with sp4
Reply With Quote
  #2 (permalink)  
Old 07-02-09, 09:35
PMASchmed PMASchmed is offline
Registered User
 
Join Date: Jun 2004
Location: Long Island
Posts: 696
Try this:
EXEC sp_resetstatus ‘yourDBname’;
ALTER DATABASE yourDBname SET EMERGENCY
DBCC checkdb(’yourDBname’)
ALTER DATABASE yourDBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB (’yourDBname’, REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE yourDBname SET MULTI_USER

If it no workee, need to restore from backup.
Reply With Quote
  #3 (permalink)  
Old 07-06-09, 02:28
MohammedU MohammedU is offline
Registered User
 
Join Date: Jun 2009
Location: CA, USA
Posts: 59
There is another option to use undocumented DBCC..
DBCC rebuild_log...but some time you may endup inconsistent data...
I used this many times without any issue...

Check the following thread for complete info about this command...
REBUILDING LOG
__________________
MohammedU
SQL Server MVP
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On