本篇文章为大家展示了如何解决ORA-20011 KUP-11024 外部表引起的错误,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。
查看alert日志,看到了没有见过的错误。
字面大致意思是:GATHER_STATS_JOB收集统计信息时发生错误。
错误发生在执行调出ODCIEXTTABLEOPEN时;外部表只能通过数据泵调用。
Sat Jun 13 14:07:30 2015
DBMS_STATS: GATHER_STATS_JOB encountered errors. Check the trace file.
Errors in file /opt/oracle/diag/rdbms/TDB/TDB/trace/TDB_j000_12961.trc:
ORA-20011: Approximate NDV failed: ORA-29913: error in executing ODCIEXTTABLEOPEN callout <---------------
KUP-11024: This external table can only be accessed from within a Data Pump job. <---------------
Sat Jun 13 14:08:06 2015
Thread 1 cannot allocate new log, sequence 11157
错误原因:
外部表对应的操作系统上的外部表文件不存在了。但是,数据依然相信操作系统上的外部表文件还存在。
当DBMS_STATS运行,收集这个外部表的统计信息,由于外部表的文件不存在了,所以出现了上述错误。
外部表不存在的情况如下:
1、没有正确的清理datapump的临时外部表(使用datapump将查询结果填充到外部表的情况,http://czmmiao.iteye.com/blog/1268712)。
datapump job结束后,临时外部表应该会被删除掉。
2、外部表文件已经被删除,但是没有清理外部表的定义。
解决办法:
1、DBMS_STATS job 运行时,没有DataPump job运行
2、检查并清理孤儿DataPump jobs。
3、确定外部表属于datapump job
set linesize 200 trimspool on
set pagesize 2000
col owner form a30
col created form a25
col last_ddl_time form a25
col object_name form a30
col object_type form a25
select OWNER,OBJECT_NAME,OBJECT_TYPE, status,
to_char(CREATED,'dd-mon-yyyy hh34:mi:ss') created
,to_char(LAST_DDL_TIME , 'dd-mon-yyyy hh34:mi:ss') last_ddl_time
from dba_objects
where object_name like 'ET$%'
/
OWNER OBJECT_NAME OBJECT_TYPE STATUS CREATED LAST_DDL_TIME
------------------------------ ------------------------------ ------------------------- -------------- ------------------------- -------------------------
SCOTT ET$0071FF750001 TABLE VALID 28-feb-2015 16:12:19 04-may-2015 14:43:41
SCOTT ET$007CB0E70001 TABLE VALID 28-feb-2015 16:12:20 04-may-2015 14:43:41
SCOTT ET$008701B10001 TABLE VALID 28-feb-2015 16:12:20 04-may-2015 14:43:41
SCOTT ET$00922EAD0001 TABLE VALID 28-feb-2015 16:35:23 04-may-2015 14:43:41
SCOTT ET$009DD93B0001 TABLE VALID 28-feb-2015 16:40:11 04-may-2015 14:43:41
SCOTT ET$00A83F510001 TABLE VALID 28-feb-2015 16:50:55 04-may-2015 14:43:41
6 rows selected.
select owner, TABLE_NAME, DEFAULT_DIRECTORY_NAME, ACCESS_TYPE
from dba_external_tables
order by 1,2
/
OWNER TABLE_NAME DEFAULT_DI ACCESS_TYPE
---------- -------------------- ---------- --------------
SCOTT ET$0071FF750001 EXPDP CLOB
SCOTT ET$007CB0E70001 EXPDP CLOB
SCOTT ET$008701B10001 EXPDP CLOB
SCOTT ET$00922EAD0001 EXPDP CLOB
SCOTT ET$009DD93B0001 EXPDP CLOB
SCOTT ET$00A83F510001 EXPDP CLOB
查询外部表,报的错误和alert日志一样
SQL> select count(*) from SCOTT.ET$009DD93B0001;
select count(*) from SCOTT.ET$009DD93B0001
*
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
KUP-11024: This external table can only be accessed from within a Data Pump job.
外部表ET$0071FF750001的定义,看着像是datapump创建外部表。datapump导出的dmp文件作为外部表的数据文件。
CREATE TABLE "SCOTT"."ET$0071FF750001"
( "ORD_ID" NUMBER(15,0),
"ORD_NO" VARCHAR2(30),
"ORD_SEQ" NUMBER(5,0),
"ORD_CD" VARCHAR2(3),
"UNIT_SEQ" NUMBER(15,0),
"PROD_ID" NUMBER(6,0),
"UNIT_ID" NUMBER(3,0),
"WH_CD" VARCHAR2(3),
"RCPT_NO" NUMBER(15,0),
"INVC_ID" VARCHAR2(30),
"VEN_ID" NUMBER(6,0),
"ORD_QTY" NUMBER(10,0),
"CUST_ID" NUMBER(15,0),
"ORD_DATE" DATE,
"ORD_STAT_CD" VARCHAR2(3),
"COST" NUMBER(15,2),
"PRC" NUMBER(15,2),
"SPEC_PRC" NUMBER(15,2),
"TRAN_PRC" NUMBER(15,2),
"ORD_AMT" NUMBER(15,2),
"ORD_SUM_AMT" NUMBER(15,2),
"ADV_ID" NUMBER(10,0),
"MEDIA_ID" NUMBER(10,0),
"EXP_CD" VARCHAR2(20),
"SID" NUMBER(15,0),
"PRVNC_ID" VARCHAR2(10),
"CITY_ID" VARCHAR2(10),
"CNTY_ID" VARCHAR2(10),
"CUST_AGE" VARCHAR2(30),
"CUST_SEX" VARCHAR2(30),
"CUST_NM" VARCHAR2(60),
"BC_ORD_STAT_CD" VARCHAR2(30),
"OUT_CNFM_DATE" DATE,
"OVER_CNFM_DATE" DATE,
"CASH_RECEIVE" NUMBER(15,2),
"CASH_NEED" NUMBER(15,2),
"CUSER_ID" VARCHAR2(60),
"CTIME" DATE,
"UUSER_ID" VARCHAR2(60),
"UTIME" DATE,
"CENTER_CD" VARCHAR2(60),
"OLD_ORD_ID" NUMBER(15,0),
"PAY_ID" NUMBER(15,0),
"BANK_ID" NUMBER(15,0),
"ID" NUMBER(15,0),
"TRADE" NUMBER(15,4),
"UTRADE" NUMBER(15,4),
"TICKET" NUMBER(15,4),
"INTEGRAL" NUMBER(15,4),
"UINTEGRAL" NUMBER(15,4),
"ORDER_FLAG" VARCHAR2(2),
"OUT_BOUND_DATE" DATE,
"RTN_EXN_RSN_CD" VARCHAR2(7)
)
ORGANIZATION EXTERNAL
( TYPE ORACLE_DATAPUMP
DEFAULT DIRECTORY "EXPDP"
ACCESS PARAMETERS
( DEBUG = (0 , 0) DATAPUMP INTERNAL TABLE "SCOTT"."TC_BB_ORD" JO
B ( "SCOTT","IVL_CHG_98TAB_20150208",1) WORKERID 1 PARALLEL 1 VERSION '11.2.0.0
.0' ENCRYPTPASSWORDISNULL COMPRESSION DISABLED ENCRYPTION DISABLED TABLEEXISTS
)
LOCATION
( 'bogus.dat'
)
)
REJECT LIMIT UNLIMITED
4、删除属于datapump的外部表
drop table SCOTT.ET$0071FF750001 purge;
drop table SCOTT.ET$007CB0E70001 purge;
drop table SCOTT.ET$008701B10001 purge;
drop table SCOTT.ET$00922EAD0001 purge;
drop table SCOTT.ET$009DD93B0001 purge;
drop table SCOTT.ET$00A83F510001 purge;
参考:
ORA-20011 ORA-29913 and ORA-29400 with Associated KUP-XXXXX Errors from DBMS_STATS.GATHER_STATS_JOB (文档 ID 1274653.1)
How To Cleanup Orphaned DataPump Jobs In DBA_DATAPUMP_JOBS ? (文档 ID 336014.1)
上述内容就是如何解决ORA-20011 KUP-11024 外部表引起的错误,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注亿速云行业资讯频道。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。