Procedure to be executed from shell scripts


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Procedure to be executed from shell scripts
# 1  
Old 12-14-2012
Procedure to be executed from shell scripts

Hi,

I am looking for a script wherein i will be able to execute below procedures one by one in line and next procedures starts only when the previous one completes and also after execution of each procedure i will be getting a automted mail as "PL/SQL PROCEDURE SUCCESSFULLY EXCETUTED".

Quote:
exec dbms_stats.gather_table_stats(' ',' ');
exec dbms_stats.gather_table_stats(' ',' ');
exec dbms_stats.gather_table_stats(' ',' ');
exec dbms_stats.gather_table_stats(' ',' ');
exec dbms_stats.gather_table_stats(' ',' ');
exec dbms_stats.gather_table_stats(' ',' ');
exec dbms_stats.gather_table_stats(' ',' ');
analyze table TEMP estimate statistics;
analyze table TEMP estimate statistics;
exec dbms_stats.gather_table_stats('','');
Could you please help...
# 2  
Old 12-14-2012
This is pl/sql for sending email:
Code:
 mail_conn  utl_smtp.connection;
  mailhost   varchar2(64) := 'smtp.my.com';
 sender     varchar2(64) := 'somebody@my.com';
 mail_conn := utl_smtp.open_connection(mailhost);
 utl_smtp.helo(mail_conn, mailhost);
 utl_smtp.mail(mail_conn, sender);
 utl_smtp.rcpt(mail_conn, :Email_Address);
 utl_smtp.open_data(mail_conn);
 utl_smtp.write_data(mail_conn, 'From: [somebody]'||utl_tcp.CRLF);
 utl_smtp.write_data(mail_conn, 'To: sv0081493'||utl_tcp.CRLF);
 utl_smtp.write_data(mail_conn, 'Subject: Completed [step name goes here]'||utl_tcp.CRLF);
 utl_smtp.write_data(mail_conn, 'Step blah blah completed'||chr(13));
 utl_smtp.close_data(mail_conn);
 utl_smtp.quit(mail_conn);

* get help from your syadmin for the red part

Make that a procedure that you call between every step

Code:
whenever sqlerror exit 1;
whenever oserror  exit 88;
exec dbms_stats.gather_table_stats(' ',' ');
myprocedure('Step 1 Complete');
exec dbms_stats.gather_table_stats(' ',' ');
myprocedure('Step 2 Complete');

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

When were all scripts on the Solaris server last executed?

Hi All, I am new to this forum and I am hoping someone will be able to help me:) I have inherited a very old Solaris server that has a number of scripts around 500 in total. I need to migrate the scripts to Linux but I would like to know which ones are currently being executed rather... (10 Replies)
Discussion started by: josamy
10 Replies

2. Shell Programming and Scripting

Multiple shell scripts executed in one script

Hi every one, i am new to shell script. my people given a task to write a shell script that should execute number of shell scripts in that. in that, if any shell script is failed to execute, we have to run the main script again, but the script should start execute from the failed script only.. it... (6 Replies)
Discussion started by: Madhu Siddula
6 Replies

3. Shell Programming and Scripting

Multiple shell scripts executed in one script

Hi every one, i am new to shell script. my people given a task to write a shell script that should execute number of shell scripts in that. in that, if any shell script is failed to execute, we have to run the main script again, but the script should start execute from the failed script only.. it... (1 Reply)
Discussion started by: Madhu Siddula
1 Replies

4. Shell Programming and Scripting

Shell script not getting executed

Hi As per my requirement when I run . ./file.sh am getting the following error -bash:ELF: command not found when i execute as ./file.sh it is getting executed.How to resolve this. Thanks in advance. (3 Replies)
Discussion started by: pracheth
3 Replies

5. AIX

Script not getting executed via cron but executes when executed manually.

Hi Script not getting executed via cron but executes successfully when executed manually. Please assist cbspsap01(appuser) /app/scripts > cat restart.sh #!/bin/ksh cd /app/bin date >>logfile.out echo "Restart has been started....." >>logfile.out date >>logfile.out initfnsw -y restart... (3 Replies)
Discussion started by: samsungsamsung
3 Replies

6. Shell Programming and Scripting

run oracle procedure in unix scripts

for j in $(du -h $1| awk '{printf("%100-s \n",$2)}') do for a in $(ls -time $(find $j -name '*.txt') | awk '{printf("\n%s %s %s %s %s",$4,$7,$8,$10,$11)}') do echo "$a">output.txt done done exit 0 echo "Password : xxxxxx " > LOG/BGH_$3.out (0 Replies)
Discussion started by: utoptas
0 Replies

7. Shell Programming and Scripting

Unique constraint violated within stored procedure executed from Perl

Hi! I got an strange trouble executing a stored procedures that goes inserting line by line on a table. I mus integrate it with perl for an specific task... the hole process is controlled by e Perl script that: Load a text file calling sqlldr. Call a stored procedure that process the... (2 Replies)
Discussion started by: jparra
2 Replies

8. Shell Programming and Scripting

Verifying if the shell command executed or not?

Hi, I am working on a shell script that would verify if the mount command has executed or not. So , i have been doing this. mount /dev/cdrom /mnt/cdrom echo "$?" if ; then echo " Mount succesful" else echo " Mount unsuccessful" fi (3 Replies)
Discussion started by: eamani_sun
3 Replies

9. AIX

Help - Need simple example of VI executed in shell script

Please help - I have seen others ask this question but I need a simple example of using vi in a shell script. Once I enter VI the shell script does not execute the next commands until I q!. I invoke VI and start the edit process. I want to go to the third line and replace a character with a new... (2 Replies)
Discussion started by: corsart
2 Replies

10. Shell Programming and Scripting

Staus of Executed Scripts

Hi There, I have 3 scripts that have to be run one after the other. All 3 scripts are dependent of the other. Now, If I am about to run the second script, assuming that the first script has already been run, can I get the status of the first script. The problem is that, My second script has... (11 Replies)
Discussion started by: pathanjalireddy
11 Replies
Login or Register to Ask a Question