ÔõÑùʹÓÃOracle ÅÌÎʱíÊÇ·ñ±»Ëø£¿
ÎÊÌ⣺ÔõÑùʹÓÃOracle ÅÌÎʱíÊÇ·ñ±»Ëø£¿
ÔÚOracleÊý¾Ý¿âÖУ¬±íËøÊÇÖ¸µ±Ò»¸öÊÂÎñÕýÔÚ¶Ô±íÖ´ÐÐд²Ù×÷ʱ£¬ÆäËûÊÂÎñÏëÒª¶Ô¸Ã±íÖ´ÐÐд²Ù×÷»òÕ߶Աí¾ÙÐнṹ¸Ä±ä£¨ÈçÔöÌíÁС¢É¾³ýÐеȣ©Ê±»á±»ÛÕ±Õ¡£ÔÚÏÖʵ¿ª·¢Àú³ÌÖУ¬ÎÒÃǾ³£ÐèÒªÅÌÎʱíÊÇ·ñ±»Ëø£¬ÒÔ±ã¸üºÃµØÅŲéºÍ´¦Öóͷ£Ïà¹ØÎÊÌâ¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃOracleÓï¾äÅÌÎʱíÊÇ·ñ±»Ëø£¬²¢¸ø³öÏêϸµÄ´úÂëʾÀý¡£
ÒªÅÌÎʱíÊÇ·ñ±»Ëø£¬ÎÒÃÇ¿ÉÒÔͨ¹ýOracleÖеĶ¯Ì¬Êý¾Ý×ÖµäÊÓͼV$LOCK¾ÙÐÐÉó²é¡£V$LOCKÊÓͼ°üÀ¨ÁËÊý¾Ý¿âÖÐËùÓб»ËøסµÄ¹¤¾ßµÄÐÅÏ¢£¬°üÀ¨ÁËËøµÄÀàÐÍ¡¢ËøµÄ³ÖÓÐÕߵȡ£ÏÂÃæÊÇÒ»¸ö¼òÆÓµÄÅÌÎÊÓï¾ä£¬¿ÉÒÔÓÃÀ´ÅÌÎÊÌض¨±íÊÇ·ñ±»Ëø£º
SELECT a.session_id, a.locked_mode, a.os_user_name, b.object_name, b.object_type, c.owner FROM v$locked_object a, dba_objects b, dba_users c WHERE a.object_id = b.object_id AND b.owner = c.username AND b.object_name = 'YOUR_TABLE_NAME';
µÇ¼ºó¸´ÖÆ
ÔÚÉÏÃæµÄ´úÂëÖУ¬ÎÒÃÇͨ¹ýÅÌÎÊv$locked_objectÊÓͼ¡¢dba_objectsÊÓͼºÍdba_usersÊÓͼ£¬À´»ñÈ¡¹ØÓÚËøµÄÏà¹ØÐÅÏ¢¡£ÐèÒª½«’YOUR_TABLE_NAME’Ì滻ΪÏêϸµÄ±íÃûÒÔÅÌÎÊÖ¸¶¨±íÊÇ·ñ±»Ëø¡£
ÁíÍ⣬ÈôÊÇÏëÒªÉó²éÊý¾Ý¿âÖÐËùÓб»ËøסµÄ¹¤¾ß£¬¿ÉÒÔʹÓÃÈçÏÂÅÌÎÊÓï¾ä£º
SELECT a.session_id, a.locked_mode, a.os_user_name, b.object_name, b.object_type, c.owner FROM v$locked_object a, dba_objects b, dba_users c WHERE a.object_id = b.object_id AND b.owner = c.username;
µÇ¼ºó¸´ÖÆ
ͨ¹ýÉÏÊö´úÂëʾÀý£¬ÎÒÃÇ¿ÉÒÔÔÚOracleÊý¾Ý¿âÖÐÅÌÎʱíÊÇ·ñ±»Ëø£¬´Ó¶øʵʱ´¦Öóͷ£Ï¢Õù¾öÏà¹ØÎÊÌ⣬ȷ±£Êý¾Ý¿âµÄÕý³£ÔËÐС£Ï£ÍûÒÔÉÏÄÚÈݶÔÄãÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇÔõÑùʹÓÃOracle ÅÌÎʱíÊÇ·ñ±»Ëø£¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡