Friday, March 9, 2012

ERROR 5120

I tried attach/detach approach to migrate sql server 2000 databases to sql 2005. I installed a fresh copy of sql server 2005 on windows 2003 server. I could move most of my databases except one. While attaching the database to the sql 2005 I got the following error:

Unable to oen "c:\program files\microsoftSQL server \MSSQL.1\MSSQL\DATA\mydb_log.ldf". operating system error 32:" 32(the process cannot access the file because it is being used by another process)". microsoft SQL server, error:5120)

You must be attaching the wrong file (one being used by another database).|||

I have a similar problem with the same error:

1) Detached MyDb.mdf (and .ldf) (Auto close = True)

2) copied MyDb.mdf and MyDb.ldf to a different folder

3) Re-attached MyDb from original location

4) Renamed copy to MyDbX.mdf and MyDbX.ldf

5) Attach copy (MyDbX.mdf), and in attach dialog change "Attach As" column to MyDbX

= Error 5120

Problem was the rename at step 4. Without this step the attach works OK, with step 5 renaming the database.

Without going back to check, I think step 4 was ok in SQL 2000 EM.

No comments:

Post a Comment