欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

expdp 使用参数文件

程序员文章站 2022-03-12 18:22:12
...

os: centos 7.4
db: oracle 11.2.0.4

directory

# su - oracle
$ mkdir peiyb
$ cd peiyb
$ pwd
/home/oracle/peiyb

SQL> set lines 300;
set pages 300;
col owner format a10;
col directory_name format a30;
col directory_path format a70;

SQL> 
SQL> select * from dba_directories;

OWNER	   DIRECTORY_NAME		  DIRECTORY_PATH
---------- ------------------------------ ----------------------------------------------------------------------
SYS	       SUBDIR			      /u01/app/oracle/product/11.2.0/db_1/demo/schema/order_entry//2002/Sep
SYS	       SS_OE_XMLDIR 		  /u01/app/oracle/product/11.2.0/db_1/demo/schema/order_entry/
SYS	       LOG_FILE_DIR 		  /u01/app/oracle/product/11.2.0/db_1/demo/schema/log/
SYS	       MEDIA_DIR			  /u01/app/oracle/product/11.2.0/db_1/demo/schema/product_media/
SYS	       DATA_FILE_DIR		  /u01/app/oracle/product/11.2.0/db_1/demo/schema/sales_history/
SYS	       XMLDIR			      /u01/app/oracle/product/11.2.0/db_1/rdbms/xml
SYS	       ORACLE_OCM_CONFIG_DIR  /u01/app/oracle/product/11.2.0/db_1/ccr/hosts/node1/state
SYS	       DATA_PUMP_DIR		  /u01/app/oracle/product/11.2.0/db_1/rdbms/log/
SYS	       ORACLE_OCM_CONFIG_DIR2 /u01/app/oracle/product/11.2.0/db_1/ccr/state

9 rows selected.

SQL> create directory PEIYB_DATA_PUMP_DIR as '/home/oracle/peiyb/';

Directory created.

expdp

$ vi expdp.par

userid='/ as sysdba'
directory=PEIYB_DATA_PUMP_DIR
dumpfile=expdp_20200227_%U.dmp
job_name=expdp_20200227
logfile=expdp_20200227.log
cluster=n
compression=all
content=data_only
filesize=10g
parallel=4
tables=scott2.tmp_t0

使用 nohup ,预防连接断开

$ nohup expdp parfile=expdp.par & 

$ tail -f nohup.out 

Export: Release 11.2.0.4.0 - Production on Wed Feb 26 13:51:06 2020

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Starting "SYS"."EXPDP_20200227":  /******** AS SYSDBA parfile=expdp.par 
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
. . exported "SCOTT2"."TMP_T0"                           6.148 KB    1000 rows
Master table "SYS"."EXPDP_20200227" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.EXPDP_20200227 is:
  /home/oracle/peiyb/expdp_20200227_01.dmp
  /home/oracle/peiyb/expdp_20200227_02.dmp
Job "SYS"."EXPDP_20200227" successfully completed at Wed Feb 26 13:51:10 2020 elapsed 0 00:00:03

查看 directory 下生成的文件

$ ls -l /home/oracle/peiyb/
total 44
-rw-r----- 1 oracle asmadmin 12288 Feb 26 13:51 expdp_20200227_01.dmp
-rw-r----- 1 oracle asmadmin 20480 Feb 26 13:51 expdp_20200227_02.dmp
-rw-r--r-- 1 oracle asmadmin  1044 Feb 26 13:51 expdp_20200227.log
-rw-r--r-- 1 oracle oinstall   222 Feb 26 13:48 expdp.par
-rw------- 1 oracle oinstall  1037 Feb 26 13:51 nohup.out