Toad World® Forums

The process cannot access the file because it is being used by another process issue with more than script running simultaneously

I’m using toad for data analysts in running automation scripts to receive reports by mail and I schedule it to be running at same time about 5 toad automation scripts

Simply the script has 2 components which are export to excel and send mail and some of reports are getting similar to this error

The process cannot access the file ‘C:\Users\Server_User\Desktop\toadpro\Toad Exports\exporeportp\FXffvy-Report–2016-12-31 13-00-44.csv’ because it is being used by another process.

So do anyone has a way to resolve this issue

Are each of your scripts using the same file name (without the timestamp part) in the process somewhere? Because if the base part of the name is the same and they both start writing to the file in the same second this will happen. If the files do not have the same content, give them different base names. If the content is the same, don’t run it 5 times, run it once and copy or email 5 times.

I would also suggest to stagger the scripts. While TDP does run multiple copies of itself there still can be file contention as Greg suggests