Re: DBMS_Alert Implementation - Help

From: Gerard H. Pille <ghp_at_infosoft.be>
Date: 1996/03/14
Message-ID: <4ia4ab$1vu_at_news.Belgium.EU.net>#1/1


In article <4i7um2$i0t_at_gaia.cc.gatech.edu>, badri (badri_at_cc.gatech.edu) says...
!>
!>Hi:
!>
!> We use the following structure to utilize the
!>features of DBMS_ALERT:
!>
!> Job_Server; UNIX SCript
!> While true do
!> # wait for dbms_alert.signal
!> sqlplus uname/pwd _at_dbms_waitone
!> Start_Some_Unix_Job &
!> Done
!>
!> A trigger in a table causes the signal to be generated. THis
!>in turn fires off the Unix job. This works great, but consider
!>the following case:
!>
!> There is a definite interval between Start_Some_Unix_Job and
!>the next waitone call. In this period, if some signal is generated,
!that
!>client is not serviced by the Job_Server. I want to avoid this. ORACLE
!>does not (as far as I can tell) stack the sgnals so that the next time
!>the server comes around and waits, it will get signalled automatically
!>because, while it was away kicking off the job, some one else had
!signalled.
!>
!>How do I get this done? Is DBMS_PIPE the answer? Do Gurus here have
!sample
!>DBMS_PIPE code that I can use as a basis?
!>
!>thanks a lot,
!>
!>-Badri

A little trick I believe I invented (I haven't seen anybody else use it):

Use sqplus as a co-process in unix. The unix script goes like this:

#!/bin/ksh

# Start sqlplus as a co-process
sqlplus -s user/password |&

print -p "start dbms_waitone"	# don't exit in dbms_waitone
				# just signal every alert you receive

while read -p		# will hang untill co-process gives some output
do
	# the necessary unix thingies
	mail badri <<-EOF
		Dear Badri,
		Would you be so kind as to look into the alert I 	
		received?
		I received $REPLY	# read -p -> REPLY
		Thank you very much.
		Your alert-server.
		EOF
done			# this will never be
			# unless you provide an exit within the loop
			# then:
print -p "exit;"
wait			# for the co-process (child) to finish
exit

You can do beautifull things with sqlplus as a co-process, you need to know some unix though. Anything goes!

-- 
Kind reGards
     \ /   |
      X    |
     / \   s
     Gerard
Received on Thu Mar 14 1996 - 00:00:00 CET

Original text of this message