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 @   踏雪无痕2017  阅读(101)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
点击右上角即可分享
微信分享提示