{データポンプ}データポンプでデータを移動

 

https://docs.oracle.com/cd/F19136_01/sutil/oracle-data-pump-export-utility.html#GUID-FCB1FA15-5798-48C0-85ED-08E9DAC5E687

             スキーマ変換

-- orcl PROD1
create directory ORA_DIR as '/home/oracle';


expdp system/oracle@orcl directory=ORA_DIR dumpfile=test.dmp schemas=test 
impdp system/oracle@PROD1 directory=ORA_DIR dumpfile=test.dmp schemas=test remap_schema=test:test2


             表領域変換


-- PROD1

create tablespace tbsa datafile '/oradata/PROD1/tbsa01.dbf'
 size 10M autoextend on maxsize unlimited
 extent management local autoallocate
 segment space management auto;

drop user test cascade;
create user test identified by test
default tablespace tbsa
quota unlimited on tbsa;


expdp system/oracle@orcl directory=ORA_DIR dumpfile=test.dmp schemas=test reuse_dumpfiles=yes
impdp system/oracle@PROD1 directory=ORA_DIR dumpfile=test.dmp schemas=test remap_tablespace=users:tbsa

 


             テーブル名変更


expdp system/oracle@orcl directory=ORA_DIR dumpfile=test.dmp tables=test.tab1 reuse_dumpfiles=yes
impdp system/oracle@orcl directory=ORA_DIR dumpfile=test.dmp tables=test.tab1 remap_table=test.tab1:tab2 content=all

 


             抽出条件ありの場合

expdp system/oracle@orcl directory=ORA_DIR dumpfile=tab1.dmp tables=test.tab1 query=test.tab1:\"where col1=2\"
impdp system/oracle@orcl directory=ORA_DIR dumpfile=tab1.dmp tables=test.tab1 content=data_only