Groups | Blog | Home
all groups > sql server clients > april 2005 >

sql server clients : help needed for Recovring database


Farhan
4/30/2005 7:23:03 AM
I wanted to move my database log file to another drive, but unfortunately I
executed wrong command .

alter database ABC modify file
(name = 'ABC_log',filename= 'D:\Program Files\Microsoft SQL
Server\MSSQL\data\ABC_log.LDF')

instead of

alter database ABC2 modify file
(name = 'ABC2_log',filename= 'D:\Program Files\Microsoft SQL
Server\MSSQL\data\ABC2_log.LDF')


After this, I found my database in Suspect mode, so I executed these commands

sp_configure 'allow updates', 1
GO
RECONFIGURE WITH OVERRIDE
GO

EXEC sp_resetstatus 'ABC2'

And restarted DB services, but database was still in suspect mode, after
checking every possibility, I detached that database, I don’t know why I did
this.

But now I am not able to attach database back. When I try doing this it’s
give me following error

Error 5173: Cannot associate files with different databases.

By the way when I attach this mdf file, it changes the logical file name to
ABC_Data.mdf

But when I execute following query, it displays different logical file name
with ABC.mdf

dbcc checkprimaryfile (N'D:\Program Files\Microsoft SQL
Server\MSSQL\Data\ABC2.mdf', 3)

I believe if I change this logical file name I’ll be able to attach database
back.

Kindly help me the recovering database.

Note: I do not have the transaction log backup & current DB backup.

Farhan Iqbal
ykchakri
5/1/2005 8:16:41 AM
Error 5173 means, you are trying to attach files that belong to another
database. Check the file names that you are using for your attach.

[quoted text, click to view]

AddThis Social Bookmark Button