truncate表後impdp匯入該表時加exclude=index引數並不能排除索引資料的匯入

2008081036發表於2014-05-21
1.truncate表:
SQL> truncate table GCADJUSTMENTMAIN;


Table truncated.

 XIEZQ使用者下只有一個表:
SQL> SELECT segment_name, SUM (bytes) / 1024 / 1024
  2    FROM dba_segments
  3   WHERE owner = 'XIEZQ' AND segment_name LIKE 'PK%' or segment_name like 'IDX%' group by segment_name;


SEGMENT_NAME                   SUM(BYTES)/1024/1024
------------------------------ --------------------
IDX_ADJUST_CLAIMNO                            .0625
IDX_ADJUST_UNDERWRITEENDDATE                  .0625
IDX_ADJUST_UNDERWRITEIND                      .0625
IDX_ADJUST_REGISTNO                           .0625
PK_GCADJUSTMENTMAIN                               6
IDX_ADJUST_COMPANYCODE                        .0625
IDX_ADJUST_LASTOPCOD                          .0625
IDX_ADJUST_POLICYNO                           .0625
IDX_ADJUST_INPUTDATE                          .0625


9 rows selected.

2.開始匯入該表:
[oracle@node1 ~]$ cat par_impdp_GCADJUSTMENTMAIN
directory=DUMP_DIR
dumpfile=20140519_GCADJUSTMENTMAIN_%U.dmp
logfile=impdp_GCADJUSTMENTMAIN_20140520.log
tables=tpprod.GCADJUSTMENTMAIN
remap_schema=tpprod:xiezq
REMAP_TABLESPACE=TBLSPACE_OTH:USERS
parallel=4
job_name=impdp_GCADJUSTMENTMAIN
exclude=INDEX
status=30
TABLE_EXISTS_ACTION=truncate

[oracle@node1 ~]$ impdp xiezq parfile=par_impdp_GCADJUSTMENTMAIN


Import: Release 11.2.0.4.0 - Production on Wed May 21 11:11:03 2014


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Password: 


Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
......

3.此時可以看到索引資料還是在漲的:
SQL> SELECT segment_name, SUM (bytes) / 1024 / 1024
  2    FROM dba_segments
  3   WHERE owner = 'XIEZQ' AND segment_name LIKE 'PK%' or segment_name like 'IDX%' group by segment_name;


SEGMENT_NAME                   SUM(BYTES)/1024/1024
------------------------------ --------------------
IDX_ADJUST_CLAIMNO                               31
IDX_ADJUST_UNDERWRITEENDDATE                     14
IDX_ADJUST_UNDERWRITEIND                         15
IDX_ADJUST_REGISTNO                              31
PK_GCADJUSTMENTMAIN                              33
IDX_ADJUST_COMPANYCODE                           23
IDX_ADJUST_LASTOPCOD                             19
IDX_ADJUST_POLICYNO                              31
IDX_ADJUST_INPUTDATE                             20


9 rows selected.

 4.結論
          雖然加了exclude=index引數,但匯入時依然會匯入索引資料。

          這種情況下,如果不想匯入索引資料,在truncate表後,可以把表上的索引drop掉,然後用exclude=index引數導完表資料後,再用include=index引數匯入索引。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25465866/viewspace-1165892/,如需轉載,請註明出處,否則將追究法律責任。

相關文章