expdp和impdp数据泵

简介:

COMPRESSION={METADATA_ONLY | NONE}        --数据压缩

CONTENT={ALL | DATA_ONLY | METADATA_ONLY}  --指定导出的内容(当设置CONTENT为ALL时,会导出对象元数据及对象数据;当设置为DATA_ONLY时,只导出对象数据;当设置为METADATA_ONLY时,只导出对象元数据。)

DIRECTORY=directory_object           --备份文件存储的路径

DUMPFILE=[directory_object:]file_name [, ...]   --directory_object用于指定目录对象名,file_name用于指定转储文件名。如果不给定directory_object,导出工具会自动使用DIRECTORY选项指定的目录对象。

ESTIMATE={BLOCKS | STATISTICS}    --设置为BLOCKS时,oracle会按照目标对象所占用的数据块个数乘以数据块尺寸估算对象占用的空间;设置为STATISTICS时,会根据最近的统计值给出对象占用空间,这种方法的误差会比较大。无论使用哪种选项值,都会有误差。

ESTIMATE_ONLY={y | n}     --指定是否只估算导出作业所占用的磁盘空间,默认值为N

EXCLUDE=object_type[:name_clause] [, ...]   --用于控制在导出过程中哪些数据库对象不被导出。(object_type用于指定要排除的对象类型,name_clause用于指定要排除的具体对象名称。注意EXCLUDE选项和INCLUDE选项不能同时使用。)

FILESIZE=integer[B | K | M | G]   --限定单个转储文件的最大容量,默认值是0,表示没有文件尺寸的限制。该选项与DUMPFILE选项一同使用。

FULL={y | n}         --是否以全库模式导出数据库。默认为N。

LOGFILE=[directory_object:]file_name     --指定导出过程中日志文件的名称,默认值为export.log。

PARALLEL=integer       --指定执行导出操作的并行度,默认值为1。

SCHEMAS=schema_name [, ...]       --按照SCHEMA模式导出,默认为当前用户。很常用,不做更多的解释。

TABLES=[schema_name.]table_name[:partition_name] [, ...]   --schema_name用于指定用户名,table_name用于指定导出的表名,partition_name用于指定要导出的分区名。

TABLESPACES=tablespace_name [, ...]     --指定需要导出哪个表空间中的表数据。



1.创建备份或者恢复目录

SQL> create directory tong as '/u01';

Directory created.

SQL> grant read,write on directory tong to USERCTLDEV;

Grant succeeded.

SQL> select * from dba_directories where directory_name='TONG';

OWNER       DIRECTORY_NAME      DIRECTORY_PATH

SYS       TONG      /u01

SQL>


2.按用户导出数据

expdp scott/tiger schemas=scott dumpfile=scott.dmp logfile=scott.log directory=tong;


3.按用户并行度导出数据

expdp scott/tiger schemas=scott dumpfile=scott.dmp logfile=scott.log directory=tong parallel=40 


4.按表名导出数据

expdp scott/tiger tables=emp,dept dumpfile=scott.dmp logfile=scott.log directory=tong


5.按表名和带条件导出数据

expdp scott/tiger tables=emp query='where deptno=20' dumpfile=scott.dmp logfile=scott.log directory=tong


6.按表空间导出数据

expdp scott/tiger tablespace=temp,example dumpfile=scott.dmp logfile=scott.log directory=tong


7.导出整个数据库

expdp system/manager directory=tong dumpfile=full.dmp FULL=y


8.将scott用户的数据导入到scott用户下

impdp scott/tiger directory=tong dumpfile=expdp.dmp schemas=scott


9.将scott用户下的dept表导入到system用户下

impdp system/manager directory=tong dumpfile=expdp.dmp tables=scott.dept remap_schema=scott:system


10.导入表空间

impdp system/manager directory=tong dumpfile=tablespace.dmp tablespace=example


11.导入数据库

impdb system/manager directory=dump_dir dumpfile=full.dmp full=y


12.将scoot用户下的abc表空间的数据导入到system用户下的bcd表空间

impdp scott/tiger directory=tong dumpfile=scott.dmp  logfile=scott.log remap_schema=scott:system remap_tablespace=abc:bcd


13.如果表空间已存在的表,导入数据有4种情况

TABLE_EXISTS_ACTION=对应以下四个值

SKIP            不管已存在的表,直接跳过

APPEND          保持现有的数据,导入新数据

TRUNCATE         删除原有的数据,导入新数据

REPLACE          删除所有表(drop),并重建(create),再导入新数据











本文转自 z597011036 51CTO博客,原文链接:http://blog.51cto.com/tongcheng/1976317,如需转载请自行联系原作者
目录
相关文章
|
Oracle 关系型数据库 数据库
|
12月前
|
SQL Oracle 关系型数据库
Oracle-数据泵expdp/impdp实操
Oracle-数据泵expdp/impdp实操
264 0
|
Oracle 关系型数据库 OLAP
|
Oracle 关系型数据库 数据库
IMPDP
在10g之前,传统的导出和导入分别使用EXP工具和IMP工具,从10g开始,不仅保留了原有的EXP和IMP工具,还提供了数据泵导出导入工具EXPDP和IMPDP.使用EXPDP和IMPDP时应该注意的事项: 1、EXP和IMP是客户端工具程序,它们既可以在可以客户端使用,也可以在服务端使用。
1697 0
|
关系型数据库 数据库 数据安全/隐私保护
EXPDP
OracleDatabase 10g引入了最新的数据泵(DataDump)技术,数据泵导出导入(EXPDP和IMPDP)的作用 1、实现逻辑备份和逻辑恢复. 2、在数据库用户之间移动对象. 3、在数据库之间移动对象 4、实现表空间搬移.
1326 0
|
存储 SQL 数据库
|
Oracle 关系型数据库 数据库
|
SQL Oracle 关系型数据库