Oracle EXPDP和IMPDP指令详解

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-28 01:37   32   0
概要

Oracle 11g及以上版本提供了数据泵技术,可以用来进行数据库的逻辑备份和恢复,Oracle建议使用数据泵来代替EXP和IMP技术。数据泵技术基于Oracle数据库服务器,导入导出的数据文件也保存在数据库服务器端,而EXP/IMP基于客户机运行。利用数据泵技术,Oracle要求必须使用目录对象,以防止用户误操作服务器上特定目录下的操作系统文件。

EXPDP数据访问方法
外部表:从操作系统文件中读取数据;
直接路径:使用直接路径API,很好改善了导入导出性能,因为内部流的数据格式和存储在备份文件中的数据格式相同,减少了数据转换的时间。

查询默认的目录对象
SQL> set linesize 200
SQL> SELECT * FROM dba_directories t
  2  WHERE t.directory_name = 'DATA_PUMP_DIR';

OWNER                          DIRECTORY_NAME                 DIRECTORY_PATH
------------------------------ ------------------------------ -----------------------------------
SYS                            DATA_PUMP_DIR                  E:\app\alen.liu\admin\orcl\dpdump\
创建恢复目录需要CREATE ANY DIRECTORY权限;
SQL> grant create any directory to scott;

Grant succeeded.

SQL> alter session set current_schema=scott;

Session altered.

SQL> create directory scott_pump as 'd:\pump';

Directory created.

SQL>
EXPDP导出技术演示

EXPDP参数
D:\backup>expdp help=y

Export: Release 11.2.0.1.0 - Production on Tue Jun 27 17:13:24 2017

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


The Data Pump export utility provides a mechanism for transferring data objects
between Oracle databases. The utility is invoked with the following command:

   Example: expdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp

You can control how Export runs by entering the 'expdp' command followed
by various parameters. To specify parameters, you use keywords:

   Format:  expdp KEYWORD=value or KEYWORD=(value1,value2,...,valueN)
   Example: expdp scott/tiger DUMPFILE=scott.dmp DIRECTORY=dmpdir SCHEMAS=scott
               or TABLES=(T1:P1,T1:P2), if T1 is partitioned table

USERID must be the first parameter on the command line.

------------------------------------------------------------------------------

The available keywords and their descriptions follow. Default values are listed within square brackets.

ATTACH
Attach to an existing job.
For example, ATTACH=job_name.

COMPRESSION
Reduce the size of a dump file.
Valid keyword values are: ALL, DATA_ONLY, [METADATA_ONLY] and NONE.

CONTENT
Specifies data to unload.
Valid keyword values are: [ALL], DATA_ONLY and METADATA_ONLY.

DATA_OPTIONS
Data layer option flags.
Valid keyword values are: XML_CLOBS.

DIRECTORY
Directory object to be used for dump and log files.

DUMPFILE
Specify list of destination dump file names [expdat.dmp].
For example, DUMPFILE=scott1.dmp, scott2.dmp, dmpdir:scott3.dmp.

ENCRYPTION
Encrypt part or all of a dump file.
Valid keyword values are: ALL, DATA_ONLY, ENCRYPTED_COLUMNS_ONLY, METADATA_ONLY and NONE.

ENCRYPTION_ALGORITHM
Specify how encryption should be done.
Valid keyword values are: [AES128], AES192 and AES256.

ENCRYPTION_MODE
Method of generating encryption key.
Valid keyword values are: DUAL, PASSWORD and [TRANSPARENT].

ENCRYPTION_PASSWORD
Password key for creating encrypted data within a dump file.

ESTIMATE
Calculate job estimates.
Valid keyword values are: [BLOCKS] and STATISTICS.

ESTIMATE_ONLY
Calculate job estimates without performing the export.

EXCLUDE
Exclude specific object types.
For example, EXCLUDE=SCHEMA:"='HR'".

FILESIZE
Specify the size of each dump file in units of bytes.

FLASHBACK_SCN
SCN used to reset session snapshot.

FLASHBACK_TIME
Time used to	
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP