我方批量修改表记录,是采用批量提交单行修改update语句进行的。例如
start;
update table set field = xxx,field2=xxx where id = 1;
update table set field = xxx,field2=xxx where id = 2;
update table set field = xxx,field2=xxx where id = 3;
…
update table set field = xxx,field2=xxx where id = 1000;
commit;
准备在所有update单句上加 超时hint。
如
update /*+ QUERY_TIMEOUT (10000000) / table set field = xxx,field2=xxx where id = 1;
update /+ QUERY_TIMEOUT (10000000) */ table set field = xxx,field2=xxx where id = 2;
select
/+QUERY_TIMEOUT(3600000000) read_consistency(weak)/
b.TRANS_ID,
case
WHEN b.TYPE = ‘TM’ THEN ‘表锁’
WHEN b.TYPE = ‘TX’ THEN ‘事务锁’
WHEN b.TYPE = ‘TR’ THEN ‘行锁’
ELSE NULL
END
AS lock_type,
ID1,
LMODE,
CASE
WHEN BLOCK = 0 THEN ‘该事务持有锁’
WHEN BLOCK = 1 THEN ‘该事务被阻塞’
ELSE NULL
END
as BLOCK,
a.SVR_IP,
ID,
user,
command,
time,
total_time,
STATE,
info,
retry_cnt,
retry_info,
thread_id,
trace_id
from
gv$ob_processlist a,
GV$OB_LOCKS b,
CDB_ob_table_locations c
where
a.trans_id = b.trans_id
and c.table_name = ‘表名称’
and (
ID1 like concat(’%’ , c.table_id, ‘%’)
OR ID1 like concat(’%’ , c.tablet_id ,’%’)
); 可以根据这个语句监控一下是否存在锁的问题,在SYS租户下面执行