一般来讲,EXP/IMP是上一代导出导入程序,EXPDP/IMPDP是新一代的导出导入程序。对于大数据量的导出导入首选EXPDP/IMPDP,可以用到并行度,对表空间等操作上也更加的灵活。对于小数据量的迁移,可以使用exp/imp,操作更简单。

需求: exp 导出  A库(11.2.0.3)zjy用户的分区表t_jingyu_part部分数据,数据表空间 dbs_d_jingyu,索引表空间dbs_i_jingyu.

imp 导入  B库(11.2.0.4)test用户下,test用户的默认表空间dbs_d_test。

A库zjy用户下准备工作:

create tablespace dbs_d_jingyu datafile '+data' size 100M autoextend off;
create tablespace dbs_i_jingyu datafile '+data' size 20M autoextend off;
create user zjy identified by zjy default tablespace dbs_d_jingyu;
create table t_jingyu_part(
id number,
deal_date date,
area_code number,
contents varchar2(4000))
partition by range(deal_date)
(partition p1 values less than(to_date('2014-02-01','YYYY-MM-DD')) tablespace dbs_d_jingyu,
partition p2 values less than(to_date('2014-03-01','YYYY-MM-DD')) tablespace dbs_d_jingyu,
partition p3 values less than(to_date('2014-04-01','YYYY-MM-DD')) tablespace dbs_d_jingyu,
partition p4 values less than(to_date('2014-05-01','YYYY-MM-DD')) tablespace dbs_d_jingyu,
partition p5 values less than(to_date('2014-06-01','YYYY-MM-DD')) tablespace dbs_d_jingyu,
partition p6 values less than(to_date('2014-07-01','YYYY-MM-DD')) tablespace dbs_d_jingyu,
partition p7 values less than(to_date('2014-08-01','YYYY-MM-DD')) tablespace dbs_d_jingyu,
partition p8 values less than(to_date('2014-09-01','YYYY-MM-DD')) tablespace dbs_d_jingyu,
partition p9 values less than(to_date('2014-10-01','YYYY-MM-DD')) tablespace dbs_d_jingyu,
partition p10 values less than(to_date('2014-11-01','YYYY-MM-DD')) tablespace dbs_d_jingyu,
partition p11 values less than(to_date('2014-12-01','YYYY-MM-DD')) tablespace dbs_d_jingyu,
partition p12 values less than(to_date('2015-01-01','YYYY-MM-DD')) tablespace dbs_d_jingyu,
partition p_max values less than(maxvalue) tablespace dbs_d_jingyu );
insert into t_jingyu_part(id, deal_date, area_code, contents)
select rownum, to_date(to_char(sysdate-365,'J')+trunc(dbms_random.value(0,365)),'J'), ceil(dbms_random.value(590,599)), rpad('*',400,'*') from dual
connect by rownum <= 100000;
commit;
create index idx_t_jingyu_part_id on t_jingyu_part(id, area_code) local tablespace dbs_i_jingyu;
select count(1) from t_jingyu_part partition(P1); 
select count(1) from t_jingyu_part partition(P2);
select count(1) from t_jingyu_part where deal_date >= to_date('2014-11-11','yyyy-mm-dd') and deal_date <= to_date('2014-12-12','yyyy-mm-dd');

exp zjy/zjy parfile=exp.par

file=t_jingyu_part.dmp
log=exp_t_jingyu_part.log
tables=t_jingyu_part
query="where deal_date >= to_date('2014-11-11','yyyy-mm-dd') and deal_date <= to_date('2014-12-12','yyyy-mm-dd')"
statistics=none

在可以使用直接路径导出的情景建议使用直接路径导出:direct=y 但在本例中不适用。

B库test用户:

create tablespace dbs_d_test datafile '+data' size 100M autoextend off;
create user test identified by test default tablespace dbs_d_test;

注:如果按需求,不在B库建立原表在A库时对应的表空间,就需要先在B库建立表,指定B库的表空间,比如dbs_d_test;然后再imp导入,否则必须先建立之前的表空间。

imp test/test file=t_jingyu_part.dmp log=imp_t_jingyu_part.log buffer=1024000 ignore=y full=y RESUMABLE=y

EXP/IMP 导出生产库表的指定数据到测试库一例的更多相关文章

  1. Oracle 【IT实验室】数据库备份与恢复之一:exp/imp(导出与导入&装库与卸库)

    1.1  基本命令 1.  获取帮助 $ exp help=y $ imp help=y     2.  三种工作方式 (1)交互式方式 $ exp        //  然后按提示输入所需要的参数 ...

  2. mysql-用命令导出、导入表结构或数据

    1. 导出整个数据库(表结构和数据) mysqldump -u用户名 -p  数据库名 > 导出的文件名 [root@localhost work]# mysqldump -uroot -p m ...

  3. mysqldump工具,通过--where选项,导出指定表中指定数据?

    需求描述: 今天在使用mysqldump工具导出表的时候,考虑能不能导出满足条件的数据行,不要 将表都导出来,查找资料,通过--where选项,就可以实现目的,做个实验,在此记录下. 操作过程: 1. ...

  4. Oracle exp/imp 导出/导入

    set NLS_LANG=AMERICAN_AMERICA.AL32UTF8 exp jjhd_test/11111111@a_syj file="d:\jjhd_test.dmp" ...

  5. 数据库查询的数据导出到xls表,集合数据导出到xls表

    //实体类package com.outxls; public class Student { private Integer studentId; private String studentNam ...

  6. mysql导出某张表的部分数据

    .使用into outfile '保存到操作系统的外部文件路径' mysql -uroot -p123456 -hhostname -P3306 select column_name_list fro ...

  7. oracle11.2.0.1 deferred_segment_creation 造成exp imp 空表无法导出的问题

     oracle11g 新增加了 deferred_segment_creation 的属性在创建的数据库表中,如果表中没有数据,并且这个参数是true的话,并不是直接就在数据文件中的增加相应的segm ...

  8. Oracle中用exp/imp命令快速导入导出数据

    from: http://blog.csdn.net/wangchunyu11155/article/details/53635602 [用 exp 数 据 导 出]: 1 将数据库TEST完全导出, ...

  9. EXP无法导出空表的表结构解决办法

    原文链接:http://www.cnblogs.com/Mr_JinRui/archive/2012/11/05/2755035.html 早的一次使用oracle 11g导出数据发现有的表丢失了,感 ...

随机推荐

  1. Vagrant 基础全面解析

    这篇 Vagrant 入门文章将带你创建一个 Vagrant 项目,这个过程将会用到 Vagrant 所提供的主要基本特性.如果想了解 Vagrant 能为你带来哪些好处,可以阅读 Vagrant 官 ...

  2. 菜鸟学Struts2——Results

    在对Struts2的Action学习之后,对Struts2的Result进行学习.主要对Struts2文档Guides中的Results分支进行学习,如下图: 1.Result Types(Resul ...

  3. Android 获取meta-data中的数据

    在 Android 的 Mainfest 清单文件中,Application,Activity,Recriver,Service 的节点中都有这个的存在.很多时候我们可以通过 meta-data 来配 ...

  4. CENTOS 6.5 平台离线编译安装 PHP5.6.6

    一.下载php源码包 http://cn2.php.net/get/php-5.6.6.tar.gz/from/this/mirror 二.编译 编译之前可能会缺少一些必要的依赖包,加载一个本地yum ...

  5. 主成分分析(PCA)原理总结

    主成分分析(Principal components analysis,以下简称PCA)是最重要的降维方法之一.在数据压缩消除冗余和数据噪音消除等领域都有广泛的应用.一般我们提到降维最容易想到的算法就 ...

  6. H5坦克大战之【画出坦克】

    今天是个特殊的日子,圣诞节,也是周末,在这里先祝大家圣诞快乐!喜庆的日子,我们可以稍微放松一下,扯一扯昨天雷霆对战凯尔特人的比赛,这场比赛大威少又双叒叕拿下三双,而且是一个45+11+11的超级三双, ...

  7. Log4net - 规则简介

    参考页面: http://www.yuanjiaocheng.net/CSharp/csharprumenshili.html http://www.yuanjiaocheng.net/entity/ ...

  8. SSH框架和Redis的整合(2)

    5. 添加功能的实现 新建一个Action:RClasAction,实现向Redis添加课程数据,并同步到MySQL. package com.school.action; import java.u ...

  9. IteratorPattern(迭代子模式)

    /** * 迭代子模式 * @author TMAC-J * 聚合:某一类对象的集合 * 迭代:行为方式,用来处理聚合 * 是一种行为模式,用于将聚合本身和操作聚合的行为分离 * Java中的COLL ...

  10. Oracle 表空间和用户权限管理

    一. 表空间 Oracle数据库包含逻辑结构和物理结构. 数据库的物理结构指的是构成数据库的一组操作系统文件. 数据库的逻辑结构是指描述数据组织方式的一组逻辑概念以及它们之间的关系. 表空间是数据库逻 ...