Toad World® Forums

Issue exporting to .txt when passing Oracle Security parameters in query


#1

I’ve got a export, that works fine, when run manually. When I run it via automation, it gives me an error saying that the output file is already in use. I’ve seen similar posts here, but can’t resolve it for my situation.

The automation works if I export to Access, but takes 5 times a long, as outputting to a text file.

I really want to figure out a way to export to txt using the query, can someone help me out? below are security parameters that I have to add to my query to retrieve data. I believe the automation is trying to write to the same output for each line, the two security parameters, and the main query.

thanks in advance.

BEGIN mo_global.set_policy_context(‘S’,83); END;
alter session set current_schema=APPS;


#2

File in use has nothing to do with your query or Oracle permissions. It is saying that the txt file that you are trying to write to is currently being used by someone/something else and the operating system is preventing the automation from writing to it. This could be from a user having it open, or as I have found on occasion, it’s being used by our virus scanning software. Either way it’s a file level issue and not a database issue.


#3

Hey John,

I can’t say it has nothing to do with. There’s no other process using the file, it’s all the automation export process. When I selected an output with a unique timestamp, including seconds, I get the same thing. There are three main sections, two lines of the Oracle security parameters and the actual query. When I review the log detail, it confirms that the first security parameter writes zero lines to the .txt file, the error occurs after that, because the next two sections return the same error, that the file is in use.

Again the exact same query, run manually works fine.

That’s the issue I’m having, let me know if what I’m saying doesn’t make sense or you need more info.

I really appreciate the help, I’d love to execute this query efficiently, writing to .txt.

Thanks,