Oracle的数据泵导入导出功能比原有的导入导出工具(exp/imp)功能强很多。

利用数据泵我们可以只导出某一特定对象类型,并且可以指定过滤条件。这个功能的实现主要依靠expdp的include参数。联机文档对于参数的功能描述如下:

INCLUDE

Default: none

Purpose

Enables you to filter the metadata that is exported by specifying objects and object

types for the current export mode. The specified objects and all their dependent objectsare exported. Grants on these objects are also exported.

Syntax and Description

INCLUDE = object_type[:name_clause] [, ...]

Only object types explicitly specified in INCLUDE statements, and their dependent objects, are exported. No other object types, including the schema definition information that is normally part of a schema-mode export when you have the EXP_FULL_DATABASE role, are exported.

To see a list of valid object type path names for use with the INCLUDE parameter, youcan query the following views: DATABASE_EXPORT_OBJECTS, SCHEMA_EXPORT_OBJECTS, and TABLE_EXPORT_OBJECTS.

The name_clause is optional. It allows fine-grained selection of specific objects within an object type. It is a SQL expression used as a filter on the object names of the type. It consists of a SQL operator and the values against which the object names of the specified type are to be compared. The name clause applies only to object types whose instances have names (for example, it is applicable to TABLE, but not to GRANT).   The optional name clause must be separated from the object type with a colon and

enclosed in double quotation marks, because single-quotation marks are required to delimit the name strings.

Oracle recommends that INCLUDE statements be placed in a parameter file; otherwise you might have to use operating system-specific escape characters on the command line before quotation marks. See Use of Quotation Marks On the Data Pump Command Line on page 2-6.

For example, suppose you have a parameter file named hr.par with the following

content:

SCHEMAS=HR

DUMPFILE=expinclude.dmp

DIRECTORY=dpump_dir1

LOGFILE=expinclude.log

INCLUDE=TABLE:"IN ('EMPLOYEES', 'DEPARTMENTS')"

INCLUDE=PROCEDURE

INCLUDE=INDEX:"LIKE 'EMP%'"

You could then use the hr.par file to start an export operation, without having to

enter any other parameters on the command line:

> expdp hr/hr parfile=hr.par

Restrictions

■ The INCLUDE and EXCLUDE parameters are mutually exclusive.

■ Grants on objects owned by the SYS schema are never exported.

Example

The following example performs an export of all tables (and their dependent objects)in the hr schema:

>expdp hr/hr INCLUDE=TABLE DUMPFILE=dpump_dir1:exp_inc.dmp NOLOGFILE=y

SQL> show user

USER 为 "SYS"

SQL> conn admin/admin

已连接。

SQL> select sequence_name from user_sequences;

未选定行

SQL> create sequence s;

序列已创建。

SQL> select s.nextval from dual;

NEXTVAL

----------

1

SQL> select s.nextval from dual;

NEXTVAL

----------

2

SQL> select s.nextval from dual;

NEXTVAL

----------

3

SQL> create sequence s1;

序列已创建。

SQL> create sequence s2;

序列已创建。

SQL> create sequence s3;

序列已创建。

SQL> create sequence s4;

序列已创建。

SQL> create sequence a;

序列已创建。

SQL> create sequence a1;

序列已创建。

SQL> create sequence a2;

序列已创建。

SQL> create sequence a3;

序列已创建。

SQL> select sequence_name from user_sequences;

SEQUENCE_NAME

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

S

S1

S2

S3

S4

A

A1

A2

A3

已选择9行。

下面我们只讲序列前缀为S的序列导出。

C:\>type parfile.par

userid=admin/admin

dumpfile=test:sequence.dp

logfile=sequence.log

include=sequence:"like 'S%'"

C:\>expdp parfile=parfile.par

Export: Release 10.2.0.1.0 - Production on 星期二, 29 12月, 2009 11:21:18

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

自动启用 FLASHBACK 以保持数据库完整性。

启动 "ADMIN"."SYS_EXPORT_SCHEMA_01":  parfile=parfile.par

正在使用 BLOCKS 方法进行估计...

处理对象类型 SCHEMA_EXPORT/TABLE/TABLE_DATA

使用 BLOCKS 方法的总估计: 0 KB

处理对象类型 SCHEMA_EXPORT/SEQUENCE/SEQUENCE

已成功加载/卸载了主表 "ADMIN"."SYS_EXPORT_SCHEMA_01"

******************************************************************************

ADMIN.SYS_EXPORT_SCHEMA_01 的转储文件集为:

E:\DATAPUMP\SEQUENCE.DP

作业 "ADMIN"."SYS_EXPORT_SCHEMA_01" 已于 11:21:21 成功完成

删除原有的序列

SQL> drop sequence s;

序列已删除。

SQL> drop sequence s1;

序列已删除。

SQL> drop sequence s2;

序列已删除。

SQL> drop sequence s3;

序列已删除。

SQL> drop sequence s4;

序列已删除。

SQL> drop sequence a;

序列已删除。

SQL> drop sequence a1;

序列已删除。

SQL> drop sequence a2;

序列已删除。

SQL> drop sequence a3;

序列已删除。

SQL> select sequence_name from user_sequences;

未选定行

导入序列

C:\>impdp userid=admin/admin dumpfile=test:sequence.dp include=sequence

Import: Release 10.2.0.1.0 - Production on 星期二, 29 12月, 2009 11:23:17

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

已成功加载/卸载了主表 "ADMIN"."SYS_IMPORT_FULL_01"

启动 "ADMIN"."SYS_IMPORT_FULL_01":  userid=admin/******** dumpfile=test:sequence

.dp include=sequence

处理对象类型 SCHEMA_EXPORT/SEQUENCE/SEQUENCE

作业 "ADMIN"."SYS_IMPORT_FULL_01" 已于 11:23:19 成功完成

SQL> select sequence_name from user_sequences;

SEQUENCE_NAME

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

S

S1

S2

S3

S4

SQL> select s.nextval from dual;

NEXTVAL

----------

21

注意我们的表数据未导出,此时导入表数据会报错。

C:\>impdp userid=admin/admin dumpfile=test:sequence.dp include=table

Import: Release 10.2.0.1.0 - Production on 星期二, 29 12月, 2009 11:38:01

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

ORA-39002: 操作无效

ORA-39168: 未找到对象路径 TABLE。

导出oracle sequences,利用数据泵只导出序列相关推荐

  1. oracle中数据泵只导出索引,细致入微:如何使用数据泵导出表的部分列数据

    ‍ 警告:连接到容器数据库的根或种子时通常不需要 Oracle Data Pump 操作. 启动 "C##U1"."SYS_EXPORT_TABLE_01": ...

  2. oracle数据的导入和导出,Oracle入门教学--数据导入和导出

    数据导入和导出 一.数据导入工具 1.利用PLSQL直接进行数据表的粘贴 (1)下载测试表 (2)打开准备导入的文件并进行创建数据库表的SQL语句编辑 A.复制表头到新的sheet B.选择粘贴 C. ...

  3. 金算盘导出oracle,金算盘软件数据导入和导出操作方法.doc

    金算盘软件数据导入和导出操作方法 金算盘软件维护集锦 此为201003版本,本期讲一下"导入导出"的一些注意事项,以"往来期初"导入导出为例. 导入导出这个功能 ...

  4. oracle expdp导出教程,Oracle Expdp Impdp 数据泵导入导出

    新建逻辑目录 Oracle不会自动创建实际的物理目录"D:\temp"(务必手动创建此目录),仅仅是进行定义逻辑路径dmp_dir: sql> conn username/p ...

  5. Oracle使用数据泵导入/导出数据(expdp/impdp)【图文教程】

    Oracle使用数据泵导入/导出数据(expdp/impdp) 此类博客太多的坑,都不完整,要不执行着就报错执行不下去了,要不说的不清不楚,整理的一步步截图,100%成功. expdp数据导出 远程登 ...

  6. 如何将mysql导出数据泵_Oracle数据库之ORACLE 数据泵导入导出数据

    本文主要向大家介绍了Oracle数据库之ORACLE 数据泵导入导出数据,通过具体的内容向大家展现,希望对大家学习Oracle数据库有所帮助. 一.摘要 在平常备库和数据库迁移的时候,当遇到大的数据库 ...

  7. oracle1422,Oracle错误:数据泵导出时报错ORA-1422

    今天一个学习Oracle时间不长的同事在使用数据泵导出的时候碰到了这个错误. 由于前两天看到他在研究DUAL表,而且还问过我几个DUAL表相关的问题,所以看到这个错误后首先想到的就是问他是否向DUAL ...

  8. ORACLE 数据泵expdp导出命令使用

    ORACLE 数据泵expdp导出命令使用 在cmd窗口下 第一种写法:优先使用(数据库中所有SCHEMAS表数据) expdp DARSUAT/DARSUAT DIRECTORY=DATA_PUMP ...

  9. mysql数据泵导入导出_ORACLE使用数据泵导入导出部分表

    1.导出名字为A的表(这里会导出SEQUENCES及FUNCTION等内容) expdp TEST/TEST@orcl schemas=TEST dumpfile=TEST.dmp DIRECTORY ...

最新文章

  1. linux rpc语言,Linux下RPC的hello world
  2. c语言初始化字符数组为空,怎么把已经初始化的字符数组设置为空?
  3. java 反射机制_基础篇:深入解析JAVA反射机制
  4. mysql的 怎么处理_本人的MySQL连接到底怎么处理才好……
  5. 执行计划中cpu耗时_面试被问怎么排查遇到的系统CPU飙高和频繁GC,到底该怎么回答?...
  6. 1.7 编程基础之字符串 25 最长最短单词 python
  7. java 包的package和import语句
  8. Linux——虚拟机系统安装
  9. 苹果手机添加 qq 邮箱的方法
  10. Intel Edison 第一次使用的更新
  11. 汇总|国内外优秀的计算机视觉团队
  12. 修改war包中数据库配置信息
  13. 哐筹甍颚往往能够用它实现
  14. 超高性价比——DIY 斯坦福Pupper机器狗
  15. Ai-WB2模组基于TCP的MQTT连接服务器使用示例
  16. c语言log库,Log4g
  17. QImage 图像格式小结 Format_RGB32
  18. Ubuntu14.04+Texlive2014+LYX-Linux下LYX的中文配置方案
  19. mstsc登录xubuntu16.04
  20. 根据域名反向查询ip地址服务器

热门文章

  1. Error和Exception的区别
  2. 关于常用meta的总结
  3. weblogic环境搭建
  4. 趁着对象泡脚的功夫,我把vueX吃透了
  5. springboot---request 中Parameter,Attribute区别
  6. 汇编 --- 初体验
  7. 检测raid类型和磁盘坏道脚本
  8. 2018/03/25
  9. sama5d3 环境检测 gpio--yk测试
  10. MySQL存储过程权限检查主要点