Run a sql script on multiple $Oracle_SID at once and send an alert if reaches the threshold

I am trying to accomplish following tasks in my KSH script:

  1. Run a sql script on multiple $ORACLE_SID at once
  2. Sends an alert only if the threshold > 2 for any of the $ORACLE_SID

Please advice as to how I can approach this!!

Thanks in advance!

I'm afraid you will need to define what you mean by the threshold.

You can easily run against multiple SIDs by putting the jobs into the background. The fun part comes in getting the responses back when they finish.

for SID in SID_A  SIB_B  SID_C  SID_D
do
   . setsid $SID
   sqlplus .......<<whatever>>........  &
done

wait            # Pauses script until all background processes have completed.

You may need to capture the output to a set of files and then read them after the wait completes to see what happened.

If you tell us what the point of these multiple calls is, then maybe we can suggest a way to get the overall result you are looking for.

Robin