OracleÊý¾Ý¿âÖмì²â±íËøµÄÒªÁì
ÔÚOracleÊý¾Ý¿âÖУ¬±íËøÊÇÒ»ÖÖ¶ÔÊý¾Ý¿â±í¾ÙÐмÓËø²Ù×÷£¬ÒÔ°ü¹ÜÊý¾ÝµÄÍêÕûÐÔºÍÒ»ÖÂÐÔ¡£±íËø·ÖΪ¹²ÏíËøºÍÅÅËûËø£¬¹²ÏíËøÔÊÐí¶à¸ö»á»°Í¬Ê±¶ÁÈ¡Êý¾Ý£¬µ«²»ÔÊÐíÆäËû»á»°¶ÔÊý¾Ý¾ÙÐÐÐ޸ģ»ÅÅËûËøÔòÖ»ÔÊÐíÒ»¸ö»á»°¾ÙÐÐд²Ù×÷£¬ÆäËû»á»°ÎÞ·¨¶ÁÈ¡»òÐÞ¸ÄÊý¾Ý¡£ÔÚÏÖʵӦÓÃÖУ¬ÎÒÃǾ³£ÐèÒª¼ì²â±íËøµÄÇéÐΣ¬ÒÔÈ·±£Êý¾Ý¿â²Ù×÷µÄ˳Ëì¾ÙÐС£
ÔÚOracleÊý¾Ý¿âÖУ¬¿ÉÒÔͨ¹ýÒÔϼ¸ÖÖÒªÁìÀ´¼ì²â±íËø£º
ʹÓÃDBA_LOCKÊÓͼ£ºÍ¨¹ýÅÌÎÊDBA_LOCKÊÓͼ£¬¿ÉÒÔÉó²éÄ¿½ñÊý¾Ý¿âÖÐËùÓеÄËøÐÅÏ¢£¬°üÀ¨ËøµÄÀàÐÍ¡¢³ÖÓÐËøµÄ»á»°IDµÈ¡£ÒÔÏÂÊÇʾÀý´úÂ룺
SELECT * FROM DBA_LOCK WHERE LOCK_TYPE = 'TM' AND MODE_HELD IS NOT NULL;
µÇ¼ºó¸´ÖÆ
ÕâÌõÅÌÎÊÓï¾ä¿ÉÒÔÁгöÄ¿½ñËùÓеıíËøÐÅÏ¢£¬ÆäÖÐLOCK_TYPE = ‘TM’ÌåÏÖ±íËø£¬MODE_HELD IS NOT NULLÌåÏÖÄ¿½ñ»á»°³ÖÓÐËø¡£
ʹÓÃV$LOCKÊÓͼ£ºV$LOCKÊÓͼ°üÀ¨Ä¿½ñÊý¾Ý¿âÖеÄËùÓÐËøÐÅÏ¢£¬Í¨¹ýÅÌÎʸÃÊÓͼ¿ÉÒÔÉó²éÏêϸµÄËøÐÅÏ¢£¬°üÀ¨ËøµÄÀàÐÍ¡¢³ÖÓÐËøµÄ»á»°IDµÈ¡£ÒÔÏÂÊÇʾÀý´úÂ룺
SELECT * FROM V$LOCK WHERE TYPE = 'TM';
µÇ¼ºó¸´ÖÆ
ÕâÌõÅÌÎÊÓï¾ä¿ÉÒÔÁгöÄ¿½ñËùÓеıíËøÐÅÏ¢£¬ÆäÖÐTYPE = ‘TM’ÌåÏÖ±íËø¡£
ʹÓÃDBA_BLOCKERSºÍDBA_WAITERSÊÓͼ£ºÍ¨¹ýÅÌÎÊÕâÁ½¸öÊÓͼ¿ÉÒÔÉó²éÄ¿½ñÊý¾Ý¿âÖÐËùÓÐÕýÔÚ±»ÛÕ±ÕºÍÕýÔÚÆÚ´ýËøµÄ»á»°ÐÅÏ¢¡£ÒÔÏÂÊÇʾÀý´úÂ룺
SELECT /*+gather_plan_statistics*/ SHOLDING_SESSION SEQ POS TSYM LMODE REQUEST PCB FROM DBA_LOCK_INTERNAL A, DBA_LOCK_INTERNAL B, V$SESSION S1, V$SESSION S2 WHERE A.SID1 = S1.SID AND B.SID1 = S2.SID AND S1.USERNAME IS NOT NULL AND S2.USERNAME IS NOT NULL AND A.SID1 = B.SID1 AND A.SID2 = B.SID2;
µÇ¼ºó¸´ÖÆ
̫ͨ¹ýÎöDBA_BLOCKERSºÍDBA_WAITERSÊÓͼ£¬¿ÉÒÔÏàʶÄÄЩ»á»°±»ËøÛÕ±Õ£¬ÄÄЩ»á»°ÕýÔÚÆÚ´ýËø¡£
ͨ¹ýÒÔÉÏÒªÁ죬¿ÉÒÔÔÚOracleÊý¾Ý¿âÖмì²â±íËøµÄÇéÐΣ¬ÊµÊ±·¢Ã÷²¢½â¾öDZÔÚµÄËø³åÍ»ÎÊÌ⣬°ü¹ÜÊý¾Ý¿â²Ù×÷µÄÕý³£¾ÙÐС£
ÒÔÉϾÍÊÇOracleÊý¾Ý¿âÖмì²â±íËøµÄÒªÁìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡