EXP,EXPDP数据导入本地性能测试

         大家都知道,Oracle数据库有两种比较方便的导出导入工具,那就是exp/impexpdp/impdp。熟悉此工具的人也会了解到,exp/imp的使用 (服务器端和客户端都可以执行,并且备份文件可以在客户端产生);expdp/impdp的使用 (服务器端和客户端都可以执行,备份文件只能存在服务器里面)。

         但鉴于导出导入工具的特点,我们就想能否通过expdp将远端数据库数据导入到本地库中呢?当然可以!下面我们就一起来做一个测试吧。

测试说明:

目的:将远端数据库服务器(IP65)的数据导入到本地(IP67)dmp文件中

其中用到服务器(65)一个用户(user_exp)的一张表做测试(t_exp)

Create tablespace tbs_exp datafile ‘D:\tbs_exp.dbf’ size 10240m autoextend off;

Create user user_exp identified by user_exp default tablespace tbs_exp;

Grant connect,resource,unlimited tablespace to user_exp;

Conn user_exp/user_exp

create table t_exp as

select * from user_tablespaces;

declare

begin

  for i in 1 .. 10000000 loop

    insert into t_exp

      (tablespace_name, block_size, initial_extent,MIN_EXTENTS )

    values

      ('tablespace_name',0,0,i);

  end loop;

  commit;

end;

/

1EXP工具数据导入本地步骤

直接通过以下代码将服务器数据导入到本地:

exp user_exp/user_exp@orcl_65 file=d:\exp_01.dmp log=d:\exp_01.log tables=(t_exp)

2EXPDP工具数据导入本地步骤

第一步:本地建立导出用户

Create user db_exp identified by db_exp;

Grant connect,resource,create database link to db_exp;

第二步:本地创建directory,并授权导出用户使用

在操作系统上创建direxp目录

create or replace directory DIR_EXP as 'D:\direxp';

grant read,write on directory DIR_EXP to db_exp;

第三步:,并创建db link 链接

-- Create database link

create database link to_exp_65

  connect to user_exp identified by user_exp

  using '(DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.48.1.65)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SID = orcl)

    )

  )';

Select 1 from dual@to_exp_65;

第四步:导出代码

         expdp db_exp/db_exp@orcl_67 directory=DIR_EXP dumpfile=expdp_01.dmp logfile=expdp_01.log tables=(t_exp) network_link=to_exp_65

其他备注:

Db_exp 本地用户,用来连接远端数据库服务器

Dir_exp 本地db_exp用户下 directory 用户本地指定expdp写入目录,这里是Ddirexp文件夹

To_exp_65 本地db_exp用户下的 db link ,用来连接远端数据库服务器

3EXPEXPDP工具数据导入本地性能对比

性能测试结果:

Exp导出过程如下:

C:\Documents and Settings\Administrator>prompt $P$G$T$G

C:\Documents and Settings\Administrator>16:10:55.37>

C:\Documents and Settings\Administrator>16:11:05.92>exp user_exp/user_exp@orcl_6

5 file=d:\exp_01.dmp log=d:\exp_01.log tables=(t_exp)

Export: Release 10.2.0.1.0 - Production on 星期三 10 12 16:11:07 2011

Copyright (c) 1982, 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

已导出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集

服务器使用 AL32UTF8 字符集 (可能的字符集转换)

即将导出指定的表通过常规路径...

. . 正在导出表                           T_EXP导出了    10000007

成功终止导出, 没有出现警告。

C:\Documents and Settings\Administrator>16:17:51.04>

用时:6分钟46

Expdp导出过程如下:

C:\Documents and Settings\Administrator>16:22:15.25>expdp db_exp/db_exp@orcl_67

directory=DIR_EXP dumpfile=expdp_01.dmp logfile=expdp_01.log tables=(t_exp) netw

ork_link=to_exp_65

Export: Release 10.2.0.1.0 - Production on 星期三, 12 10, 2011 16:22:16

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

启动 "DB_EXP"."SYS_EXPORT_TABLE_01":  db_exp/********@orcl_67 directory=DIR_EXP

dumpfile=expdp_01.dmp logfile=expdp_01.log tables=(t_exp) network_link=to_exp_65

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

处理对象类型 TABLE_EXPORT/TABLE/TABLE_DATA

使用 BLOCKS 方法的总估计: 336 MB

处理对象类型 TABLE_EXPORT/TABLE/TABLE

. . 导出了 "USER_EXP"."T_EXP"                          285.8 MB 10000007

已成功加载/卸载了主表 "DB_EXP"."SYS_EXPORT_TABLE_01"

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

DB_EXP.SYS_EXPORT_TABLE_01 的转储文件集为:

  D:\DIREXP\EXPDP_01.DMP

作业 "DB_EXP"."SYS_EXPORT_TABLE_01" 已于 16:23:35 成功完成

C:\Documents and Settings\Administrator>16:23:36.46>

用时:1分钟21

另:Expdp导入到远程数据库服务端 所耗时间如下:

C:\Documents and Settings\Administrator>16:27:40.92>expdp user_exp/user_exp@orcl

_65 directory=DATA_FILE_DIR dumpfile=expdp_02.dmp logfile=expdp_02.log

Export: Release 10.2.0.1.0 - Production on 星期三, 12 10, 2011 16:27:41

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

启动 "USER_EXP"."SYS_EXPORT_SCHEMA_01":  user_exp/********@orcl_65 directory=DAT

A_FILE_DIR dumpfile=expdp_02.dmp logfile=expdp_02.log

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

处理对象类型 SCHEMA_EXPORT/TABLE/TABLE_DATA

使用 BLOCKS 方法的总估计: 336 MB

处理对象类型 SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA

处理对象类型 SCHEMA_EXPORT/TABLE/TABLE

处理对象类型 SCHEMA_EXPORT/TABLE/INDEX/INDEX

处理对象类型 SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

处理对象类型 SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

处理对象类型 SCHEMA_EXPORT/TABLE/COMMENT

. . 导出了 "USER_EXP"."T_EXP"                          285.9 MB 10000007

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

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

USER_EXP.SYS_EXPORT_SCHEMA_01 的转储文件集为:

  E:\ORACLE\PRODUCT\10.2.0\DB_1\DEMO\SCHEMA\SALES_HISTORY\EXPDP_02.DMP

作业 "USER_EXP"."SYS_EXPORT_SCHEMA_01" 已于 16:24:52 成功完成

C:\Documents and Settings\Administrator>16:27:59.70>

用时:0分钟19

可见,从远端服务器导数据到本地,使用数据泵也是可以完成的,同时效率还是远远高于普通的exp导出。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值