Solved

Problem with attaching to a database with SQL Server

Posted on 2006-11-25
3
340 Views
Last Modified: 2008-02-26
Hi,

I tried to attach a MDF database file that was attched before to SQL Server.
but Sql server displays the Error 5123, which says that other process uses the MDF file.
I tried to restart my computer, but the problem is still exist.

Please tell me how to fix it.

Thanks
Michael
0
Comment
Question by:MichaelMarom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18012477
>I tried to attach a MDF database file that was attched before to SQL Server.
if that database is still attached to a server, you cannot attach it again.
you have first to detach it from that server, and then you can copy it.
if you have problems identifying which server it is attached to, connect to each instance, and run for each database the query
select * from sysfiles
until you found the database for this file.

note that best practice is to attach not only the mdf, but also the accompagning ldf together with the mdf.

0
 

Author Comment

by:MichaelMarom
ID: 18012531
Hi angleIII,

Thanks for your answer.

I mean that, I tried to reattach the the MDF file, after I have detach it.

My problem is that, there is any process, that I don't know what is it, that uses the MDF file, and prevents me to reattach this file.
The problem is still exist, also, when I try to restart my computer.
Please tell me how to fix it.


Michael
0
 
LVL 28

Accepted Solution

by:
imran_fast earned 50 total points
ID: 18013683
hi Micheal,
Try creating copy of that mdf and attach that.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question