expdp:
官方文档位置:
Data Warehousing and Business Intelligence ->Supporting Documentation(Utilities) -> 2 Data Pump Export
***********************************************************************************************************************************
Data Pump export modes
***********************************************************************************************************************************
Full Export Mode
expdp system/oracle directory=DATA_PUMP_DIR dumpfile=expdp.dmp full=yes NOLOGFILE=YES
使用sys备份scott用户 不计日志 开启并行
expdp hr PARFILE=hr.par
expdp \'sys/oracle as sysdba\' directory=DATA_PUMP_DIR schemas=scott dumpfile=expdp.dmp NOLOGFILE=YES PARALLEL=4
#也可以把备份命令写入一个.par的文件中
vi scott.par
schemas=scott
directory=DATA_PUMP_DIR
dumpfile=expdp.dmp
NOLOGFILE=YES
PARALLEL=4
INCLUDE=TABLE:"IN('EMP','DEPT')"
INCLUDE=PROCEDURE
expdp \'sys/oracle as sysdba\' parfile=scott.par
***********************************************************************************************************************************
#执行脚本
[oracle@oracle ~]$ expdp \'sys/oracle as sysdba\' parfile=scott.par
Export: Release 11.2.0.3.0 - Production on Thu Oct 11 17:08:15 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_SCHEMA_01": "sys/******** AS SYSDBA" parfile=scott.par
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
. . exported "SCOTT"."EMP" 8.562 KB 14 rows
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
ORA-39168: Object path PROCEDURE was not found.
Master table "SYS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_SCHEMA_01 is:
/u01/app/oracle/admin/PROD/dpdump/expdp.dmp
Job "SYS"."SYS_EXPORT_SCHEMA_01" completed with 1 error(s) at 17:08:20
*/
#也可以写查询条件,导出特定条件的数据
vi scott_where.par
directory=DATA_PUMP_DIR
dumpfile=expdp.dmp
NOLOGFILE=YES
PARALLEL=4
QUERY=SCOTT.EMP:"where empno=7788"
#执行脚本
[oracle@oracle ~]$ expdp \'sys/oracle as sysdba\' parfile=scott_where.par
Export: Release 11.2.0.3.0 - Production on Thu Oct 11 17:27:43 2018
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_SCHEMA_01": "sys/******** AS SYSDBA" parfile=scott_where.par
Estimate in progress using BLOCKS method...
Total estimation using BLOCKS method: 0 KB
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Master table "SYS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_SCHEMA_01 is:
/u01/app/oracle/admin/PROD/dpdump/expdp.dmp
Job "SYS"."SYS_EXPORT_SCHEMA_01" successfully completed at 17:27:53
*/
expdp scott/scott directory=DATA_PUMP_DIR DUMPFILE=scott.dmp tables=EMP CONTENT= METADATA_ONLY
***********************************************************************************************************************************
#导出表空间
vi tablespace.par
directory=DATA_PUMP_DIR
DUMPFILE=tablespace.dmp
TRANSPORT_TABLESPACES=LFN_NFS
TRANSPORT_FULL_CHECK=NO
expdp \'sys/oracle as sysdba\' parfile=tablespace.par