[Cialug] [Way OT] that evil company's database won't reattach

Barry Von Ahsen barry at vonahsen.com
Tue Jun 21 13:52:24 CDT 2005


wow, that's low level

once I calmed down, and actually read the instructions, I got this to 
work, and I was able to copy with DTS.  Thanks to all who replied


http://www.developersdex.com/sql/message.asp?p=581&r=4153606

Attach database may not work in below situations:-

1. If the database is not detached using sp_detach_db or using enterprise
manager.

2. sp_attach_single_file_db will fail incase if you have multiple LDF files
associated.

Since the database attach failed you could try below steps:-
-------------------------------------------------------------
1. Create a new database with same MDF and LDF name


2. stop sql server and delete the new MDF file and copy the old MDF file


3. Start SQL Server and see the status. If the database is suspect do the
below steps:-

Setting the database status to emergency mode tells SQL Server to skip
automatic recovery and lets you access the data. To get your data, use this
script:

Sp_configure "allow updates", 1
go
Reconfigure with override
GO

Update sysdatabases set status = 32768 where name = "BadDbName"

Sp_configure "allow updates", 0
go
Reconfigure with override

GO


Create a new empty database and you might be able to use bulk copy program
(bcp), simple SELECT commands, or use DTS to extract your data /objects from
problematic database to new database.




Jon Clemons wrote:
> http://www.sqlservercentral.com/columnists/awarren/attachanddetachagain.asp
> 
> 
> 
> 
> ----- Original Message ----- From: "Barry Von Ahsen" <barry at vonahsen.com>
> To: "Central Iowa Linux Group" <cialug at cialug.org>
> Sent: Tuesday, June 21, 2005 1:05 PM
> Subject: [Cialug] [Way OT] that evil company's database won't reattach
> 
> 
>> this is where the geeks are, so I ask here:
>>
>> I have an MSSQL database that I detached and deleted the log.ldf.  Now 
>> when I try to reattach, it won't do it.
>>
>> Enterprise manager, and query analyzer using sp_attach_single_file_db 
>> and sp_attach_db both fail with error 1813:
>> Device activation error. The physical file name 'c:\path\to\file.ldf' 
>> may be incorrect.
>>
>> anyone come across this before and fix it?  everything says that I 
>> should be able to reattach and have the log file recreated
>>
>> -barry
>>
>>
>> _______________________________________________
>> Cialug mailing list
>> Cialug at cialug.org
>> http://cialug.org/mailman/listinfo/cialug
>>
> 
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug




More information about the Cialug mailing list