Executing oracle procedure using cronjob


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Executing oracle procedure using cronjob
# 1  
Old 04-19-2011
Executing oracle procedure using cronjob

Hi,

Below is the code to execute the procedure "dbms_job.broken" from the shell script.

on executing manually, it works properly without any error.

but it is not working when scheduled using the cronjob.

Code:
#!/usr/bin/bash

user_name="oracdb"
password="ora123"
tns="localdb"
ORACLE_BASE="/oracle"
ORACLE_HOME="/oracle/v9.0.1"
ORACLE_SID="mydb"
PATH="/oracle/v9.0.1/bin:/usr/bin:"

set `sqlplus -s $user_name/$password@$tns<<EOS
exec dbms_job.broken(118,TRUE);
exit;
EOS`

Why the above script is not working when executed using the cronjob ?

Regards
# 2  
Old 04-19-2011
You are missing something in your environment varaibles, this will show what the problem is:
Code:
set `sqlplus -s $user_name/$password@$tns<<EOS > /full/path/to/my/directory/oracle.log
exec dbms_job.broken(118,TRUE);
exit;
EOS`

Read the log for the error. Why did you use set `command` if there is nothing else in the script? That is, instead of just a here doc. Plus the syntax is "set - `command` ", if I understand what you are doing.
# 3  
Old 04-19-2011
The error messages may actually be in unix mail for the user who owns the crontab.

What is in the file: /full/path/to/my/directory/oracle.log
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Stored Procedure not executing

below code is not executing the stored procedure,not sure what the issue.Even sqllog is blank.please help me its very urgent. sqlplus -s $connect_str@$DB_ORACLE_SID >> ${SQL_LOG_FILE} << EOF set serverout on set feed off set head off set pages 0 set colsep , set tab off set lin 150... (3 Replies)
Discussion started by: katakamvivek
3 Replies

2. Shell Programming and Scripting

SP2-0642 error while executing procedure from shell script

hi all, i have a unix script where i am calling a database procedure from it. while executing the procedure i am getting an error: but when i tried to call the same procedure manually then it ran successfully, i goggled this issue and found timezone.dat file missing at... (0 Replies)
Discussion started by: lovelysethii
0 Replies

3. Shell Programming and Scripting

Processing values from Oracle procedure

Hi all, My oracle procedure returns more than one value. i need to get one value at a time upto ending value ina shell script. Please help me..... (9 Replies)
Discussion started by: pmreddy
9 Replies

4. Programming

Oracle Procedure approach

HI All , I am new to oracle procedures. Please help me for the approach to satify the requirement. I need to create procedures. with parameters passed ( say report,type,identities,country ) It should also call sql query within the procedures and passed parameters should be used in where clause... (2 Replies)
Discussion started by: Perlbaby
2 Replies

5. Shell Programming and Scripting

Executing procedure using script

Hi, I want to have a automted script to exceute 20 procedures one by one. Suppose below is one procedure once it get executed script will write "PL/SQL procedure successfully completed." to a log for ex- exec dbms_stats.gather_table_stats(); Now later procedure starts executing... (1 Reply)
Discussion started by: sv0081493
1 Replies

6. Shell Programming and Scripting

Executing Procedure from shell script..

Hello, I created a sql file to create a Procedure, and it was successfully created. I created a sql file to execute the procedure, and it did without any errors, but i dont see the data been updated. The Execute procedure.sql script is: BEGIN set serveroutput on size 1000000 execute... (5 Replies)
Discussion started by: msrahman
5 Replies

7. UNIX for Dummies Questions & Answers

cronjob not executing...

Hi All. I created a cronjob entry and for some reason it is not executing. The script that it is suppose to call sends me an email when it is done. When I run the job manually it executes fine. This how my cron entry looks: 00 14 * * * /home/oracle/scripts/bin/free_space/free_space.sh 2>$1... (5 Replies)
Discussion started by: shaseeb
5 Replies

8. Shell Programming and Scripting

Oracle procedure is not executing in uix

Hi Guys, I am trying to tun a oracle proedure throgh unix shell script but it is not running i dont know why ? i have tested this procedure in sqlplus and it was working fine. can you see the script and sql file and let me know where is my mistake. script:bm_chart_table_loading.sh ... (3 Replies)
Discussion started by: shary
3 Replies

9. Shell Programming and Scripting

How to execute an Oracle procedure using shell

Hi , i have created an .sh file that has the following code: #!/bin/ksh sqlplus -s p1istuat/p1istuat@CWS_IST6 @Procedure_Execute.sql & sqlplus -s p1istuat/p1istuat@CWS_IST6 << EOF exit EOF The mentioned Procedure_Execute.sql file inside has the following code: exec TEST; ... (5 Replies)
Discussion started by: vins_san
5 Replies

10. UNIX for Advanced & Expert Users

Oracle stored procedure.

I am using sqlplus. I have the stored procedure name. How can i print the stored procedure content? (2 Replies)
Discussion started by: kamil
2 Replies
Login or Register to Ask a Question