zoukankan      html  css  js  c++  java
  • ORA-39083,ORA-01403 Object type INDEX_STATISTICS failed to create with error

    数据库版本11.2.0.4 linux rac 2节点。

    导入后,发现报错?

    ORA-39083: Object type INDEX_STATISTICS failed to create with error: 
    ORA-01403: no data found 
    ORA-01403: no data found 
    Failing sql is: 
    DECLARE IND_NAME VARCHAR2(60); IND_OWNER VARCHAR2(60); BEGIN DELETE FROM 
    "SYS"."IMPDP_STATS"; SELECT index_name, index_owner INTO IND_NAME, IND_OWNER 
    FROM (SELECT UNIQUE sgc1.index_name, sgc1.index_owner, 
    COUNT(*) mycount 
    FROM sys.ku$_find_sgc_view sgc1, 
    TABLE (sgc1.col_list) myc

    表,索引都是CREATE 成功无异常?

    但是导入索引统计信息确出现问题? 报错提示索引找不着???

    查询检索MOS

    DataPump Import (IMPDP) Failed With Errors ORA-39083 ORA-1403 On INDEX_STATISTICS (Doc ID 755253.1)    
    Oracle Database - Enterprise Edition - Version 10.2.0.3 to 11.2.0.4 [Release 10.2 to 11.2]

    疑问? 为什么出现这个现象?是否可以忽略,还是需要介入处理!

    Cause

    1. Create a table under "TEST0" schema:
    
    #> sqlplus test0/password
    
    DROP TABLE TEST0 PURGE; 
    
    CREATE TABLE TEST0 
    ( 
       COL1 NUMBER NOT NULL, 
       COL2 NUMBER NOT NULL, 
       COL3 NUMBER NOT NULL 
    ) 
    TABLESPACE USERS; 
    
    ALTER TABLE TEST0 ADD (PRIMARY KEY (COL2, COL1, COL3) USING INDEX TABLESPACE USERS); 
    
    CREATE INDEX TEST0INDEX ON TEST0 (COL3, COL1, COL2) TABLESPACE USERS; 
    
    select object_name, object_type from user_objects;
    
    OBJECT_NAME                    OBJECT_TYPE 
    ------------------------------ ------------------- 
    TEST0                          TABLE 
    SYS_C009845                    INDEX <-- Index associated with PK constraint. 
    TEST0INDEX                     INDEX
    2. Collect statistics for "TEST0" schema.
    
    #> sqlplus system/password
    exec dbms_stats.gather_schema_stats('TEST0',cascade => TRUE);
    3. Execute the DataPump export an import process to reproduce the problem.
    
    #> expdp system/password schemas=test0 dumpfile=test0.dmp 
    ...
    
    (completed successfully without warnings) 
    
    #> impdp system/password remap_schema=test0:test1 dumpfile=test0.dmp

    ...
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    ORA-39083: Object type INDEX_STATISTICS failed to create with error:
    ORA-01403: no data found
    ORA-01403: no data found
    Failing sql is:
    DECLARE IND_NAME VARCHAR2(60); IND_OWNER VARCHAR2(60); BEGIN DELETE FROM "SYS"."IMPDP_STATS";
    SELECT index_name, index_owner INTO IND_NAME, IND_OWNER
    FROM (SELECT UNIQUE sgc1.index_name, sgc1.index_owner,
    COUNT(*) mycount
    FROM sys.ku$_find_sgc_view sgc1,
    TABLE (sgc1.col_list) myc
    Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    Processing object type SCHEMA_EXPORT/POST_SCHEMA/PROCACT_SCHEMA

    4. Open a sqlplus session to check objects created for the import process under "TEST1" schema.
    #> sqlplus test1/password
    col object_name for a30 
    SELECT OBJECT_NAME, OBJECT_TYPE FROM USER_OBJECTS; 
    
    OBJECT_NAME                    OBJECT_TYPE 
    ------------------------------ ------------------- 
    TEST0                          TABLE 
    TEST0INDEX                     INDEX
    5. The index with the system generated name is missing because the primary key constraint was created in

    the source database without providing a name and before the named index was created, so an index with a
    system generated name was created to facilitate this primary key constraint. Upon import, Data Pump first
    imports the indexes (i.e. only the named index TEST0INDEX), and then imports the constraints. When creating the primary
    key constraint, we can use the existing named index, so there is no need for the system generated index anymore,
    and hence it won't be created. When import tries to import the statistics for the system generated index later on,
    it fails because the system generated index is missing.
    This behavior was reported in: Bug 8615836 - ORA-1403 OCCURS DURING IMPORTING TABLE_STATISTICS IN IMPDP, closed as not feasible to fix.

    总结:

       1.可以忽略,不做处理,或者如何避免这个报错出现?

         1)导入数据+约束(唯一约束or主键会自动创建索引),排除索引

      2)只导入索引

    $ impdp system/password remap_schema=test0:test1 exclude=index dumpfile=test0.dmp 
    $ impdp system/password remap_schema=test0:test1 include=index dumpfile=test0.dmp

    2.Oracle会啥提供这个方法?

      如果在源端主键或者唯一约束所在的列,存在多个索引,且约束对应的索引是系统创建的。

      在导入的过程中,数据泵导入是有先后顺序的!

    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    . . imported "ODS_STAGE_CRBS"."T_POLICY_PRODUCT"         105.5 GB 1561574110 rows
    . . imported "ODS_STAGE_CRBS"."T_POLICY"                 37.01 GB 416732355 rows
    Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
    Processing object type TABLE_EXPORT/TABLE/COMMENT
    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/CONSTRAINT/REF_CONSTRAINT
    Processing object type TABLE_EXPORT/TABLE/TRIGGER
    Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

    根据上述顺序可以发现,导入是先导入表数据,在创建对应的索引,后续对表的列添加约束,最后对表的索引统计信息进行导入!

    1.创建主键或者唯一约束的列索引后;

    2.再次基础上添加约束,会使用之前创建的索引,而无需再次创建系统名称对应的索引!

    3.因此再次导入系统生成的索引统计信息,当然找不到对象咯。

     When import tries to import the statistics for the system generated index later on, it fails because the system generated index is missing.

  • 相关阅读:
    java8大排序
    如何删除oracle 的用户及其数据
    JavaScript开发者常忽略或误用的七个基础知识点
    Vim学习指南
    5个开发人员不应该错过的最好跨平台PHP编辑器
    OpenGL 简介
    web 页面内容优化管理与性能技巧
    创建高性能移动 web 站点
    近期十大优秀jQuery插件推荐
    30本世界名著浓缩成的经典话语
  • 原文地址:https://www.cnblogs.com/lvcha001/p/13137797.html
Copyright © 2011-2022 走看看