已索引
可以通过如下步骤来找出未批量提交的 SQL 语句(commit 在循环内):
获取提交次数超过一定阈值的SID:
SQL> select t1.sid, t1.value, t2.name
from v$sesstat t1, v$statname t2
where t2.name like '%user commits%'
and t1.STATISTIC# = t2.STATISTIC#
and value >= 10000
order by value desc;
获取到会话的相关信息及对应的SQL_ID:
SQL> select t.SID,
t.PROGRAM,
t.EVENT,
t.LOGON_TIME,
t.WAIT_TIME,
t.SECONDS_IN_WAIT,
t.SQL_ID,
t.PREV_SQL_ID
from v$session t
where sid in(178);
通过SQL_ID得到对应的SQL:
SQL> select t.sql_id,
t.sql_text,
t.EXECUTIONS,
t.FIRST_LOAD_TIME,
t.LAST_LOAD_TIME
from v$sqlarea t
where sql_id in ('ccwx2c68yifmf');