【故障解决】ORA-06502: PL/SQL: numeric or value error




  作者小麦 苗每日寄语  




只要你比别人稍微优秀一点,能再多坚持一会,就赢得更多机会。这种机会叠加就是人生效应的逐级放大,最终造成人与人之间巨大的落差。




【故障解决】ORA-06502: PL/SQL: numeric or value error: character string buffer too small


各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:

① EXPDP和IMPDP基于scn的导出

② ora-06502的解决方法


4  故障分析及解决过程

 4.1  故障环境介绍

 

 项目

source db

db 类型

rac

db version

10.2.0.5

db 存储

FS type

ORACLE_SID

xxx

db_name

xxx

主机kernel版本

AIX 6

OS hostname

ZTGXPADDB1

4.2  故障发生现象及报错信息

oracle@ZTGXPADDB1:/gg/ogg/dirrpt$ expdp XXXXX/XXXXX@22.188.131.27:1521/oraXPAD DIRECTORY=DATA_PUMP_DIR DUMPFILE=XXXXX_20160125.dmp LOGFILE=XXXXX_20160125.log FLASHBACK_SCN=12242466617347

 

Export: Release 10.2.0.5.0 - 64bit Production on Saturday, 02 January, 2021 15:42:47

 

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

 

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options

ORA-31626: job does not exist

ORA-31638: cannot attach to job SYS_EXPORT_SCHEMA_01 for user XXXXX

ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95

ORA-06512: at "SYS.KUPV$FT_INT", line 389

ORA-39077: unable to subscribe agent KUPC$A_2_20210102154238 to queue "KUPC$C_2_20210102154237"

ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95

ORA-06512: at "SYS.KUPC$QUE_INT", line 249

ORA-06502: PL/SQL: numeric or value error: character string buffer too small

 

 4.3  故障分析过程

 oracle@ZTGXPADDB1:/gg/ogg/dirrpt$ expdp XXXXX/XXXXX@22.188.131.27:1521/oraXPAD DIRECTORY=DATA_PUMP_DIR DUMPFILE=XXXXX_20160125.dmp LOGFILE=XXXXX_20160125.log FLASHBACK_SCN=12242466617347

 

Export: Release 10.2.0.5.0 - 64bit Production on Saturday, 02 January, 2021 15:42:47

 

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

 

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options

ORA-31626: job does not exist

ORA-31638: cannot attach to job SYS_EXPORT_SCHEMA_01 for user XXXXX

ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95

ORA-06512: at "SYS.KUPV$FT_INT", line 389

ORA-39077: unable to subscribe agent KUPC$A_2_20210102154238 to queue "KUPC$C_2_20210102154237"

ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95

ORA-06512: at "SYS.KUPC$QUE_INT", line 249

ORA-06502: PL/SQL: numeric or value error: character string buffer too small

 

根据资料解决过程如下:

SELECT *

  FROM dba_objects d

 WHERE d.OBJECT_NAME like '%DATAPUMP%'

   AND D.OBJECT_TYPE = 'SEQUENCE';

SELECT *

  FROM DBA_SEQUENCES D

 WHERE D.sequence_name IN

       ('AQ$_KUPC$DATAPUMP_QUETAB_N', 'AQ$_KUPC$DATAPUMP_QUETAB_1_N');

oracle@ZTGXPADDB1:/gg/ogg/dirrpt$ sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.5.0 - Production on Sat Jan 2 16:08:47 2021

 

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

 

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options

 

SQL> SELECT   AQ$_KUPC$DATAPUMP_QUETAB_N.CURRVAL FROM DUAL;

SELECT   AQ$_KUPC$DATAPUMP_QUETAB_N.CURRVAL FROM DUAL

*

ERROR at line 1:

ORA-08002: sequence AQ$_KUPC$DATAPUMP_QUETAB_N.CURRVAL is not yet defined in

this session

 

SQL>  SELECT   AQ$_KUPC$DATAPUMP_QUETAB_N.NEXTVAL FROM DUAL;

 

   NEXTVAL

----------

   1194988

 

SQL> DROP SEQUENCE AQ$_KUPC$DATAPUMP_QUETAB_1_N;

DROP SEQUENCE AQ$_KUPC$DATAPUMP_QUETAB_1_N

              *

ERROR at line 1:

ORA-02289: sequence does not exist

 

SQL> DROP SEQUENCE AQ$_KUPC$DATAPUMP_QUETAB_N;

 

Sequence dropped.

 

SQL> CREATE SEQUENCE AQ$_KUPC$DATAPUMP_QUETAB_N MINVALUE 1 MAXVALUE 999999 START WITH 1 INCREMENT BY 1 CACHE 20 CYCLE;

 

Sequence created.

 

SQL>  SELECT   AQ$_KUPC$DATAPUMP_QUETAB_N.NEXTVAL FROM DUAL;

 

   NEXTVAL

----------

      1

 

SQL> EXIT

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options

oracle@ZTGXPADDB1:/gg/ogg/dirrpt$

 

 

oracle@ZTGXPADDB1:/gg/ogg/dirrpt$ expdp XXXXX/XXXXX DIRECTORY=DATA_PUMP_DIR DUMPFILE=XXXXX_20160125.dmp LOGFILE=XXXXX_20160125.log  FLASHBACK_SCN=12242466617347

 

Export: Release 10.2.0.5.0 - 64bit Production on Saturday, 02 January, 2021 16:11:46

 

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

 

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options

ORA-39002: invalid operation

ORA-39070: Unable to open the log file.

ORA-39087: directory name DATA_PUMP_DIR is invalid

oracle@ZTGXPADDB1:/gg/ogg/dirrpt$ cd /oracle/app/oracle/product/10.2.0/db/rdbms/log/

 

oracle@ZTGXPADDB1:/oracle/app/oracle/product/10.2.0/db/rdbms$ sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.5.0 - Production on Sat Jan 2 16:17:56 2021

 

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

 

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options

 

SQL> grant read,write on directory DATA_PUMP_DIR to XXXXX;

 

Grant succeeded.

 

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options

oracle@ZTGXPADDB1:/oracle/app/oracle/product/10.2.0/db/rdbms$ expdp XXXXX/XXXXX DIRECTORY=DATA_PUMP_DIR DUMPFILE=XXXXX_20160125.dmp LOGFILE=XXXXX_20160125.log  FLASHBACK_SCN=12242466617347

 

Export: Release 10.2.0.5.0 - 64bit Production on Saturday, 02 January, 2021 16:18:06

 

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

 

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options

FLASHBACK automatically enabled to preserve database integrity.

Starting "XXXXX"."SYS_EXPORT_SCHEMA_01":  XXXXX/******** DIRECTORY=DATA_PUMP_DIR DUMPFILE=XXXXX_20160125.dmp LOGFILE=XXXXX_20160125.log FLASHBACK_SCN=12242466617347

Estimate in progress using BLOCKS method...

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 11.15 GB

Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC

Processing object type SCHEMA_EXPORT/FUNCTION/FUNCTION

Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE

Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC

. . exported "XXXXX"."RICH_CUSTACCOUNT"                  11.33 MB  177757 . . exported "XXXXX"."FINANCIAL_POSITIONHIS"             20.93 MB  413414 rows

. . exported "XXXXX"."BASE_TRANCOURSE"                   23.38 KB     157 rows

 《《《《篇幅原因,有省略。。。。。。。。。。。。。。。)》》》

UDE-00008: operation generated ORACLE error 31626

ORA-31626: job does not exist

ORA-39086: cannot retrieve job information

ORA-06512: at "SYS.DBMS_DATAPUMP", line 2772

ORA-06512: at "SYS.DBMS_DATAPUMP", line 3886

ORA-06512: at line 1


 

 

oracle@ZTGXPADDB1:/softtmp$ expdp XXXXX/XXXXX DIRECTORY=DMP DUMPFILE=XXXXX_20160125.dmp LOGFILE=XXXXX_20160125.log  FLASHBACK_SCN=12242466617347

oracle@ZTGXPADDB1:/softtmp$ sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.5.0 - Production on Sat Jan 2 16:38:32 2021

 

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

 

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options

 

SQL>  Select current_scn from v$database;

 

CURRENT_SCN

-----------

  1.2242E+13

 

SQL>  col current_scn format 999999999999999

SQL> Select current_scn from v$database;

 

      CURRENT_SCN

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

   12242466771468

 

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options

oracle@ZTGXPADDB1:/softtmp$ expdp XXXXX/XXXXX DIRECTORY=DMP DUMPFILE=XXXXX_20160125.dmp LOGFILE=XXXXX_20160125.log  FLASHBACK_SCN=12242466771468

 

Export: Release 10.2.0.5.0 - 64bit Production on Saturday, 02 January, 2021 16:39:06

 

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

 

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options

FLASHBACK automatically enabled to preserve database integrity.

Starting "XXXXX"."SYS_EXPORT_SCHEMA_01":  XXXXX/******** DIRECTORY=DMP DUMPFILE=XXXXX_20160125.dmp LOGFILE=XXXXX_20160125.log FLASHBACK_SCN=12242466771468

Estimate in progress using BLOCKS method...

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 11.15 GB

Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA

Export> status

 

Job: SYS_EXPORT_SCHEMA_01

   Operation: EXPORT                        

   Mode: SCHEMA                        

   State: EXECUTING                     

   Bytes Processed: 0

   Current Parallelism: 1

   Job Error Count: 0

   Dump File: /softtmp/dmp/XXXXX_20160125.dmp

     bytes written: 4,096

  

Worker 1 Status:

   State: EXECUTING                     

   Object Schema: XXXXX

   Object Name: XPAD_SH

   Object Type: SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC

   Completed Objects: 1

   Total Objects: 1

   Worker Parallelism: 1

 

Export> kill_job

Are you sure you wish to stop this job ([yes]/no): yes

 

oracle@ZTGXPADDB1:/softtmp$

oracle@ZTGXPADDB1:/softtmp$

 

  

 

 

oracle@ZTGXPADDB1:/softtmp$

oracle@ZTGXPADDB1:/softtmp$ expdp XXXXX/XXXXX directory=DMP dumpfile=XXXXX_20160125_01.dmp LOGFILE=XXXXX_20160125.log  TABLES=BASE_ACTIONPOWER,BASE_BANK,BASE_BANKMERGE,BASE_BANKTREE,BASE_BRCHBANKCTRL,BASE_CERTIFICATE,BASE_CESS,BASE_COREBANK,BASE_CURRENCY,BASE_DEPARTMENT,BASE_HOLIDAYCALENDAR,BASE_HOLIDAYDATE,BASE_INTEREST,BASE_INTERESTHIS,BASE_MAINAREA,BASE_MENU,BASE_PRODTYPECODE,BASE_RATE,BASE_ROLE,BASE_SYSLOG,BASE_SYSPARAM,BASE_TERMINALTELLER,BASE_USER,FINANCIAL_BANKPROFITLOG,FINANCIAL_DIVIDENDPLAN,FINANCIAL_FUNDPRICE,FINANCIAL_INTERESTRESET,FINANCIAL_ISSUE,FINANCIAL_ISSUEAUDIT,FINANCIAL_ISSUEAUDITHIS,FINANCIAL_ISSUEBRAND,FINANCIAL_ISSUECFL,FINANCIAL_ISSUECONTROL,FINANCIAL_ISSUEDIFFRATE,FINANCIAL_ISSUEDISCOUNT,FINANCIAL_ISSUEEXPD,FINANCIAL_ISSUEEXT,FINANCIAL_ISSUEFEE,FINANCIAL_ISSUEFORCUSTRISKLVL,FINANCIAL_ISSUEFUNDSTRANSFER,FINANCIAL_ISSUEOBSERV,FINANCIAL_ISSUEPAY,FINANCIAL_ISSUEPROFIT,FINANCIAL_ISSUEQTYSPLIT,FINANCIAL_ISSUESELLCTRL,FINANCIAL_ISSUESERIAL,FINANCIAL_ISSUEVARIABLE,FINANCIAL_ISSUEWORKTIME,FINANCIAL_LIQUIDATEACT,FINANCIAL_MESSAGEINFO,FINANCIAL_PERIOD,FINANCIAL_PRICE,FINANCIAL_PRICEHIS,FINANCIAL_REFERINDEX,FINANCIAL_POSITION,RICH_AUTOTRADE,RICH_CUSTACCOUNT,RICH_CUSTAUTOTRADE,RICH_CUSTAUTOTRADEHIS,RICH_CUSTCAPITAL,RICH_CUSTFAVORABLE,RICH_CUSTFREEZEUNIT,RICH_CUSTFUNDPROFIT,RICH_CUSTIMPAWN,RICH_CUSTKEEPBAL,RICH_CUSTOMERINFO,RICH_CUSTOMERINFOHIS,RICH_CUSTORDERTRADE,RICH_CUSTPAYAMOUNTLOG,RICH_CUSTPRODUCTBAL,RICH_CUSTPRODUCTBALQTY,RICH_CUSTPROFITDCCY,RICH_CUSTPROFITLOG,RICH_CUSTPROFITNORMAL,RICH_CUSTPROFITPAYMODE,RICH_CUSTPROFITPAYMODEHIS,RICH_CUSTRISKLVL,RICH_FUNDTRADELOG,RICH_NOPAYAMOUNT,RICH_NORMALPAY,RICH_ORDERTRADE,RICH_SMSCMDSIGN,RICH_SMSCMDTRADE,RICH_STARTBAL,RICH_STARTBALHIS,financial_positionhis,financial_positiontra,financial_positioncst,financial_positionacc,corp_stattemptab,corp_stattemptabacc,corp_stattemptabcst,FINANCIAL_ICCARDCODE,BASE_FINANCIALICCARD,FINANCIAL_ISSUESPECIFICATION,PA_RPT_PARAM,FINANCIAL_SALEBANK_HIS,RICH_TRADELOG_HIS,RICH_CUSTPAYAMOUNTHIS_HIS,RICH_CUSTPRODUCTBALHIS_HIS,RIC

 

Export: Release 10.2.0.5.0 - 64bit Production on Saturday, 02 January, 2021 16:41:50

 

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

 

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options

Starting "XXXXX"."SYS_EXPORT_TABLE_01":  XXXXX/******** directory=DMP dumpfile=XXXXX_20160125_01.dmp LOGFILE=XXXXX_20160125.log TABLES=BASE_ACTIONPOWER,BASE_BANK,BASE_BANKMERGE,BASE_BANKTREE,BASE_BRCHBANKCTRL,BASE_CERTIFICATE,BASE_CESS,BASE_COREBANK,BASE_CURRENCY,BASE_DEPARTMENT,BASE_HOLIDAYCALENDAR,BASE_HOLIDAYDATE,BASE_INTEREST,BASE_INTERESTHIS,BASE_MAINAREA,BASE_MENU,BASE_PRODTYPECODE,BASE_RATE,BASE_ROLE,BASE_SYSLOG,BASE_SYSPARAM,BASE_TERMINALTELLER,BASE_USER,FINANCIAL_BANKPROFITLOG,FINANCIAL_DIVIDENDPLAN,FINANCIAL_FUNDPRICE,FINANCIAL_INTERESTRESET,FINANCIAL_ISSUE,FINANCIAL_ISSUEAUDIT,FINANCIAL_ISSUEAUDITHIS,FINANCIAL_ISSUEBRAND,FINANCIAL_ISSUECFL,FINANCIAL_ISSUECONTROL,FINANCIAL_ISSUEDIFFRATE,FINANCIAL_ISSUEDISCOUNT,FINANCIAL_ISSUEEXPD,FINANCIAL_ISSUEEXT,FINANCIAL_ISSUEFEE,FINANCIAL_ISSUEFORCUSTRISKLVL,FINANCIAL_ISSUEFUNDSTRANSFER,FINANCIAL_ISSUEOBSERV,FINANCIAL_ISSUEPAY,FINANCIAL_ISSUEPROFIT,FINANCIAL_ISSUEQTYSPLIT,FINANCIAL_ISSUESELLCTRL,FINANCIAL_ISSUESERIAL,FINANCIAL_ISSUEVARIABLE,FINANCIAL_ISSUEWORKTIME,FINANCIAL_LIQUIDATEACT,FINANCIAL_MESSAGEINFO,FINANCIAL_PERIOD,FINANCIAL_PRICE,FINANCIAL_PRICEHIS,FINANCIAL_REFERINDEX,FINANCIAL_POSITION,RICH_AUTOTRADE,RICH_CUSTACCOUNT,RICH_CUSTAUTOTRADE,RICH_CUSTAUTOTRADEHIS,RICH_CUSTCAPITAL,RICH_CUSTFAVORABLE,RICH_CUSTFREEZEUNIT,RICH_CUSTFUNDPROFIT,RICH_CUSTIMPAWN,RICH_CUSTKEEPBAL,RICH_CUSTOMERINFO,RICH_CUSTOMERINFOHIS,RICH_CUSTORDERTRADE,RICH_CUSTPAYAMOUNTLOG,RICH_CUSTPRODUCTBAL,RICH_CUSTPRODUCTBALQTY,RICH_CUSTPROFITDCCY,RICH_CUSTPROFITLOG,RICH_CUSTPROFITNORMAL,RICH_CUSTPROFITPAYMODE,RICH_CUSTPROFITPAYMODEHIS,RICH_CUSTRISKLVL,RICH_FUNDTRADELOG,RICH_NOPAYAMOUNT,RICH_NORMALPAY,RICH_ORDERTRADE,RICH_SMSCMDSIGN,RICH_SMSCMDTRADE,RICH_STARTBAL,RICH_STARTBALHIS,financial_positionhis,financial_positiontra,financial_positioncst,financial_positionacc,corp_stattemptab,corp_stattemptabacc,corp_stattemptabcst,FINANCIAL_ICCARDCODE,BASE_FINANCIALICCARD,FINANCIAL_ISSUESPECIFICATION,PA_RPT_PARAM,FINANCIAL_SALEBANK_HIS,RICH_TRA

Estimate in progress using BLOCKS method...

Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 6.913 GB

Processing object type TABLE_EXPORT/TABLE/TABLE

Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX

Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

Processing object type TABLE_EXPORT/TABLE/COMMENT

Processing object type TABLE_EXPORT/TABLE/TRIGGER

Processing object type TABLE_EXPORT/TABLE/INDEX/FUNCTIONAL_AND_BITMAP/INDEX

Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/FUNCTIONAL_AND_BITMAP/INDEX_STATISTICS

Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

. . exported "XXXXX"."RICH_CUSTPRODUCTBAL"               63.64 KB     582 

 《《《《篇幅原因,有省略。。。。。。。。。。。。。。。)》》》

. . exported "XXXXX"."RICH_TRADELOG_HIS":"P_201411"          0 KB       0 rows

. . exported "XXXXX"."RICH_TRADELOG_HIS":"P_999999"          0 KB       0 rows

ORA-39166: Object RIC was not found.

Master table "XXXXX"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded

******************************************************************************

Dump file set for XXXXX.SYS_EXPORT_TABLE_01 is:

   /softtmp/dmp/XXXXX_20160125_01.dmp

Job "XXXXX"."SYS_EXPORT_TABLE_01" completed with 1 error(s) at 16:42:37

 

 

5 故障处理总结

删除DATAPUMP序列号,因为该序列号不能超过fixed的了。

SQL> DROP SEQUENCE AQ$_KUPC$DATAPUMP_QUETAB_N;

 

Sequence dropped.

 

SQL> CREATE SEQUENCE AQ$_KUPC$DATAPUMP_QUETAB_N MINVALUE 1 MAXVALUE 999999 START WITH 1 INCREMENT BY 1 CACHE 20 CYCLE;

 

到此所有的处理算是基本完毕,过程很简单,但是不同的场景处理方式有很多种,我们应该学会灵活变通。

 

上一篇:实验4 8086标志寄存器及中断


下一篇:C#datatable列求和,list去重,datatable某一列转list,列反序