oracle 数据泵 详解

时间:2024-01-07 15:52:02

导出数据

1)按用户导

expdp scott/tiger@orcl schemas=scott dumpfile=expdp.dmp DIRECTORY=dir logfile=expdp.log

2)并行进程parallel

expdp scott/tiger@orcl directory=dir dumpfile=scott3.dmp parallel=40 job_name=scott3

3)按表名导

expdp scott/tiger@orcl TABLES=emp,dept dumpfile=expdp.dmp DIRECTORY=dir;

4)按查询条件导

expdp scott/tiger@orcl directory=dir dumpfile=expdp.dmp Tables=emp query='WHERE deptno=20';

5)按表空间导

expdp system/manager DIRECTORY=dir DUMPFILE=tablespace.dmp TABLESPACES=temp,example;

6)导整个数据库

expdp system/manager DIRECTORY=dir DUMPFILE=full.dmp FULL=y;
还原数据

1)导到指定用户下

impdp scott/tiger@orcl DIRECTORY=dir DUMPFILE=expdp.dmp SCHEMAS=scott logfile=impdp.log

2)改变表的owner

impdp system/manager DIRECTORY=dir DUMPFILE=expdp.dmp TABLES=scott.dept REMAP_SCHEMA=scott:system;

3)导入表空间

impdp system/manager DIRECTORY=dir DUMPFILE=tablespace.dmp TABLESPACES=example;

4)导入数据库

impdb system/manager DIRECTORY=dump_dir DUMPFILE=full.dmp FULL=y;

5)追加数据

impdp system/manager DIRECTORY=dir DUMPFILE=expdp.dmp SCHEMAS=system TABLE_EXISTS_ACTION