EXP,EXPDP資料匯入本地效能測試
大家都知道,Oracle資料庫有兩種比較方便的匯出匯入工具,那就是exp/imp和expdp/impdp。熟悉此工具的人也會了解到,exp/imp的使用 (伺服器端和客戶端都可以執行,並且備份檔案可以在客戶端產生);expdp/impdp的使用 (伺服器端和客戶端都可以執行,備份檔案只能存在伺服器裡面)。
但鑑於匯出匯入工具的特點,我們就想能否通過expdp將遠端資料庫資料匯入到本地庫中呢?當然可以!下面我們就一起來做一個測試吧。
測試說明:
目的:將遠端資料庫伺服器(IP為65)的資料匯入到本地(IP為67)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;
/
1.EXP工具資料匯入本地步驟
直接通過以下程式碼將伺服器資料匯入到本地:
exp user_exp/user_exp@orcl_65 file=d:\exp_01.dmp log=d:\exp_01.log tables=(t_exp)
2.EXPDP工具資料匯入本地步驟
第一步:本地建立匯出使用者
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寫入目錄,這裡是D盤direxp資料夾
To_exp_65 本地db_exp使用者下的 db link ,用來連線遠端資料庫伺服器
3.EXP,EXPDP工具資料匯入本地效能對比
效能測試結果:
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匯出。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28673746/viewspace-757817/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用EXPDP/IMPDP匯入匯出表中資料/後設資料測試
- 通過EXPDP/IMPDP匯出匯入遠端資料倒本地
- 使用Exp和Expdp匯出資料的效能對比與優化優化
- shell,ant指令碼實現自動資料泵(exp.expdp)匯出匯入資料指令碼
- 使用Exp和Expdp匯出資料的效能對比與最佳化
- 資料匯入匯出EXP/IMP
- exp/imp匯出匯入資料
- 用exp/imp把遠端資料匯入到本地資料庫中資料庫
- oracle資料匯出匯入(exp/imp)Oracle
- EXP COMPRESS以及EXP/IMP EXPDP/IMPDP匯入表結構注意
- sqlldr批量匯入匯出資料測試SQL
- sqlldr批次匯入匯出資料測試SQL
- Oracle資料泵匯出匯入(expdp/impdp)Oracle
- Oracle資料匯入匯出imp/exp命令Oracle
- oracle資料的匯入匯出imp/expOracle
- 資料庫泵(expdp/impdp)匯入匯出流程資料庫
- Oracle資料匯入匯出imp/exp命令(轉)Oracle
- logstash匯入movielens測試資料
- 極速匯入elasticsearch測試資料Elasticsearch
- [轉載] expdp, exp和sqluldr2 速度測試SQL
- expdp impdp 資料庫匯入匯出命令詳解資料庫
- Oracle使用資料泵expdp,impdp進行資料匯出匯入Oracle
- Oracle資料庫匯入匯出。imp匯入命令和exp匯出命令Oracle資料庫
- 【原創】比較資料泵和exp/imp對相同資料匯出/匯入的效能差異
- Oracle expdp/impdp匯出匯入命令及資料庫備份Oracle資料庫
- Oracle expdp/impdp匯入匯出備份資料庫指令碼Oracle資料庫指令碼
- 針對資料泵匯出 (expdp) 和匯入 (impdp)工具效能降低問題的檢查表
- 【EXP】資料庫只讀模式下如何使用exp和expdp資料庫模式
- SQLLODER匯入WIn效能資料SQL
- 抽取exp/expdp匯出檔案頭的資訊
- Magicodes.IE 在100萬資料量下匯入匯出效能測試
- expdp遠端匯出資料
- 使用exp/imp匯出匯入資料(邏輯備份恢復)
- Oracle中exp,imp(匯入匯出)資料遷移注意事項Oracle
- 使用Oracle 的 imp ,exp 命令實現資料的匯入匯出Oracle
- 【EXPDP/IMPDP】使用 EXPDP/IMPDP工具“模糊”匯出和匯入
- MySQL資料匯入匯出牛刀小試MySql
- ORACLE expdp匯出遠端庫指定使用者資料到本地資料庫Oracle資料庫