I'm trying to improve the response time of one of our monitoring applications of the server side. Currently we use a polling technique.
To give a simple example situation, "this monitoring application needs to send an email once a given table becomes empty". Current application executes a query "select count(*) from tbXXX" with a configured frequency (let's say every 10 seconds) and when the count gets '0' it does the rest of the work.
Is there a way in Oracle to avoid the above polling and to register an event handler in code with the database which will be invoked when 开发者_C百科the same condition is detected by the database side..?
Our software architect shared with me that this can be done in Microsoft SQL server through SQL NS. But he is not an expert in Oracle unfortunately.
For further details, our application is based on .Net 3.5 SP1 and the database is Oracle 11gR2 and we are using ODAC to interact with the database.
Thanks..
Oracle supports this too - they have even different mechanisms for it (live or only for committed transactions etc. and can send payload etc.)...
For example you use triggers in combination with the built-in Oracle Package dbms_alert.signal
I don't know ODAC well enough to give a C# example using ODAC since I use the (commercial components) from Devart... they have some samples how to do that - see http://www.devart.com/dotconnect/oracle/docs/OracleAlerter.html
Perhaps the sample helps you see how to do this with ODAC...
EDIT - some ODAC links with sample code:
- http://download.oracle.com/docs/cd/B19306_01/win.102/b14307/featChange.htm
- http://www.codeproject.com/KB/WCF/WCF_ODPNET_Notification.aspx
精彩评论