Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an MDF file that is being held open by another computer.

The MDF file sits on a shared folder and the server that normally holds the MDF file open is shut down.

However, when I attempt to open the file using another server I get a sharing violation error.

I cannot turn the first server on again so somehow I need to forcably close the connection to the database so the new server can open it.

Any thoughts?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Restart the machine hosting the share, or even just stop (and then recreate) the shared folder.

share|improve this answer
    
Shut down the new server and started it again. Somehow, no idea how, but it was holding the file open. Might have double clicked on it or something I don't know. Thanks for answer, pointed me in right direction. –  griegs Apr 18 '11 at 0:44
add comment

The more delicate approach might be to run the computer management console (i.e. compmgmt.msc ) on the server sharing out the file and look in shared folders->sessions or shared folders->open files. Here you can select the offending file being shared out and close it, without having to reboot, or closing other sessions the other server may need.

Of course, this probably requires more effort, so blunt instruments are sometimes the best! so rebooting works well too.

Also why are you sharing out mdf files over cifs/smb? Its supported in sql server 2008 r2, but there are big performance implications.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.