Showing results for 
Search instead for 
Did you mean: 

batch command and oracle jobs

Go to solution
Eileen Millen
Trusted Contributor

batch command and oracle jobs

Does anyone use the batch command with Oracle jobs? Our Financial folks would like some sort of a queue system. Any suggestions
Alexander M. Ermes
Honored Contributor

Re: batch command and oracle jobs

Hi Eileen.
We have a lot of jobs running in background.
We use to start these jobs from the cron as root with a shell script. For sample doing a report we use and within this script we use lines like su - orace -c .......
One problem : if you run these jobs you may show usernames and passwords. Try to hide them in parameter files.
Hope i could help you.
Alexander M. Ermes
.. and all these memories are going to vanish like tears in the rain! final words from Rutger Hauer in "Blade Runner"
Jim Wolff
Occasional Advisor

Re: batch command and oracle jobs

Hi Eileen,

As Alexander mentioned, you can run batch processes as a cron job (and of course you may want to hide the password from appearing in the process list or hardcoding it in your scripts).

One thing you will want to do if you are planning to run processes using a SQL-Plus session is to use the "-s" option until end-of-file as shown in my example below.

# example SQL-Plus script for batch processing

PSWD=`cat /ora0/oracle/passwd/sys`;
export PATH

cat $SIDFILE | while read SID
sqlplus -s sys/$PSWD@$SID <
set linesize 120




#========= end of script ==========

In the above example, I am reading the name of the database from a file called "all_sids" which allows me to run a loop and process the same scripts for all databases listed in the file..

Next, in order to avoid hardcoding the password in the script, I am reading the password from a file on the operating system that I have set to read only by Oracle.

Finally, when I run the sqlplus command, I am feeding in the variables for the password and oracle_sid explained above, then simply executing my scripts as in a normal sqlplus session.

Last, I am running an OS command to archive my output files generated from the sql scripts.

Hope this helps.

Best regards,

jim wolff
Sr. Oracle DBA
Dieter Degrendele_1
Frequent Advisor

Re: batch command and oracle jobs


Also we have some hundreds of batch jobs for our Oracle environments. Because there are so much jobs we decided to use the Enterprise Management module from Computer Associates (

Probably this would help you a bit:

create a unix script that calls some SQL or PL/SQL scripts. Test it and put it in the crontab. Use man crontab for information about use. Sometimes it is great to use the logger command into your unix scripts. Then you can create another script that does a tail -f of /var/adm/syslog/syslog.log and mails all your messages to your email address. Anyhow, this is what we do and it seems to be working for a long time.


Dieter Degrendele
The possible we did, the unpossible we're doing but for a miracle you have to wait some time.