Troubleshooting enq: TM contention – after the fact

We began to experience this event yesterday afternoon.  Normally, oracle takes the TM enqueue (table lock) out when activity is occurring such as an insert and we want to ensure the structure is not changed during the insert.

variable min_snap number
variable max_snap number

begin
  select min(snap_id) into :min_snap from dba_hist_snapshot where begin_interval_time > sysdate - &start_of_problem;
  select min(snap_id) into :max_snap from dba_hist_snapshot where begin_interval_time > sysdate - &end_of_problem;
end;
/

select count(*),sql_id,p2 object_id 
  from dba_hist_active_sess_history 
  where snap_id between :min_snap and :max_snap 
    and event = 'enq: TM - contention' group by sql_id,p2;

select owner,object_type,object_name,last_ddl_time 
  from dba_objects 
  where object_id = &object_id_above;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.