执行立即“查询”ORA-04030:尝试分配 56 字节时进程内存不足(调用堆,qerrmbv[]:qerrmObnd)

Posted

技术标签:

【中文标题】执行立即“查询”ORA-04030:尝试分配 56 字节时进程内存不足(调用堆,qerrmbv[]:qerrmObnd)【英文标题】:Execute Immediate 'Query' ORA-04030: out of process memory when trying to allocate 56 bytes (callheap,qerrmbv[]: qerrmObnd) 【发布时间】:2014-08-29 15:51:08 【问题描述】:

我正在尝试在 sqlplus 中运行一个脚本,该脚本通过“立即执行”填充一个名为“ccb_check”的表,但我得到“ORA-04030:尝试分配 56 个字节时进程内存不足(调用堆,qerrmbv [ ]: qerrmObnd)'

set serveroutput on
declare

begin

EXECUTE IMMEDIATE 'INSERT INTO  ccb_check
SELECT
/*+DRIVING_SITE(A)*/
/*+DRIVING_SITE(B)*/
/*+DRIVING_SITE(C)*/
/*+DRIVING_SITE(D)*/
/*+DRIVING_SITE(E)*/
/*+DRIVING_SITE(F)*/
/*+DRIVING_SITE(G)*/
/*+DRIVING_SITE(H)*/
/*+DRIVING_SITE(I)*/
/*+DRIVING_SITE(J)*/
/*+DRIVING_SITE(K)*/
/*+DRIVING_SITE(L)*/
/*+DRIVING_SITE(M)*/
DISTINCT
          C.ADHOC_CHAR_VAL AS BANCO,
          M.HOMERE_ID,
          D.CHAR_VAL AS TITRE_RUBRIQUE,
          A.CHAR_VAL AS STITRE_RUBRIQUE,
          E.CHAR_VAL AS BENEFICIAIRE,
          F.TOS_ID AS ID_TOS,
          B.DESCR AS DESCR_TOS,
          B.SA_ID AS ID_EDC_MODELE,
          F.SA_ID AS ID_EDC_CLIENT,
          G.ACCT_ID AS ID_COMPTE_CLIENT,
          G.START_DT AS DT_DEB_EDC_CLIENT,
          G.END_DT AS DT_FIN_EDC_CLIENT,
          I.DESCR_TMPLT AS LIBELLE_FACTURE,
          I.RS_CD,
          K.MIG_ID_COMPTE_CLIENT,
          CASE
             WHEN J.RS_CD IN (SELECT RS_CD
                                FROM CI_RC@LDE_CIBLE
                               WHERE BF_CD LIKE ''%ABO%'')
             THEN
                ''DIAMETRE COMPTEUR''
             WHEN J.RS_CD IN (SELECT RS_CD
                                FROM CI_RC@LDE_CIBLE
                               WHERE BF_CD LIKE ''%TR%'')
             THEN
                ''TRANCHE''
             ELSE
                ''UNIQUE''
          END
             AS TYPE_TARIF,
          (SELECT DESCR
             FROM CI_LOOKUP@LDE_CIBLE
            WHERE     FIELD_VALUE = G.SA_STATUS_FLG
                  AND UPPER (field_name) LIKE ''%SA_STATUS_FLG%''
                  AND TRIM (language_cd) = ''FRA'')
             Etat_EDC, sysdate DD
     FROM CI_TOS@LDE_CIBLE B,
          CI_UA_CHAR@LDE_CIBLE C,
                   CI_TOS_SA@LDE_CIBLE F
                LEFT JOIN
                   CI_TOS_CHAR@LDE_CIBLE A
                ON F.TOS_ID = A.TOS_ID AND A.CHAR_TYPE_CD = ''STITRE-R''
             LEFT JOIN
                CI_TOS_CHAR@LDE_CIBLE D
             ON F.TOS_ID = D.TOS_ID AND D.CHAR_TYPE_CD = ''TITRE-R''
          LEFT JOIN
             CI_TOS_CHAR@LDE_CIBLE E
          ON F.TOS_ID = E.TOS_ID AND E.CHAR_TYPE_CD = ''BENF-TYP'',
          CI_SA@LDE_CIBLE G,
          CI_SA_RS_HIST@LDE_CIBLE H,
          CI_RV_L@LDE_CIBLE I,
          CI_RC@LDE_CIBLE J,
          RN_ACCT@LDE_CIBLE K,
          CI_TOS_CHAR@LDE_CIBLE L,
          CM_RUBRIQUE_TOS@LDE_CIBLE M
    WHERE     F.TOS_ID = B.TOS_ID
          AND B.UA_ID = C.UA_ID
          AND F.SA_ID = G.SA_ID
          AND F.SA_ID = H.SA_ID
          AND H.RS_CD = I.RS_CD
          AND I.RS_CD = J.RS_CD
          AND F.TOS_ID = L.TOS_ID
          AND TRIM (F.TOS_ID) = TRIM (M.TOS_ID)
          AND G.ACCT_ID = K.CCB_ID_COMPTE_CLIENT
          AND I.LANGUAGE_CD = ''FRA''
          AND L.CHAR_TYPE_CD = ''NAT-SERV''
          AND L.CHAR_VAL != ''FRAIS''
          AND C.CHAR_TYPE_CD = ''BANCO''
';
EXCEPTION
WHEN others THEN
ROLLBACK; --to Savepoint restore_ccb;
DBMS_OUTPUT.PUT_LINE ('restore insert INS_CCB, SQLCODE : ' ||SQLCODE||' -ERROR- '||SQLERRM);
end;
/

select * from v$pgastat;

aggregate PGA target parameter  373293056   bytes
aggregate PGA auto target   240648192   bytes
global memory bound 74657792    bytes
total PGA inuse 122972160   bytes
total PGA allocated 185925632   bytes
maximum PGA allocated   1368005632  bytes
total freeable PGA memory   20512768    bytes
process count   68  
max processes count 299 
PGA memory freed back to OS 2705889689600   bytes
total PGA used for auto workareas   22077440    bytes
maximum PGA used for auto workareas 517334016   bytes
total PGA used for manual workareas 0   bytes
maximum PGA used for manual workareas   1628160 bytes
over allocation count   2418    
bytes processed 4274855246848   bytes
extra bytes read/written    498305049600    bytes
cache hit percentage    89,56   percent
recompute count (total) 2473622

我需要你的帮助事实上,当我删除“立即执行”时,查询会起作用,所以我想知道有没有办法使用“立即执行”语句运行脚本。

这个查询实际上返回了超过 100 万行。

【问题讨论】:

这个查询返回多少行? 听起来您需要为 Oracle 实例分配更多内存。因此,最好在 dba.stackexchange.com 上提出这个问题。 【参考方案1】:

我看到你所有的桌子都是远程的。我认为更有效的(基于类似情况下的最后调整经验)将是在远程数据库上创建视图并仅查询必要的列。这种方法将减少发送的数据量。

【讨论】:

以上是关于执行立即“查询”ORA-04030:尝试分配 56 字节时进程内存不足(调用堆,qerrmbv[]:qerrmObnd)的主要内容,如果未能解决你的问题,请参考以下文章

ORA-04030: out of process memory when trying to allocate 152 bytes (Logminer LCR c,krvtadc)

Oracle数据库问题已解决:ORA-04030 私有内存超出

Oracle数据库问题已解决:ORA-04030 私有内存超出

如何在 Oracle 中解决此内存错误

诊断并解决 ORA-4030 错误 (Doc ID 1548826.1)

执行立即语句的参数(在过程中)