{外部表}2つのダンプファイルを用いて外部表を作成

 

https://docs.oracle.com/cd/F19136_01/sutil/oracle_datapump-access-driver.html#GUID-5CEDE96D-98D5-4D1A-9198-0312FBA41D98


drop table tab1 purge;
create table tab1(col1 int);
insert into tab1 values(1);
insert into tab1 values(2);
insert into tab1 values(3);
commit;
select * from tab1;

 


!rm -rf ext_dmp_1.dmp ext_dmp_2.dmp

drop table ext_dmp;

CREATE TABLE ext_dmp
   ORGANIZATION EXTERNAL
   (
     TYPE ORACLE_DATAPUMP
     DEFAULT DIRECTORY ORA_DIR
     LOCATION ('ext_dmp_1.dmp')
   )
 AS SELECT * FROM tab1 WHERE col1 < 2;


drop table ext_dmp;

CREATE TABLE ext_dmp
   ORGANIZATION EXTERNAL
   (
     TYPE ORACLE_DATAPUMP
     DEFAULT DIRECTORY ORA_DIR
     LOCATION ('ext_dmp_2.dmp')
   )
 AS SELECT * FROM tab1 WHERE col1 >= 2;

 

drop table ext_dmp_all;

CREATE TABLE ext_dmp_all
   (
     COL1          NUMBER
   )
   ORGANIZATION EXTERNAL
   (
     TYPE ORACLE_DATAPUMP
     DEFAULT DIRECTORY ORA_DIR
     LOCATION ('ext_dmp_1.dmp','ext_dmp_2.dmp')
   );

select * from tab1;
select * from ext_dmp_all;