业务无法正常进行,查看数据库后台进程,发现有大量阻塞
QL_ID WAIT_CLASS EVENT
------------- --------------- -------------------------
1cpk7srb6cr0r User I/O db file scattered read
279knu21n06x6 Cluster gc cr request
299g1dh65yqju User I/O db file scattered read
3atq0m749xxpa User I/O db file scattered read
4x1pcvd0uhntu User I/O db file sequential read
5pt83gw45jkb6 User I/O db file scattered read
6cx5uwt35qp2j User I/O db file scattered read
71anz6u0540a6 User I/O db file scattered read
88jwdgh03ddjp User I/O db file parallel read
948rgusp8c1fn User I/O read by other session
988qxv7ufqgqh User I/O db file scattered read
9vdwzq1gucrfk User I/O db file parallel read
a6jw0kdm1aucb User I/O read by other session
a6jw0kdm1aucb User I/O read by other session
a6jw0kdm1aucb User I/O db file sequential read
a6jw0kdm1aucb User I/O read by other session
a6jw0kdm1aucb User I/O db file sequential read
a6jw0kdm1aucb User I/O read by other session
a6jw0kdm1aucb User I/O db file sequential read
a6jw0kdm1aucb User I/O db file sequential read
a6jw0kdm1aucb User I/O read by other session
a6jw0kdm1aucb User I/O db file sequential read
a6jw0kdm1aucb User I/O db file sequential read
a6jw0kdm1aucb User I/O db file sequential read
a6jw0kdm1aucb User I/O db file sequential read
a6jw0kdm1aucb User I/O read by other session
a6jw0kdm1aucb User I/O db file sequential read
a6jw0kdm1aucb User I/O db file sequential read
a6jw0kdm1aucb User I/O read by other session
a6jw0kdm1aucb User I/O db file sequential read
a6jw0kdm1aucb User I/O db file sequential read
csukjwu2761t3 User I/O db file scattered read
d6cd1gh6xft0b User I/O db file sequential read
排查出造成阻塞的源头sql,该条sql语句与分区表相关
核查该sql语句执行慢的原因,分析其执行计划发生了变动,出现了全表扫描。频繁对400G的大表进行一个全表扫描,导致数据库卡死。
为了确保业务快速恢复,最快的解决方式就是先通过手动绑定对的执行计划,恢复sql的执行效率
找出历史的awrsqrpt报告中的正确执行计划如下:
绑定执行计划后发现,并没有执行正确的索引扫描。排查数据库索引状态
可以看到新分区表部分索引状态出现了异常
TERM_TRAN_LOG_TBL_IND7_ONLTM INVALID
开始修复状态异常的索引
alter index BUSBIKE.TERM_TRAN_LOG_TBL_IND7_ONLTM rebuild online parallel 8;
alter index BUSBIKE.TERM_TRAN_LOG_TBL_IND7_ONLTM noparallel;
修复索引完毕后,业务sql恢复效率