enq: TM - contention等待事件
2013-03-19 00:47
399 查看
Waits on this event typically occur because an index is missing on the column(s) containing a foreign key constraint. In this case Oracle is forced to acquire a TM lock on the child table during DELETE, INSERT and UPDATE statements. However, there are other cases where this can occur, e.g. a LOCK TABLE command is being used.
Solutions
Review all foreign key constraints to ensure corresponding indexes are in place. Script displays the problem table in the Objects tab for the SQL statement. Also review the Blockers tab to see what the blocker is doing. The following script will show all unindexed columns from foreign key constraints for a specific user and it can also be customized to include only the one table :
SELECT * FROM (
SELECT c.table_name, cc.column_name, cc.position column_position
FROM user_constraints c, user_cons_columns cc
WHERE c.constraint_name = cc.constraint_name
AND c.constraint_type = 'R'
AND c.owner = upper('&&owner') and cc.owner = upper('&&owner')
MINUS
SELECT i.table_name, ic.column_name, ic.column_position
FROM user_indexes i, user_ind_columns ic
WHERE i.index_name = ic.index_name
AND c.owner = upper('&&owner') and cc.owner = upper('&&owner')
)
ORDER BY table_name, column_position;
Solutions
Review all foreign key constraints to ensure corresponding indexes are in place. Script displays the problem table in the Objects tab for the SQL statement. Also review the Blockers tab to see what the blocker is doing. The following script will show all unindexed columns from foreign key constraints for a specific user and it can also be customized to include only the one table :
SELECT * FROM (
SELECT c.table_name, cc.column_name, cc.position column_position
FROM user_constraints c, user_cons_columns cc
WHERE c.constraint_name = cc.constraint_name
AND c.constraint_type = 'R'
AND c.owner = upper('&&owner') and cc.owner = upper('&&owner')
MINUS
SELECT i.table_name, ic.column_name, ic.column_position
FROM user_indexes i, user_ind_columns ic
WHERE i.index_name = ic.index_name
AND c.owner = upper('&&owner') and cc.owner = upper('&&owner')
)
ORDER BY table_name, column_position;
相关文章推荐
- enq: TM - contention等待事件
- 事务上的等待事件 —— enq: TM - contention
- Oracle enq: TX contention 和 enq: TM contention 等待事件说明
- enq: TM – contention等待事件
- 等待事件:enq: HW - contention和enq: TM - contention
- Oracle enq: TX contention 和 enq: TM contention 等待事件说明【转自dave偶像大神】
- enq: TM - contention TM 等待事件的原因及模拟(表外键约束无索引导致)
- enq: TX - row lock/index contention、allocate ITL等待事件
- enq: TX - row lock contention“等待事件的处理
- enq: TX - row lock contention 等待事件
- enq: US - contention等待事件
- enq: TT - contention等待事件
- resetlogs开库遇到enq: DM - contention 等待事件
- 等待事件enq TX row lock contention分析
- 段上的等待事件 —— enq: HW - contention
- enq: TX - row lock contention 等待事件
- enq: TX - row lock/index contention、allocate ITL等待事件
- oracle等待事件实验--enq: TX - row lock contention
- Oracle Study之-- enq:SQ contention等待事件
- enq: TX - row lock contention 等待事件