39154错误的解决案例(2)


#####是否因为ad用户是一个普通用户没有权限在mng用户下建索引?于是用sysdba身份再次执行impdp,报错依旧
 impdp \"/ as sysdba\" directory=tmpdir dumpfile=ad.adtab1.dmp logfile=imp_ad.adtab1.log
 Master table "SYS"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
 Starting "SYS"."SYS_IMPORT_FULL_01":  "/******** AS SYSDBA" directory=tmpdir dumpfile=ad.adtab1.dmp logfile=imp_ad.adtab1.log
 Processing object type TABLE_EXPORT/TABLE/TABLE
 Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
 . . imported "AD"."ADTAB1"                              6.781 KB      45 rows
 Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
 ORA-39083: Object type INDEX_STATISTICS failed to create with error:
 ORA-20000: INDEX "MNG"."IND_ADTAB1_UID" does not exist or insufficient privileges
 Failing sql is:
 DECLARE I_N VARCHAR2(60);  I_O VARCHAR2(60);  NV VARCHAR2(1);  c DBMS_METADATA.T_VAR_COLL;  df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS';  stmt varchar2(300) := ' INSERT INTO "SYS"."IMPDP_STATS" (type,version,flags,c1,c2,c3,c5,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,d1,cl1) VALUES (''I'',6,:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,NULL,:14,:
 ORA-39083: Object type INDEX_STATISTICS failed to create with error:
 ORA-20000: INDEX "MNG"."IND_ADTAB1_CRT" does not exist or insufficient privileges
 Failing sql is:
 DECLARE I_N VARCHAR2(60);  I_O VARCHAR2(60);  NV VARCHAR2(1);  c DBMS_METADATA.T_VAR_COLL;  df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS';  stmt varchar2(300) := ' INSERT INTO "SYS"."IMPDP_STATS" (type,version,flags,c1,c2,c3,c5,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,d1,cl1) VALUES (''I'',6,:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,NULL,:14,:
 Job "SYS"."SYS_IMPORT_FULL_01" completed with 2 error(s) at 08:50:27


 SQL> select count(*) from adtab1;


  COUNT(*)
 ----------
        45


 SQL> select index_name,table_name from dba_indexes where table_name='ADTAB1';


 no rows selected


使用sysdba用户导入时也报相同的错误,应该不是由于权限问题引起的,报错信息出现在导入索引统计信息的阶段,因为MNG用户下的两个索引不存在导致了ORA-39083,难道是导出的dmp文件里压根就没有包含这两个索引的信息?
#####将impdp内容重定向到脚本文件,发现脚本里确实没有这两个索引的DDL语句
impdp \"/ as sysdba\" directory=tmpdir dumpfile=ad.adtab1.dmp logfile=imp_ad.adtab1.log sqlfile=ad.adtab1.sql


---ad.adtab1.sql内容,发现除了建表和导入索引的统计信息外,没有create index的步骤
-- CONNECT SYS
 ALTER SESSION SET EVENTS '10150 TRACE NAME CONTEXT FOREVER, LEVEL 1';
 ALTER SESSION SET EVENTS '10904 TRACE NAME CONTEXT FOREVER, LEVEL 1';
 ALTER SESSION SET EVENTS '25475 TRACE NAME CONTEXT FOREVER, LEVEL 1';
 ALTER SESSION SET EVENTS '10407 TRACE NAME CONTEXT FOREVER, LEVEL 1';
 ALTER SESSION SET EVENTS '10851 TRACE NAME CONTEXT FOREVER, LEVEL 1';
 ALTER SESSION SET EVENTS '22830 TRACE NAME CONTEXT FOREVER, LEVEL 192 ';
 -- new object type path: TABLE_EXPORT/TABLE/TABLE
 CREATE TABLE "AD"."ADTAB1"
    (    "USERNAME" VARCHAR2(30 BYTE) NOT NULL ENABLE,
        "USER_ID" NUMBER NOT NULL ENABLE,
        "CREATED" DATE NOT NULL ENABLE
    ) SEGMENT CREATION IMMEDIATE
  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
  NOCOMPRESS LOGGING
  STORAGE(INITIAL 8388608 NEXT 8388608 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "TS_PUB" ;
 -- new object type path: TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
 DECLARE I_N VARCHAR2(60);
  I_O VARCHAR2(60);
  NV VARCHAR2(1);
  c DBMS_METADATA.T_VAR_COLL;
  df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS';
  stmt varchar2(300) := ' INSERT INTO "SYS"."IMPDP_STATS" (type,version,flags,c1,c2,c3,c5,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,d1,cl1) VALUES (''I'',6,:1,:2,:3,:4,:5,:6,:7,:8,:
 9,:10,:11,:12,:13,NULL,:14,:15,NULL,:16,:17)';
 BEGIN
  DELETE FROM "SYS"."IMPDP_STATS";
  i_n := 'IND_ADTAB1_UID';
  i_o := 'MNG';
  EXECUTE IMMEDIATE stmt USING 0,I_N,NV,NV,I_O,45,1,45,1,1,1,0,45,NV,NV,TO_DATE('2015-01-24 08:16:45',df),NV;

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/d6a57e1ee51c8c5a56170c65e7a4fb52.html