From Oracle version 12.1 it's possible to execute sql scripts (based on the database server SQLPlus environment) using dbms_scheduler API calls. (It’s necessary to define a host credential (in my case oracle linux user), a database credential (for a specific schema) and to write a procedure with a few dbms_scheduler API calls to set up a new sql job executed on the database server using it's SQLPlus environment , with the script source taken - for example - from a client's laptop’s file system or from an another network location. The job is defined and started from a client machine.)
When I execute exactly the same script on my windows laptop (using client SQLPlus) I can set NLS_LANG, before starting sqlplus (for example to something like:
CZECH_CZECH REPUBLIC.AL32UTF8 or
CZECH_CZECH REPUBLIC EE8MSWIN1250) etc. )
Also it’s possible to start ( local ) sqlplus executable in a specific directory where the output (spool files) will be generated.
If I set up a job with dbms_scheduler executed in the SQLPlus environment on the database server (as mentioned before and with the script source taken from local/client filesystem ):
Question 1: is it possible to set before the start of the script on the database server SQL Plus environment the NLS_LANG environment variable in a similar way like it is done in a local ( client) SQLPlus environment ?
(obviously, set is a command in windows environment; I need to do something similar on my database server sqlplus environment i.e. on a linux machine)
Question 2 is it possible to change (before the initiation of the scheduled sqlplus job on the database server SQL Plus environment) the working directory ?
(now i get the script spool output in the directory where init.ora resides)
It could be very useful to be able to use dbms_scheduler jobs for example to initiate long lasting sql scripts (without any modification of the source code) in the database server SQL Plus environment (after working hours /in unattended mode etc.)
Thank You in advance for your answers. (I've already asked a similar question on an Oracle forum but without any answers in the last 2 weeks).
Kind Regards,
user_alex
Share on Twitter