Oracle Datapump相关操作汇总

--create directory
create directory dump_dir as '/splex/dump';
grant read,write on directory dump_dir to public;

--export full database schema
expdp user/password content=metadata_only cluster=no full=y directory=dump_dir dumpfile=expdp_full_schema.dmp logfile=expdp_full_schema.log

--export  full database
expdp user/password content=all cluster=no full=y directory=dump_dir dumpfile=expdp_full.dmp logfile=expdp_full.log

--export  users schema
expdp user/password schemas=user1,user2,user3 content=metadata_only cluster=no exclude=statistics directory=dump_dir dumpfile=expdp_users_schema.dmp logfile=expdp_users_schema.log

--export  users schema and data
expdp user/password schemas=user1,user2,user3 content=all cluster=no PARALLEL=4 FILESIZE=20480M exclude=statistics directory=dump_dir dumpfile=expdp_users_%U.dmp logfile=expdp_users.log

--export tables schema
expdp user/password tables=tab1,tab2,tab3 content=metadata_only cluster=no exclude=statistics directory=dump_dir dumpfile=expdp_tables_schema.dmp logfile=expdp_tables_schema.log

--export tables schema and data
expdp user/password tables=tab1,tab2,tab3 content=all cluster=no PARALLEL=4 FILESIZE=20480M exclude=statistics directory=dump_dir dumpfile=expdp_tables_%U.dmp logfile=expdp_tables.log
network_link=dblink_name  --export remote database by dblink

--export tables schema and data using compress
expdp user/password tables=tab1,tab2,tab3 content=all  cluster=no PARALLEL=4 FILESIZE=20480M exclude=statistics directory=dump_dir dumpfile=expdp_tables_%U.dmp logfile=expdp_tables.log
compression=all --对元数据和表数据进行压缩,11g开始支持
compression=data_only  --对表数据进行压缩,11g开始支持
compression=metadata_only --对元数据进行压缩,10g开始支持,默认方式

--import schema or data
impdp user/password directory=dump_dir dumpfile=expdp.dmp logfile=impdp.log ignore=y

--import schema or data using parallel
impdp user/password directory=dump_dir PARALLEL=4 dumpfile=expdp_%U.dmp  logfile=impdp.log ignore=y
--REMAP_SCHEMA=schema1:schema2  --不同用户之间的数据迁移
--REMAP_TABLESPACE=tbs1:tbs2  ---不同表空间之间的数据迁移
--REMAP_TABLE=schema1.tab1:tab2  ---相同schema不同表之间的数据迁移
--REMAP_TABLE=schema1.tab1:tab2 REMAP_SCHEMA=schema1:schema2  ---不同schema不同表之间的数据迁移
--TABLE_EXISTS_ACTION=SKIP --跳过已经存在的表
--TABLE_EXISTS_ACTION=APPEND --追加数据至已经存在的表,但不影响已经存在的数据,这是默认行为
--TABLE_EXISTS_ACTION=TRUNCATE --truncate已经存在的表的数据,保留表结构,然后进行数据导入
--TABLE_EXISTS_ACTION=REPLACE --drop 已经存在的表,然后进行数据导入
posted @ 2021-05-28 15:00  踏雪无痕2017  阅读(115)  评论(0)    收藏  举报