Solved

Problem with attaching to a database with SQL Server

Posted on 2006-11-25
3
338 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
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.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

733 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