Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 problems while attaching DB

Author  Topic 

bangaarm
Starting Member

2 Posts

Posted - 2005-10-30 : 12:36:38
Hi,
This is regarding SQL2k. As my disk space has run out of space, i had pointed my database 'SD' to another MDF file in a different drive. That is the frist mdf file was on F drive and i had added another MDF file in E drive.Everything was fine. By mistake my collegue has deleted the MDF files on E drive while the SQL server is down.
And when we restarted the SQL server, the SD database has gone into Suspect mode. The we detached the database. And when we are trying to attach the database using the firs MDF file from Enterprise manager, it shows all the two mdf files and is unable to attach saying that cannot read the MDF file on E drive . I tried on Query analyzer also using sp_attach_db, here also i get that the physical name is incorret on E drive.

Please help me, it is my production server and i am down from last 3 hours, i had tried all the options and this forum too.

How to deselect a particular MDF file during attach of a database?

rgds,
bangaarm

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-10-30 : 14:23:27
If you had multiple .mdf files, you don't, If that's the case, you better have backups. If you don't have backups, you screwed this up, and it's your production server, someone will probably be looking for a new job tomorrow. Hopefully, it won't be the whole company.



MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

paulrandal
Yak with Vast SQL Skills

899 Posts

Posted - 2005-10-31 : 13:39:30
You can't. The database will not start without the deleted MDF file. Either you restore from your backups or you've irretrievably lost the whole database.

There is no workaround or way to recover any of the data without interpreting the database structures manually in a hex-editor.

Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
(Legalese: This posting is provided "AS IS" with no warranties, and confers no rights.)
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-10-31 : 14:10:54
quote:

There is no workaround or way to recover any of the data without interpreting the database structures manually in a hex-editor.



That would be a fun exercise. Got any docs on it.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

SQLServerDBA_Dan
Aged Yak Warrior

752 Posts

Posted - 2005-10-31 : 14:36:27
quote:
Originally posted by derrickleggett

When life gives you a lemon, fire the DBA.



Yup. Looks like life handed out a big lemon for their boss.

Hope you guys have a recent backup.

Although you know there is one other thing you could try:

[url]http://www.google.com/search?hl=en&lr=&q=undelete[/url]

MAKE SURE YOU DO NOT MODIFY THE E: DRIVE WHATSOEVER!!!! If you do the deleted files could be overwritten.

I have used undelete software in the past for different clients and it has saved them days, weeks, or even months worth of work. I don't remember the exact one that I used. There are demo's out there so try um out. There is one that is pretty good and allows you to go through and select the files from the directory and also where to restore them to. Some only allow you to choose a folder to restore...
Go to Top of Page

bangaarm
Starting Member

2 Posts

Posted - 2005-10-31 : 17:40:15
Hi,

I have the first MDF file on F drive. It is safe and a backup is also available. The new MDF file created on E drive was deleted. It has only 5-10 MB of data. No problem even i loose that 10mb of data.
But How to deselect the particular MDF file(of E drive) during attach of a database?

At present we created a new database and production is going on it. But i require that database as all my reporting is stuck up, it is becoming a client issue. Can i create a new database and attach the MDF file of F drive, will that work?
Go to Top of Page
   

- Advertisement -