Toad World® Forums

Automation error "The process cannot access the file because..."


#1

I have an automation script set-up that does a basic query and then exports a text file using an export template.

When clicking the “Test” button to execute the automation script, it successfully executes.

When I schedule the exact same job, it fails with error message “The process cannot access the file…because it is being used by another process.”

The export template is set to overwrite an existing file. The scheduled job will fail regardless if there is or is not an existing file already in the destination folder. On the other hand, it will execute successfully when I manually click the Test button regardless if there’s an existing file or not.

Any suggestions would be greatly appreciated.

Thank you.


#2

Please go to your automation script and change the logging to verbose. Then produce the error and post the log file. I need to see what file it is complaining about .

Debbie


#3

– 3/1/2012 9:20:50 AM: FOP Bad Phone.log: Build started
– 3/1/2012 9:20:52 AM: FOP Bad Phone.log: Activity ‘ExceptionEmail’ validation warning: Text of message body is not specified
– 3/1/2012 9:20:52 AM: FOP Bad Phone.log: Build Completed
– 3/1/2012 9:20:52 AM: FOP Bad Phone.log: Executing default description activity
– 3/1/2012 9:20:52 AM: FOP Bad Phone.log: Connecting to SQLPROD41 (CORP\sara.huls)
– 3/1/2012 9:20:52 AM: FOP Bad Phone.log: Connection To: SQLPROD41 (CORP\sara.huls)
– 3/1/2012 9:20:52 AM: FOP Bad Phone.log: Connection successful
– 3/1/2012 9:20:52 AM: FOP Bad Phone.log: Connection logon:
– 3/1/2012 9:20:52 AM: FOP Bad Phone.log: Last schema: master
– 3/1/2012 9:20:52 AM: FOP Bad Phone.log: Default schema: master
– 3/1/2012 9:20:52 AM: FOP Bad Phone.log: Auto Commit: True
– 3/1/2012 9:20:52 AM: FOP Bad Phone.log: Connection successful.
– 3/1/2012 9:20:52 AM: FOP Bad Phone.log: Beginning export: <Quest.Toad.ImportExport.ExportEngine><![CDATA[
----***********************************************************************************************************
----* This query is used to audit for FOP ‘320-111-1111’ numbers that do not have the ‘bad phone’ indicator set.
----*
----* Must be run against SQLPROD41.
----*
----* The file is written to corp\prodcution\credit\Bad Phone\ where it is automatically picked up and
----* processed against FOP to update the home bad phone indicator field to ‘1’ (means ‘yes’).
----* 1. Be sure the resulting file does not contain ‘messages’ at end of data. This will cause the
----* Batch Bad Phone workflow to abend.
----* 2. The SQL command below should hanlde it automatically, but to manually shut them off:
----* Go to Query, Query Options, Execution, Advanced, SET NOCOUNT to ‘on’.
----*
----***********************************************************************************************************

–SET ANSI_NULLS ON;
–GO
–SET ANSI_WARNINGS OFF;
–GO
–SET NOCOUNT ON;
–GO


–SELECT DISTINCT
– Left(bp.accountnumber,10)
– ,p.areacode + p.prefix + p.suffix as ‘Phone’
---- ,p.prefix
---- ,p.suffix
---- ,pt.Name
---- ,ap.UserXID
---- ,ap.BadPhone
---- ,ds.QueueName
---- ,ds.DunSeries
---- ,ds.GeneratedStatus
---- ,ds.PrimaryAreaCode
---- ,ds.PrimaryPhoneNumber

–FROM

–FOP.dbo.AccountPhone AP
–JOIN FOP.dbo.PhoneType PT on pt.XID = ap.PhoneTypeXID
–JOIN FOP.dbo.Account A on a.XID = ap.AccountXID
–JOIN FOP.dbo.Phone P on p.xid = ap.phonexid
---- Note: must join to bsegment_primary. Using FOP.Account will return more accounts that don’t
---- that never had orders.
–JOIN CoreIssue.dbo.bsegment_Primary BP on bp.AccountNumber = a.AccountCode

----left join CoreIssue.dbo.fhtDialerSplit ds on ds.CustomerNumber = bp.AccountNumber

–WHERE
----ds.PrimaryAreaCode is null
----and ds.PrimaryPhoneNumber is null
– ap.badphone <> ‘1’
– and pt.name = ‘primary’
– and p.areacode = ‘320’
– and p.prefix = ‘111’
– and p.suffix = ‘1111’

–]]></Quest.Toad.ImportExport.ExportEngine>
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Export Started [3/1/2012 9:20:52 AM]
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) ** START 3/1/2012 9:20:52 AM
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Export Wizard: Building object list
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Build List 3/1/2012 9:20:52 AM
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Exporting Data
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:52 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (20) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (20) InternalReadBackground - after ExecuteReader - command --***********************************************************************************************************
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (22) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (22) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished with error: The process cannot access the file ‘H:\TOAD\Export Files\badphone.txt’ because it is being used by another process.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: at System.IO.StreamWriter.CreateFile(String path, Boolean append)
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: at System.IO.StreamWriter…ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: at System.IO.StreamWriter…ctor(String path, Boolean append, Encoding encoding)
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: at Quest.Toad.ImportExport.Writers.WriterBase.InitializeStream()
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: at Quest.Toad.ImportExport.ExportObjectData.InitializeWriter(Object context)
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: at Quest.Toad.ImportExport.ExportObjectData.StartBackgroundAdapter(Dictionary2 connections, Object context) -- 3/1/2012 9:29:36 AM: FOP Bad Phone.log: at Quest.Toad.ImportExport.ExportObjectData.Begin(LogEventHandler logEventHandler, Dictionary2 connections, Object context)
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (20) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (20) InternalReadBackground - after ExecuteReader - command --*
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (15) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (15) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (23) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (23) InternalReadBackground - after ExecuteReader - command --* Must be run against SQLPROD41.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (24) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (24) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (25) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (25) InternalReadBackground - after ExecuteReader - command --*
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (27) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (27) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (28) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (28) InternalReadBackground - after ExecuteReader - command --* The file is written to corp\prodcution\credit\Bad Phone\ where it is automatically picked up and
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (29) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (29) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (30) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (30) InternalReadBackground - after ExecuteReader - command --* processed against FOP to update the home bad phone indicator field to ‘1’ (means ‘yes’).
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (31) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (31) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (32) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (32) InternalReadBackground - after ExecuteReader - command --* 1. Be sure the resulting file does not contain ‘messages’ at end of data. This will cause the
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (33) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (33) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (34) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (34) InternalReadBackground - after ExecuteReader - command --* Batch Bad Phone workflow to abend.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (35) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (35) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (36) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (36) InternalReadBackground - after ExecuteReader - command --* 2. The SQL command below should hanlde it automatically, but to manually shut them off:
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (37) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (37) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (38) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (38) InternalReadBackground - after ExecuteReader - command --* Go to Query, Query Options, Execution, Advanced, SET NOCOUNT to ‘on’.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (39) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (39) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (40) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (40) InternalReadBackground - after ExecuteReader - command --*
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (41) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (41) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (42) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (42) InternalReadBackground - after ExecuteReader - command --***********************************************************************************************************
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (44) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (44) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (45) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (45) InternalReadBackground - after ExecuteReader - command SET ANSI_NULLS ON;
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (46) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (46) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (47) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (47) InternalReadBackground - after ExecuteReader - command SET ANSI_WARNINGS OFF;
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (48) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (48) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (49) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (49) InternalReadBackground - after ExecuteReader - command SET NOCOUNT ON;
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (50) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (50) DoneReadThreadWriter finally - adapter.RowsRead 0
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) BEGIN 3/1/2012 9:20:53 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query started.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (51) InternalReadBackground - start
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (51) InternalReadBackground - after ExecuteReader - command SELECT DISTINCT
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Left(bp.accountnumber,10)
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: ,p.areacode + p.prefix + p.suffix as ‘Phone’
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: – ,p.prefix
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: – ,p.suffix
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: – ,pt.Name
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: – ,ap.UserXID
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: – ,ap.BadPhone
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: – ,ds.QueueName
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: – ,ds.DunSeries
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: – ,ds.GeneratedStatus
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: – ,ds.PrimaryAreaCode
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: – ,ds.PrimaryPhoneNumber
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: FROM
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: FOP.dbo.AccountPhone AP
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: JOIN FOP.dbo.PhoneType PT on pt.XID = ap.PhoneTypeXID
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: JOIN FOP.dbo.Account A on a.XID = ap.AccountXID
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: JOIN FOP.dbo.Phone P on p.xid = ap.phonexid
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: – Note: must join to bsegment_primary. Using FOP.Account will return more accounts that don’t
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: – that never had orders.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: JOIN CoreIssue.dbo.bsegment_Primary BP on bp.AccountNumber = a.AccountCode
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: --left join CoreIssue.dbo.fhtDialerSplit ds on ds.CustomerNumber = bp.AccountNumber
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: WHERE
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: --ds.PrimaryAreaCode is null
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: --and ds.PrimaryPhoneNumber is null
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: ap.badphone <> ‘1’
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: and pt.name = ‘primary’
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: and p.areacode = ‘320’
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: and p.prefix = ‘111’
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: and p.suffix = ‘1111’
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (13) DoneReadTreadWriter
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (13) Writing rows 1 - 128
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (13) Writing rows Finalize
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (13) DoneReadThreadWriter finally - adapter.RowsRead 128
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) END 3/1/2012 9:29:36 AM : Query
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Object SQL Query finished.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Export Finished [3/1/2012 9:29:36 AM]
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Build Time 00:00:00.1250024
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) Complete Time 00:08:43.6350536
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Thread (10) ** END 3/1/2012 9:29:36 AM
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Attempted export 128 rows.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Successfully exported 128 rows.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Export Finished, click badphone.txt to view file.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: The process cannot access the file ‘H:\TOAD\Export Files\badphone.txt’ because it is being used by another process.
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: at Quest.Toad.Workflow.Activities.Database.ExportWizardActivity.Execute(ActivityExecutionContext executionContext)
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Start error email
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Email To: sara.huls@bluestembrands.com, From: sara.huls@bluestembrands.com, cc:
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Email Subject: Error FOP Bad Phone Automation Script Error
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Generating exception Email
– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Email message:

–Automation script “FOP Bad Phone” had errors while executing. The exception messages are listed below and the log file is attached.

–Continue on Error Exception Messages:
–Exception Messages:
–The process cannot access the file ‘H:\TOAD\Export Files\badphone.txt’ because it is being used by another process.

– 3/1/2012 9:29:36 AM: FOP Bad Phone.log: Setting up SMTP email


#4

So it is the file that we are exporting to. Does it happen every time you run the scheduled job? Can you try exporting to local file and then copy to the network at the end of the job? Something is causing a problem on closing the file.

Debbie


#5

I greatly appreciate your help Debbie. Thank you!

I tried exporting the file to my local harddrive…same results.

When manually clicking “Test” button is successfully completes, it errors when it’s scheduled.

Any other ideas?


#6

Try taking out all of your comments in and above your SQL statement. It seems to be taking each comment and trying to process it like an export, which normally would be harmless unless it is leaving this file open.

Debbie


#7

Removed all the comments, same error message when it’s scheduled.

And again, manually clicking the test button it runs fine. Just weird…


#8

Did you take out this part too and take out the blank lines?
–SET ANSI_NULLS ON;
–GO
–SET ANSI_WARNINGS OFF;
–GO
–SET NOCOUNT ON;
–GO

Take out all and then run in verbose logging mode and send the log file to me. dpeabody@quest.com.

Debbie


#9

Debbie - I played around with the automated job a bit more. If I export to an Excel file, the scheduled job runs just fine. But as soon as I change it back to the text file, it errors.

I need the export file to be text. Do you know of any issues/work arounds dealing with text files?


#10

I took out that last portion and all the blanks and it seems to be working now! :slight_smile:

Thank you so very much for all your help!!


#11

Yay


#12

Hi,

I have exactely the same issue with a MySql statement (works in test, crash in schedelud tasks)

You last quote “I took out that last portion and all the blanks and it seems to be working now! :)” give me the hint to find where the problem was.

My Statement begin with :
SET @Maintenant = UTC_TIMESTAMP();
SELECT…

and when I watch the log in verbose mode I see that Toad try to write already after set SET and then when it want to write the result of the SELECT the file was already open !

I remove the SET and replace directely @Maintenant by UTC_TIMESTAMP()
but for me it’s more a workaround.

How can I code this SET so that it works ?


#13

Hi,

I have exactely the same issue with a MySql statement (works in test, crash in schedelud tasks)

Youlast quote “I took out that last portion and all the blanks and it seems to be working now! :)” give me the hint to find where the problemwas.

My Statement begin with :
SET @Maintenant = UTC_TIMESTAMP();
SELECT…

and when I watch the log in verbose mode I see that Toad try to write already after set SET and then when it want to write the result of the SELECT the file was already open !

I remove the SET and replace directely @Maintenant by UTC_TIMESTAMP()
but for me it’s more a workaround.

How can I code this SET so that it works ?


#14

The SET statement is setting the value of a bind variable that you are using in your select statement somewhere. Instead of using set statement, add a ‘Set Variable’ automation activity. Use the same name and set the value there.

See this post for sample code and example.

http://toadformysql.com/thread.jspa?threadID=38619

Debbie