Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re-attach database with missing .NDF File

Status
Not open for further replies.

nemmeh

Technical User
Jul 7, 2003
30
US
Hey Everyone,

I've got a customer that has gotten himself into a situation. Our software utilizes SQL Server for it's database engine. In every case before, our software only utilizes a single data.mdf and data.ldf file for the SQL database.

Through some form or fashion, this customers seemed to have created a .NDF file in his database set. Not only that but through some method he managed to place that single file onto a usb harddrive attached to his server. I personally think some inexperienced technician was trying to backup the database and just didn't know what they were doing. In either case our software package had been running just fine after this was completed. Sometime in the last few months, the usb drive was detached and the .NDF file deleted. Amazingly though the SQL database remained attached and functioning just fine since there are no "real" data ever stored in the secondary .NDF file. The customer detached the database last night however to make a backup and is now unable to re-attach the database since it is looking for the .NDF.

I've tried the following and haven't been able to get the database to reattach.

1. Created new blank database with same names as the old one.
2. Stopped SQL, renamed new blank database files.
3. Renamed the old ones to back to the original names and started back sql. The database shows up as suspect and I'm unable to access it through any queries or other means.

I've tried to reattach it using the sp_attach_db procedure however I was not successful with that either.

Do any of you know anyway I can reattach the database without the .NDF file? As I've said there is absolutely no data in that table that I need, but I'd certainly love to get the data from the 15GB .MDF file and .LDF files I have.

I'm up for anything, including buying db recovery software if no one has any other ideas.
 
'Fraid you are totally up the proverbial creek if you have lost a data file.
Retrospectively, you would have stood a better chance if the DB was still attached (editing system tables).

Sorry - normally I would say to restore from backup - do they have a single backup with both data files in?
 
Without a good SQL Server backup they are hosed. There is no way to attach a database without all the mdf and ndf files.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

My Blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top