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
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.
www.bluematador.com/docs/troubleshooting/rds-deadlocks