Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem with attaching to a database with SQL Server

Posted on 2006-11-25
3
Medium Priority
?
342 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 200 total points
ID: 18013683
hi Micheal,
Try creating copy of that mdf and attach that.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

705 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