SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Restoring a .MDF file
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pug2694328
Posting Yak Master

166 Posts

Posted - 01/04/2007 :  17:26:31  Show Profile  Reply with Quote
We have a third party that sends us a cd containing one MDF and one NDF file.

I'd like to 'restore' these to our server as a database. I don't have the LDF file and will never get it. I'm not sure that I need the NDF file.

Per this string: http://forums.belution.com/en/sql/000/017/79s.shtml

I should be able to create a db on my server with a duplicate name
CREATE DATABASE A006CBCB

, then detach it,
EXEC sp_detach_db 'A006CBCB', 'true'

overwrite the MDF file for my empty DB with the one from the cd,

then reattach the db.
EXEC sp_attach_db @dbname = N'A006CBCB',
@filename1 = N'D:\SQL\DATA\MSSQL\Data\A006CBCB.mdf',
@filename2 = N'D:\SQL\DATA\MSSQL\Data\A006CBCB_log.LDF'

Where I hit the following errors:

Server: Msg 5173, Level 16, State 2, Line 1
Cannot associate files with different databases.

Any thoughts?

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

USA
7020 Posts

Posted - 01/04/2007 :  17:34:11  Show Profile  Reply with Quote
It sound like you are dealing with a "third party" who has no idea what they are doing.

Ask them to send you a SQL Server database backup file.



CODO ERGO SUM
Go to Top of Page

pug2694328
Posting Yak Master

166 Posts

Posted - 01/04/2007 :  18:12:33  Show Profile  Reply with Quote
Yup, that would be ideal, but sadly not going to happen.

The disk is some proprietary stuff they send our clients and expect them to run their install scripts that load the data for some skimpy custom GUI they offer. We're tasked with pulling the underlying data so the data analysis can be automated rather than accessed manually.

So if anyone has some thoughts on restoring the data from just a .mdf, please do tell.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30206 Posts

Posted - 01/04/2007 :  19:37:36  Show Profile  Visit SwePeso's Homepage  Reply with Quote
Why do you think you don't need the .ndf file?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Kristen
Test

United Kingdom
22403 Posts

Posted - 01/05/2007 :  01:02:31  Show Profile  Reply with Quote
Don't you need to use the Single File Attach method if you don't have an LDF file? I'm a bit sketchy on whether that supports NDF files ...

See also: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=single%20file%20attach,sp_attach_single_file_db

Kristen
Go to Top of Page

babaweso
Starting Member

Saudi Arabia
1 Posts

Posted - 08/14/2012 :  10:34:13  Show Profile  Reply with Quote
Just please delete the LDF file thwn normally attach it , it will creat a new onw automaticlly
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000