oracleÉó²éÀú³ÌÊÇ·ñ±»Ëø
ÓÐÎåÖÖÒªÁì¿ÉÒÔ¼ì²é oracle Àú³ÌÊÇ·ñ±»Ëø£ºÊ¹Óà v$session ºÍ v$session_wait£¬²éÕÒ°üÀ¨¡°lock¡±µÄÆÚ´ýÊÂÎñ¡£Ê¹Óà v$lock ÕÒµ½Ä¿½ñ³ÖÓÐËøµÄ»á»°¡£Ê¹Óà gv$lock ²éÕÒËùÓÐÊý¾Ý¿â¹æÄ£µÄËø¡£Ê¹Óà v$locked_object ²éÕÒÄ¿½ñ±»Ëø¶¨µÄÊý¾Ý¿â¹¤¾ß¡£Ê¹Óà v$transaction ÕÒµ½ÕýÔÚÆÚ´ýËø¶¨µÄËùÓÐÊÂÎñ¡£
ÔõÑùÉó²é Oracle Àú³ÌÊÇ·ñ±»Ëø£¿
ÒªÁì 1£ºÊ¹Óà v$session ºÍ v$session_wait
SELECT s.sid, s.serial#, s.status, sw.event, sw.wait_time FROM v$session s INNER JOIN v$session_wait sw ON s.sid = sw.sid WHERE sw.event LIKE '%lock%';
µÇ¼ºó¸´ÖÆ
´ËÅÌÎÊ·µ»ØËùÓб»Ëø¶¨µÄ»á»°¼°ÆäÆÚ´ýÊÂÎñºÍÆÚ´ýʱ¼ä¡£
ÒªÁì 2£ºÊ¹Óà v$lock
SELECT * FROM v$lock WHERE request > 0;
µÇ¼ºó¸´ÖÆ
´ËÅÌÎÊ·µ»ØËùÓÐÄ¿½ñ³ÖÓÐËøµÄ»á»°¡£
ÒªÁì 3£ºÊ¹Óà gv$lock
SELECT * FROM gv$lock WHERE request > 0;
µÇ¼ºó¸´ÖÆ
´ËÅÌÎÊÀàËÆÓÚ v$lock£¬µ«ËüÏÔʾËùÓÐÊý¾Ý¿â¹æÄ£µÄËø¡£
ÒªÁì 4£ºÊ¹Óà v$locked_object
SELECT * FROM v$locked_object WHERE object_id > 0;
µÇ¼ºó¸´ÖÆ
´ËÅÌÎÊ·µ»ØÄ¿½ñ±»Ëø¶¨µÄÊý¾Ý¿â¹¤¾ß¡£
ÒªÁì 5£ºÊ¹Óà v$transaction
SELECT * FROM v$transaction WHERE status = 'WAIT WAIT';
µÇ¼ºó¸´ÖÆ
´ËÅÌÎÊ·µ»ØÕýÔÚÆÚ´ýËø¶¨µÄËùÓÐÊÂÎñ¡£
ÒÔÉϾÍÊÇoracleÉó²éÀú³ÌÊÇ·ñ±»ËøµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡