A blog about SQL Server, SSIS, C# and whatever else I happen to be dealing with in my professional life.

Find ramblings

Monday, April 22, 2013

File in use by another process

There's nothing quite so delightful as getting error messages that don't provide enough information to resolve the base problem. Case in point, I went to run an SSIS package which in 2012 requires a rebuild of the .ispac and received the following error message.

System.IO.IOException: The process cannot access the file 'C:\Src\DataWarehouse\bin\Development\DataWarehouse.ispac' because it is being used by another process.

What is the other process? I've seen people resort to a reboot because they can't figure out what process has their grubby finger on the file but that is overkill. All you really need is the free utility "Process Explorer" from Microsoft/Sysinternals.

Download or simply run from the website (but you'll want to do download it and keep it as part of your troubleshooting kit) and once it pops up, under the Find menu, select "Find Handle or DLL..." Ctrl-F



In the resulting window, simply search for the file that is being reported as locked.



Here, I searched for the .ispac extension and discovered that a DtsDebugHost.exe still had the .ispac file open. In this specific example, that tells me I should check my Visual Studio instances as that'd be the process that launched DtsDebugHost. That was my instinct however and I had no instances of VS/SSDT/BIDS running so I chalked it up to a zombie process and just killed the process.

You can then simply double click on the line with the Process and observe that the underlying process list will find the offending PID (9388). In the resulting window, right click on the process line and select Kill

1 comment:

Boris Hristov said...

Yeah, it's crazy! I can agree with you that reboots are issued because of this problem - I have also seen them. Another way to handle it is to download handle.exe (if you do not want to download the whole Process Explorer) and check with it what is the process that is still working with your file (/s) -> http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx