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)
 Error on attaching database to the server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-12-16 : 09:22:12
navid writes "On attaching a database file I'm getting an error (SQL-DMO SQLState 42000), Error 5173 Cannot associate files with different databases. Could not open new database. Create database is aborted. Log file does not match with the primary file.

Pls guide what should I do to attach the database."

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-12-16 : 12:18:55
It sounds like you are trying to attach a database with a MDF file from one database and a LDF file from another database. Just use sp_attach_single_file_db instead if you don't need the info from the LDF file.

Tara
Go to Top of Page

navid
Starting Member

1 Post

Posted - 2003-12-19 : 07:56:43
Getting same error even on using the stored procedure sp_attach_single_file_db. There is no LDF file but still same error appears.

navid
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2003-12-19 : 11:45:33
Attach the script you're using. Also, do you have another database you have restored from the same backup? (for example, I'm restoring from db1 on one server to db1 and db1_copy2 on a second server)

MeanOldDBA
derrickleggett@hotmail.com

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

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-12-19 : 12:11:17
Does the database already exist on the server where you are attaching the database? If you've got an LDF in the data directory, then delete it so that SQL Server can create a new one for you.

Tara
Go to Top of Page
   

- Advertisement -