2012-11-08 10 views
0

한 데이터베이스에서 다른 데이터베이스로 데이터를 효율적으로 복사해야합니다. 둘 다 Oracle 11g를 기반으로합니다.Oracle 데이터 펌프를 기존 테이블로 가져 오기

  1. 단계 : (재) 새로 만든 테이블
  2. 단계 : 설치 PL의 SQL 패키지
  3. 단계 : 수출 테이블 expdp를 가진 데이터베이스 1 tab_old1 및 tab_old2
  4. 단계 : tab_new1 및 tab_new2 데이터베이스 2로 수입 impdp와
  5. + X 단계 : 사용은 PL의 SQL 프로 시저를 설치

도전 : 는 PL SQL 절차는 답답를 사용 eady tab_new1 및 tab_new2. 따라서 1 단계와 2 단계에서 두 테이블을 만듭니다. 3 단계와 4 단계에서 데이터 만 가져오고 내 보냅니다. 그러나 tab_new1 및 tab_new2에는 추가 열 -> 가져 오기가 실패했습니다. 새 열이없는보기를 만들려고했습니다.

ORA-31693: Table data object "Schema"."tab_old1" failed to load/unload and is being skipped due to error: 
ORA-31603: object “tab_old1” of type TABLE not found in schema “Schema” 

ORA-31693: Table data object "Schema"."tab_old2" failed to load/unload and is being skipped due to error: 
ORA-31603: object “tab_old2” of type TABLE not found in schema “Schema” 

견해가 tab_old1 및 tab_old2라고하지만, 물론 그들은 형 테이블의 수 없습니다 :

가져 오기 다음과 같은 오류 메시지와 함께 실패합니다.

아이디어가 있으십니까?

추가 열이있는 기존 테이블의 tab_old1에서 데이터를 가져올 수 있습니까?

첫 번째 단계에서 테이블을 내보내고 가져오고 이름을 바꾸고 나중에 pl sqls 프로 시저를 설치하고 싶지 않습니다.

도와 주시겠습니까?

편집 : 당신의 대답에 대한

감사합니다. 나는 당신의 예제를 두 번 시도했지만 remap_table 함수는 나를 위해 작동하지 않습니다. 가져 오기 : 릴리스 11.1.0.6.0 - 64 비트 생산.

편집 2 : 예. 그것은 내 오라클 버전의 문제로 보인다. remap_table 함수는 무시됩니다. 나는 remap_table = not.existing/table과 같은 헛소리를 쓸 수 있고 impdp는 그것에 대해 똥을주지 않는다. 글쎄, 나는이 문제를 해결할 시간이 없다. 나는 일을해야한다. 어쨌든 당신의 도움에 감사드립니다.

답변

3

ok 그렇다면 content = data_only로 가져오고 tab_old1을 tab_new1로 바꾼 다음 몇 개의 열을 추가 했습니까?

= remap_table tab_old1을 넣어 가져 오기 지정하는 경우 : tab_new1

이 한 새로운 열이 널 (NULL)로 작동됩니다.

예 :

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 
+0

대단히 감사드립니다. 제 원래 게시물을 편집했습니다. – user1328819

+0

편집에서 foo : foo2를 넣었고 실제 테이블 이름 등은 넣지 않았습니다. 올바르게 대체 했습니까? 귀하의 실제 명령과 출력을 넣어주세요 – DazzaL

+0

방금 ​​새로운 사용자와 새 테이블을 만들었습니다. 이것들은 제 실제 명령과 결과물입니다. edit2 – user1328819