none
The process cannot access the file it is being used by another process.

    Question

  • I have a File System Task Copy file operation to copy a file in an SSIS package.  The package when scheduled as a job fails with the following error:

    The process cannot access the file 'C:\ETL\Consignment\Apple\AppleRawFile.txt' because it is being used by another process.".

    However when I right click on the package and execute it manually from the Integration Services it runs successfully without any problem.  I am not certain on how to resolve this issue any inputs will be much appreciated.

    Thanks,

    Monisha

    Thursday, August 24, 2006 4:53 PM

Answers

  • FileMon will tell you what is using the file.

    -Jamie

     

    Friday, August 25, 2006 5:19 AM
    Moderator
  •  erwin732 wrote:

    Hi guys, has someone provided solution for this? I'm also encountering the same error but with a File System task that deletes a file. Thanks.

     

    Erwin



    Look at the FileMon utility that Jamie posted a link to above.  I didn't test the link, but you can search the 'Net for "FileMon" and you'll find it.

    Some other process is holding on to that file and causing you issues.  FileMon will help you determine what that process is.
    Monday, October 22, 2007 1:56 AM
    Moderator

All replies

  • I had this problem and it was very silly.

    when i checked the Task manager the texr file i was trying to access was still hanging out for some reason. When i ran the  package previously it was trying to write into the file andwas hanging. After i deleted from the task manager. it worked!!!!!

    Jas

    Thursday, August 24, 2006 10:37 PM
  • I know for certain that the text file in question was not open / running and I do not see it as an application in the task manager. 

    Also the run package completes sucessfully when run immediately, however this problem with the job persists day after day.  Where in it fails with the "The process cannot access the file it is being used by another process" error message.

    Any further inputs will be appreciated.

    Thanks.

    Thursday, August 24, 2006 10:46 PM
  • FileMon will tell you what is using the file.

    -Jamie

     

    Friday, August 25, 2006 5:19 AM
    Moderator
  • The job failed again this morning and the error in the log file is as follows:

    User:OnError,WEB-INTETL,NT AUTHORITY\SYSTEM,Copy to Raw file,{E59D4D04-64D8-475A-8FE0-40B1B9EADE98},{7269CA76-D1A2-4200-BE18-15A75B3076C5},8/25/2006 9:26:36 AM,8/25/2006 9:26:36 AM,-1073548540,0x,An error occurred with the following error message: "The process cannot access the file 'C:\ETL\Consignment\Apple\AppleRawFile.txt' because it is being used by another process.".

    However when I used FileMon to check if the file is being used by some other process it does not show that the specific file in question is used by some other process.

    Any further input will be much appreciated.  The same job used to run perfectly on another SQL Server 2005 instance, the problem started happening once we moved it to the new SQL Server 2005 box.  Again it runs perfectly when executed manually right after it failed as a job.

    Thanks,

    Monisha

    Friday, August 25, 2006 4:33 PM
  • Hi guys, has someone provided solution for this? I'm also encountering the same error but with a File System task that deletes a file. Thanks.

     

    Erwin

    Monday, October 22, 2007 1:44 AM
  •  erwin732 wrote:

    Hi guys, has someone provided solution for this? I'm also encountering the same error but with a File System task that deletes a file. Thanks.

     

    Erwin



    Look at the FileMon utility that Jamie posted a link to above.  I didn't test the link, but you can search the 'Net for "FileMon" and you'll find it.

    Some other process is holding on to that file and causing you issues.  FileMon will help you determine what that process is.
    Monday, October 22, 2007 1:56 AM
    Moderator
  • Thanks Phil. I found the process holding the file.

    Monday, October 22, 2007 4:38 AM
  • I'm having an issue with the cannot access file during a File System Task.  I'm basically renaming the file to a an archive location after the source file is finished beign processed.  I use the rename operation of the Fiel System Task to accomplish this move.  I'm renaming the file by adding the date the file was processed to the filename. I'm using variable for the source and destination directories. It had all been working fine until "Something" changed.  I'm using Filemon and it indicates the file I'm trying to rename is Not Found.  The path displayed in filemon is the correct path to write the file to.  any suggestions?

     

    Phil K

    Thursday, December 13, 2007 11:13 PM
  • Try using FileMon to check the file you are copying from - that's the one that is locked.

     

    Thursday, December 13, 2007 11:50 PM
    Moderator
  • Yes, I used filemon and the file is being used by the dtsDebugHost process but it's not releasing the file after the data flow completes.  I changed the File System Task to a Script task and used the VB Filesystem methods to move the file around and it fails but not always.  It reports "the process cannot access the file because it is being used by another process".  For some reason I can't determine, the prior data flow task is not releasing the file for every iteration of the files in in the For Each loop.  The same behavior occurs for File system Task and a Script task attempting the same operation.  The files being accessed are Excel Files.  Is there a difference access method to the files available? 

    Friday, December 14, 2007 11:25 PM
  •  

    Based on the lack of response, I guess this must be a stumper and needs to be addressed with Microsoft support.
    Monday, December 17, 2007 7:57 PM
  •  pkdenver wrote:

     

    Based on the lack of response, I guess this must be a stumper and needs to be addressed with Microsoft support.

     

    I'd attribute the lack of a response to the fact that two replies earlier in the thread have already been marked as answers. There are enough posts in this forum that I (and I assume that other folks who answer questions here may do something similar) generally filter to only view unanswered questions, primarily so I can focus on helping people who ask for it. Posting a new question to an already "closed" thread can make it invisible unless people are actively looking at already answered posts.

     

    (With that said, I personally have no idea what could be causing the problem )

    Monday, December 17, 2007 8:30 PM
    Moderator
  • Okay.. makes sense.  I thought I was being efficient by not creating a new thread to a previous topic.  Thanks for the response.

     

    Monday, December 17, 2007 8:33 PM
  •  pkdenver wrote:
    Okay.. makes sense.  I thought I was being efficient by not creating a new thread to a previous topic.  Thanks for the response.

     

     

    No worries! It could very well be that it's me that is using the forums incorrectly and "hiding" valid questions from myself. With that said, one thing that I see done commonly is people posting new threads for their problems with links to previous threads that have similar or related problems to bring in the context of the existing thread while still having a dedicated thread in which to track their own unique issues.

    Monday, December 17, 2007 8:39 PM
    Moderator
  • Hi Jamie,

    Filemon is replaced by Procmon.
    I am able to see which process using my file(eg:explorer.exe). How can I kill that reading process ? I did not find any option relavent to kill the process when I right click on that file in procmon. Could you help me to resolve this.

    Thanks.
    Friday, July 10, 2009 2:48 PM
  • I find the process(explorer.exe) whats reading my file. How can I kill it using procmon.

    Thanks.

    Friday, July 10, 2009 2:54 PM
  • Hello

    Solution was to go to task manager and delete the program responsible for using the resource, for me the site was not willing to start in IIS, program was dsdomain.

    Smiles

     


    Momo
    Thursday, November 18, 2010 4:09 PM