Link to home
Start Free TrialLog in
Avatar of andreni78
andreni78

asked on

migrating database with error 5173: cannot associate files with different databases

I want to migrate my database to another server
here is my steps:

detach database
copy the mdf file to the new server (without copy the ldf file)
create a new db in the new server with the same name of my original db
detach new db
replace the new mdf file with the original mdf file
but I got the message: error 5173: cannot associate files with different databases
So many thanks for your help
Avatar of David Todd
David Todd
Flag of New Zealand image

Hi,

Why don't you attach the copied mdf file as a new database?

Steps
Detach database
copy mdf file - you don't explain why you are not copying the ldf file
attach mdf file as new database

HTH
  David

>detach database
ok

>copy the mdf file to the new server (without copy the ldf file)
why without the .ldf file. that one should go along also!

>create a new db in the new server with the same name of my original db
not needed
>detach new db
hence not needed

>replace the new mdf file with the original mdf file
that is now the problem, as the .ldf and the .mdf are not of the same database, hence the error


correct procedure:

detach db
copy mdf (and ldf) file
attach db

during the attach db, you can specify only the .mdf file if you only copied the .mdf file, and it will recreate a new .ldf file for you, but eventually at a location you don't want it to be...
SOLUTION
Avatar of Hemantgiri S. Goswami
Hemantgiri S. Goswami
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of andreni78
andreni78

ASKER

yes, the log file is huge, about 19GB
Hi,
what is the recovery model of the database?
Why don't you shrink the log file and then copy it over the network using robocopy or xcopy!!

Regards
I migrate from one between hosting server, in different countries, the internet speed is about 30KB/s so it will take a very long time to move log file
is there any way  to attach mdf file without the ldf file
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial