Through Shell script in Unix, How can you run the Oracle procedure?

Questions by ddkdhar   answers by ddkdhar

Showing Answers 1 - 6 of 6 Answers

srinsr

  • Mar 14th, 2007
 

$ORACLE_SQLPLUS -s $TCS_ORACLE_ID > $ORALOG 2>&1 <<EOF
set serveroutput on
set heading off
set feedback off
set verify off
set linesize 250
set pagesize 0
set termout off
exec solpk_upd_tcash ( '$SRC_SYS_CD', '$Date');
commit;
quit;
EOF

  Was this answer useful?  Yes

To execute sqlplus via Unix shell scripts the following parameters need to be initialized.

(1.) ORACLE_HOME

export ORACLE_HOME=Path to <ORACLE_HOME>

(2.) ORACLE_SID

export ORACLE_SID=Actual ORACLE_SID

After these initializations have been done use sqlplus -v to login into the database non interactively and execute the SQL or PL/SQL Code.

sqlplus -v ${USERNAME}/${PASSWORD}@${ORACLE_SID} << EOF
@mysqlfile.sql
EOF


This is the basic mechanism for invoking sqlplus via unix in a non interactive way. We need to add error handling mechanism and other Oracle options for this to execute without any issues in cron.

-Sagi

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions