Link to home
Start Free TrialLog in
Avatar of David VanZandt
David VanZandtFlag for United States of America

asked on

AWS RDS Oracle -- I need to throw an alarm based upon a SQL query.

As an Oracle DBA, I am looking to set up an alarm when a prolonged block/lock occurs between database users on an RDS Oracle instance, 19c. I think we're okay once we get the query results into an OS file and copied to an S3 bucket (CloudWatch, Lambda, etc.). My brain is stuck on a SQL method to periodically query for the condition and save it to a result set. I can grasp the idea of throwing an alarm based on metrics patterns, but the dynamic code execution throws me. My PLSQL block looks like: 

select count(1) 
into vCntr 
from gv$lock l1, gv$session s1, gv$lock l2, gv$session s2
where s1.sid=l1.sid and s2.sid=l2.sid
and l1.BLOCK=1 and l2.request > 0
and l1.id1 = l2.id1
and l2.id2 = l2.id2 ;

ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
AWS RDS will resolve all dead locks automatically. Please refer below site for more details.
www.bluematador.com/docs/troubleshooting/rds-deadlocks 

Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Pretty sure this wasn't about deadlocks.
Avatar of David VanZandt

ASKER

Ramasamy, thanks for the news. We set up the timeout on row locks for the occasional conflict. The question was, however, intended to get knowledge about CloudWatch -- which was the solution.