truncate表後impdp匯入該表時加exclude=index引數並不能排除索引資料的匯入
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引數匯入索引。
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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【impdp】使用impdp工具排除特定表的匯入
- 然後再全庫匯入排除view資料庫在impdp匯入View資料庫
- oracle排除表匯入匯出Oracle
- impdp匯入資料後,system 表空間整理
- 使用EXPDP/IMPDP匯入匯出表中資料/後設資料測試
- 【IMPDP】當匯入資料時遭遇表已存時的應對手段——TABLE_EXISTS_ACTION引數
- Oracle 11g impdp 先資料後索引匯入方法Oracle索引
- Progress資料表的匯入匯出
- mysqldump匯入匯出表資料MySql
- 資料泵匯出匯入表
- Impdp資料泵匯入
- Excel 表匯入資料Excel
- Oracle表table與索引index的分析及索引重建及統計資訊匯入匯出Oracle索引Index
- 【impdp】IMPDP中的TRANSFORM引數--【資料泵】EXPDP匯出表結構(真實案例)後傳ORM
- MySQL表資料匯入與匯出MySql
- Mysql匯入大表檔案時注意修改引數MySql
- Oracle 12c expdp和impdp匯出匯入表Oracle
- 將資料匯入kudu表(建立臨時hive表,從hive匯入kudu)步驟Hive
- impdp做資料匯入時約束和觸發器引起資料匯入後應用故障觸發器
- 【imp】使用imp工具遷移資料時迂迴地排除特定表的匯入
- 【匯出匯入】IMPDP table_exists_action 引數的應用
- Oracle資料泵匯出匯入(expdp/impdp)Oracle
- ClickHouse 資料表匯出和匯入(qbit)
- 匯入匯出 Oracle 分割槽表資料Oracle
- Oracle使用資料泵匯出匯入表Oracle
- impdp匯入時使用table_exists_action引數的區別
- DB2資料庫匯出表結構與匯入、匯出表資料DB2資料庫
- 使用資料泵impdp匯入資料
- 【IMPDP】使用IMPDP自動建立使用者並完成資料的匯入
- 資料庫泵(expdp/impdp)匯入匯出流程資料庫
- 使用PARTITION_OPTIONS引數控制資料泵分割槽表匯入
- 資料泵IMPDP 匯入工具的使用
- IMPDP匯入遠端資料庫資料庫
- 分割槽表匯入資料庫資料庫
- Truncate資料表背後的幾個引數(上)
- Truncate資料表背後的幾個引數(下)
- 將表匯入到其他使用者的impdp命令
- 只匯入表結構及索引的方法索引