好的,所以您使用 content=data_only 进行导入,并且您已将 tab_old1 重命名为 tab_new1 并添加了几列?
指定导入时放 remap_table=tab_old1:tab_new1
只要新列可以为空,这将起作用。
例如:
SQL> create table foo(id number);
Table created.
SQL> insert into foo select rownum from dual connect by level <= 5;
5 rows created.
SQL> commit;
Commit complete.
SQL> host expdp test/test tables=foo directory=data_pump_dir
Export: Release 11.2.0.2.0 - Production on Thu Nov 8 15:40:18 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "TEST"."SYS_EXPORT_TABLE_01": test/******** tables=foo directory=data_pump_dir
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . exported "TEST"."FOO" 5.031 KB 5 rows
Master table "TEST"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for TEST.SYS_EXPORT_TABLE_01 is:
/u01/app/oracle/admin/dtd64bit1/dpdump/expdat.dmp
Job "TEST"."SYS_EXPORT_TABLE_01" successfully completed at 15:40:30
SQL> delete from foo;
5 rows deleted.
SQL> alter table foo add (a varchar2(200));
Table altered.
SQL> alter table foo rename to foo2;
Table altered.
和你原来的错误?
SQL> host impdp test/test tables=foo directory=data_pump_dir content=data_only
Import: Release 11.2.0.2.0 - Production on Thu Nov 8 15:42:17 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "TEST"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "TEST"."SYS_IMPORT_TABLE_01": test/******** tables=foo directory=data_pump_dir content=data_only
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
ORA-39034: Table TABLE_DATA:"TEST"."FOO" does not exist.
ORA-39126: Worker unexpected fatal error in KUPW$WORKER.UPATE_TD_ROW_IMP [15]
TABLE_DATA:"TEST"."FOO"
ORA-31603: object "FOO" of type TABLE not found in schema "TEST"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.KUPW$WORKER", line 8641
所以重新映射..
SQL> host impdp test/test tables=foo remap_table=foo:foo2 directory=data_pump_dir content=data_only
Import: Release 11.2.0.2.0 - Production on Thu Nov 8 15:42:33 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "TEST"."SYS_IMPORT_TABLE_02" successfully loaded/unloaded
Starting "TEST"."SYS_IMPORT_TABLE_02": test/******** tables=foo remap_table=foo:foo2 directory=data_pump_dir content=data_only
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "TEST"."FOO2" 5.031 KB 5 rows
Job "TEST"."SYS_IMPORT_TABLE_02" successfully completed at 15:42:37
SQL> select * from foo2;
ID A
---------- ----------
1
2
3
4
5