Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: How I run a shell script from the scheduler on 10.2.0.2.0 ?

Re: How I run a shell script from the scheduler on 10.2.0.2.0 ?

From: GovindanK <gkatteri_at_fastmail.fm>
Date: Sat, 8 Sep 2007 07:19:30 UT
Message-Id: <1189235970.23039.1209543817@webmail.messagingengine.com>


Here is an example of using dbms_scheduler on Solaris 5.9 + 10.2.0.2
(the dir below shows 10.2.0 but is at 10.2.0.2 patch level)

BEGIN
  dbms_scheduler.drop_job('exp_erpdb');
END;
/
BEGIN
  dbms_scheduler.create_job(

  job_name        => 'exp_erpdb',
  job_type        => 'EXECUTABLE',
  job_action      => '/home/oracle/scripts/exp_erpdb.sh',
  start_date      => '20-JUN-07 09:00:00 PM',
  end_date        => null,
  repeat_interval => 'freq=daily; byhour=21; byminute=00;',
  job_class       => 'DBAMaintJobs',
  enabled         => FALSE,
  comments        => 'This job creates daily exp logfiles');
END;
/
BEGIN
  dbms_scheduler.enable('exp_erpdb');
END;
/

$ /home/oracle/scripts> ls -l /home/oracle/scripts/exp_erpdb.sh
-rwxr----- 1 oracle dba 1176 Aug 7 20:11
/home/oracle/scripts/exp_erpdb.sh

$ /home/oracle/scripts> more /home/oracle/scripts/exp_erpdb.sh
#!/bin/ksh
. /home/oracle/oracle.env

export ORACLE_HOME=/home/oracle/product/10.2.0 export ORACLE_SID=ERPDB;
export PATH=$PATH:$ORACLE_HOME/bin
export
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/openwin/lib:/usr/dt/lib expdp parfile=/home/oracle/scripts/exp_erpdb.par

$ /home/oracle/product/10.2.0/bin> ls -l |grep ext
-rwxr-x--- 1 oracle dba 28808 Oct 24 2006 extjob
-rwxr-xr-x 1 oracle dba 28496 Feb 20 2006 extjobO
-rwx------ 1 oracle dba 28808 Oct 24 2006 extjobo
-rwxr-xr-x 1 oracle dba 28496 Feb 20 2006 extjoboO
-rwxr-x--x 1 oracle dba 33136 Oct 24 2006 extproc
-rwxr-xr-x 1 oracle dba 26200 Oct 24 2006 extproc32
-rw-r--r-- 1 oracle dba 26252 Jan 9 2006 extproc32O
-rwxr-x--- 1 oracle dba 0 Feb 25 2006 extprocO
-rwxr-xr-x 1 oracle dba 315 Mar 27 2006
extusrupgrade

$ /home/oracle/product/10.2.0/bin> ls -l |grep ext
-rwxr-x--- 1 oracle dba 28808 Oct 24 2006 extjob
-rwxr-xr-x 1 oracle dba 28496 Feb 20 2006 extjobO
-rwx------ 1 oracle dba 28808 Oct 24 2006 extjobo
-rwxr-xr-x 1 oracle dba 28496 Feb 20 2006 extjoboO
-rwxr-x--x 1 oracle dba 33136 Oct 24 2006 extproc
-rwxr-xr-x 1 oracle dba 26200 Oct 24 2006 extproc32
-rw-r--r-- 1 oracle dba 26252 Jan 9 2006 extproc32O
-rwxr-x--- 1 oracle dba 0 Feb 25 2006 extprocO
-rwxr-xr-x 1 oracle dba 315 Mar 27 2006
extusrupgrade
$ /home/oracle/product/10.2.0/bin>

$ /home/oracle/product/10.2.0/rdbms/admin> ls -l |grep extern
-rw-r----- 1 oracle dba 1532 Mar 27 16:55
externaljob.ora
-rw-r----- 1 oracle dba 1534 Dec 22 2005
externaljob_original.ora
$ /home/oracle/product/10.2.0/rdbms/admin> grep = externaljob_original.ora
run_user = nobody
run_group = nobody

$ /home/oracle/product/10.2.0/rdbms/admin>
$ /home/oracle/product/10.2.0/rdbms/admin>
$ /home/oracle/product/10.2.0/rdbms/admin> grep = externaljob.ora
run_user = oracle
run_group = dba
$ /home/oracle/product/10.2.0/rdbms/admin> HTH GovindanK

--

http://www.freelists.org/webpage/oracle-l Received on Sat Sep 08 2007 - 02:19:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US