SQL*Net more data from dblink引起library cache pin

今天论坛中发现一个问题在进行编译或者删除存储过程的时候一直卡住,

当然这个很可能是LIBRARY CACHE PIN引起的。概念如下:

An Oracle instance has a library cache that contains the description of  
different types of objects e.g. cursors, indexes, tables, views, procedures,  
... Those objects cannot be changed when they are used. They are locked by a  
mechanism based on library locks and pins. A session that need to use an object  
will first acquire a library lock in a certain mode (null, shared or exclusive)  
on the object, in order to prevent other sessions from accessing the same  
object (e.g. exclusive lock when recompiling a package or view) or to maintain  
the object definition for a long time. Locking an object is sometimes referred
as the job to locate it in the library cache and lock it in a certain mode.
If the session wants to modify or examine the object, it must acquire after  
the lock also a pin in a certain mode (again null, shared or exclusive).  
通过语句

select distinct decode(lob.kglobtyp,
                       0,
                       'NEXT OBJECT',
                       1,
                       'INDEX',
                       2,
                       'TABLE',
                       3,
                       'CLUSTER',
                       4,
                       'VIEW',
                       5,
                       'SYNONYM',
                       6,
                       'SEQUENCE',
                       7,
                       'PROCEDURE',
                       8,
                       'FUNCTION',
                       9,
                       'PACKAGE',
                       11,
                       'PACKAGE BODY',
                       12,
                       'TRIGGER',
                       13,
                       'TYPE',
                       14,
                       'TYPE BODY',
                       19,
                       'TABLE PARTITION',
                       20,
                       'INDEX PARTITION',
                       21,
                       'LOB',
                       22,
                       'LIBRARY',
                       23,
                       'DIRECTORY',
                       24,
                       'QUEUE',
                       28,
                       'JAVA SOURCE',
                       29,
                       'JAVA CLASS',
                       30,
                       'JAVA RESOURCE',
                       32,
                       'INDEXTYPE',
                       33,
                       'OPERATOR',
                       34,
                       'TABLE SUBPARTITION',
                       35,
                       'INDEX SUBPARTITION',
                       40,
                       'LOB PARTITION',
                       41,
                       'LOB SUBPARTITION',
                       42,
                       'MATERIALIZED VIEW',
                       43,
                       'DIMENSION',
                       44,
                       'CONTEXT',
                       46,
                       'RULE SET',
                       47,
                       'RESOURCE PLAN',
                       48,
                       'CONSUMER GROUP',
                       51,
                       'SUBSCRIPTION',
                       52,
                       'LOCATION',
                       55,
                       'XML SCHEMA',
                       56,
                       'JAVA DATA',
                       57,
                       'SECURITY PROFILE',
                       59,
                       'RULE',
                       62,
                       'EVALUATION CONTEXT',
                       'UNDEFINED') object_type,
                lob.KGLNAOBJ object_name,
                pn.KGLPNMOD lock_mode_held,
                pn.KGLPNREQ lock_mode_requested,
                ses.sid,
                ses.serial#,
                ses.username,
                ses.process,
                vp.spid
  FROM x$kglpn        pn,
       v$session      ses,
       x$kglob        lob,
       v$session_wait vsw,
       v$process      vp
 WHERE pn.KGLPNUSE = ses.saddr
   and pn.KGLPNHDL = lob.KGLHDADR
   and lob.kglhdadr = vsw.p1raw
   and ses.PADDR = vp.ADDR
   and vsw.event = 'library cache pin'
 order by lock_mode_held desc;
 查看PIN的对象,确实有一个阻塞源。原来是在跑JOB,进一步分析发现了

SQL*Net more data from dblink

这个应该是网络问题,在INSERT到远程库的时候引起的,由于在JOB中有这个过程,所以JOB迟迟不能完成,同时存储过程也不能完成。

下面是METALINK的原文

Insert Into Remote Table Using DBLINK Over VPN Tunnel Hangs on Large Number of Rows [ID 742535.1]

--------------------------------------------------------------------------------

  修改时间 19-MAR-2010     类型 PROBLEM     状态 PUBLISHED   

In this Document
  Symptoms
  Changes
  Cause
  Solution
  References

--------------------------------------------------------------------------------

Applies to:
Oracle Net Services - Version: 9.2.0.1.0 to 11.1.0.7.0
Information in this document applies to any platform.
Checked for relevance on 19-MAR-2010.
Symptoms
Suddenly an INSERT (as) SELECT FROM DBLINK hangs with source database waiting on "SQL*Net more data from dblink" wait event and the remote (target) shadow process disappearing.

SQL> INSERT INTO TABLEX (SELECT SESSION_ID, OBS_DT, UNIT_ID FROM
WEB_SUMM WHERE ROWNUM 280 rows created.

SQL> INSERT INTO TABLEX (SELECT SESSION_ID, OBS_DT, UNIT_ID FROM
WEB_SUMM WHERE ROWNUM This hangs indefinitely with source in "SQL*Net more data from dblink" wait event.

Similarly, create table as select over the DBLINK also hangs:

SQL> CREATE TABLE TEST1 AS (SELECT SESSION_ID, OBS_DT, UNIT_ID FROM
WEB_SUMM WHERE ROWNUM
Table created.
---------------

SQL> CREATE TABLE TEST1 AS (SELECT SESSION_ID, OBS_DT, UNIT_ID FROM
WEB_SUMM WHERE ROWNUM
-- This also hangs indefinitely with source in "SQL*Net more data from dblink" wait event.

A PL/SQL doing an explicit cursor just fetching (not inserting) fails after 20 or so rows.

The only thing that runs to completion is plain SELECT from Sqlplus.

Changes
Database Links to databases on Local Area Network (LAN) do not exhibit this problem.  This issue is limited to a database link where the target is a remote database accessed via a VPN Tunnel using default port 1521.
Cause
Problem was isolated to use of port 1521 over a VPN Tunnel that utilizes Cisco 5400/5500 Series
Adaptive Security Appliances (ASA) where the Cisco SQLnet fixup protocol/Sql Inspector was
enabled. However, on port 1522 where this Sql packet Inspection was not enabled, the problem did
not reproduce. Note: The Cisco 5400/5500 Series Adaptive Security Appliances (ASA) have this SQLnet fixup protocol/Sql Inspection enabled by default for port 1521.

时间: 2024-11-09 00:54:36

SQL*Net more data from dblink引起library cache pin的相关文章

Oracle中library cache pin与PROCEDURE的重建

前面提到,Oracle10g重建Procedure的处理有所增强,最初看到这个增强的时候,我想这个增强是否可以减少困扰已久的Library Cache的竞争呢? 我们看一下以下测试,首先在第一个session执行操作: SQL> create or replace PROCEDURE pining 2 IS 3 BEGIN 4 NULL; 5 END; 6 / Procedure created. SQL> SQL> alter session set nls_date_format='

[20130228]等待事件library cache pin的快速定位与解决.txt

[20130228]等待事件library cache pin的快速定位与解决.txt 前几天管理的服务器出现library cache pin,当时解决有点乱了阵脚,正好下午空闲做一个例子来定位library cache pin事件以及解决方法,另外我也看许多blog,感觉定位太复杂,不合适快速解决问题: 1.环境以及问题再现: SQL> select * from v$version where rownumBANNER------------------------------------

library cache pin与PROCEDURE的重建

前面提到,Oracle10g重建Procedure的处理有所增强,最初看到这个增强的时候,我想这个增强是否可以减少困扰已久的Library Cache的竞争呢? 我们看一下以下测试,首先在第一个session执行操作: SQL> create or replace PROCEDURE pining 2 IS 3 BEGIN 4 NULL; 5 END; 6 / Procedure created. SQL> SQL> alter session set nls_date_format='

library cache lock/pin

原创:转载请说明 X$KSMLRU that tracks allocations in the shared pool that cause other objects in th e shared pool to be aged out诊断 library cache lock/pin类型:不管是访问还是修改library中的heap的信息,都需要先获得library cache lock这个锁实际是对handle进行锁定,修改需要加独占模式,访问需要共享模式,然后访问heap0的信息访问h

oracle数据库library cache lock引发的一个问题解决办法

美女同事说某个客户有个问题,系统出现了大量的library cache lock. 导致业务严重受阻,具体表现是所有访问某个表的SQL语句都会挂起. 首先我们来看hanganalyze 的结果: PORADEBUG END ORIGINATING INST:1 SERIAL:0 PID:38076802 ******************************************************************** Found 341 objects waiting fo

Library Cache Lock的解决

cache|解决 昨晚业务系统导入资料并重建索引时一个会话突然停滞不前,用TOAD一看,一直在等待Library Cache Lock.TOAD.OEM中都看不到此锁,会话每三秒启动一次,但每次都是等待这个锁.显然,这和数据字典有关,应该是一个索引的数据字典中的记录被锁住了,导致无法重建.可是杀光了其他ACTIVE的会话,问题仍然没有得到解决,看来是某一个被杀死的会话持有该锁,而会话尚未回滚完全,进程仍然吊死着.现在的问题就是找这个会话了.首先想到的文档就是Oracle9i Database R

彻底搞清楚library cache lock的成因和解决方法(一)

cache|解决 问题描述:接到应用人员的报告,说是在任何对表CSNOZ629926699966的操作都会hang,包括desc CSNOZ629926699966,例如: ora9i@cs_dc02:/ora9i > sqlplus pubuser/pubuser SQL*Plus: Release 9.2.0.4.0 - Production on Mon Jan 10 10:11:06 2005 Copyright (c) 1982, 2002, Oracle Corporation. 

shared pool latch/ library cache latch /lock pin介绍

latch:library cache --desc v$librarycache; latch:library cache用于保护hash bucket. library cache lock保护HANDLE. library cache pin保护library cache object--LCO. 从10G开始,library cache lock和library cache pin被MUTEX部分取代.暂时不讨论MUTEX. latch:library cache的数量: SYS@ by

[转载】——故障排除:Shared Pool优化和Library Cache Latch冲突优化 (文档 ID 1523934.1)

原文链接:https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrlstate=23w4l35u5_4&id=1523934.1用途   提出问题,得到帮助并分享您的心得   排错步骤   什么是shared pool?   专用术语   Literal SQL   Hard Parse(硬解析)   Soft Parse(软解析)   完全相同的语句?   Sharable SQL   语句的版本   Library Cac