请问oracle LOOP会锁表吗?

FOR rs IN (SELECT * FROM EA_表) LOOP
END LOOP;
在遍历的过程中,会锁表或者锁行吗,会不会影响其他线程的查询

皈依舞
浏览 837回答 1
1回答

弑天下

-- 1. 查看被锁的表SELECT p.spid, a.serial#, c.object_name, b.session_id, b.oracle_username,b.os_user_nameFROM v$process p, v$session a, v$locked_object b, all_objects cWHERE p.addr = a.paddrAND a.process = b.processAND c.object_id = b.object_id-- 2. 查看是哪个进程锁的SELECT sid, serial#, username, status, osuser FROM v$session where serial# = '11016'-- 3. 杀掉这个进程alter system kill session '72,11016';-- 4.批量解锁declare cursor mycur isselect b.sid,b.serial#from v$locked_object a,v$session bwhere a.session_id = b.sid group by b.sid,b.serial#;beginfor cur in mycurloopexecute immediate ( 'alter system kill session '''||cur.sid || ','|| cur.SERIAL# ||''' ');end loop;end;
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Oracle