Solved

Problem with attaching to a database with SQL Server

Posted on 2006-11-25
3
336 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
3 Comments
 
LVL 142

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Select - Help with CASE 4 42
Syntax Error in Query 7 30
SQL Query 34 80
What logic to build in order to get a weekly reminder 9 38
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now