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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用Exp和Expdp匯出資料的效能對比與最佳化
- oracle資料匯出匯入(exp/imp)Oracle
- Oracle資料泵匯出匯入(expdp/impdp)Oracle
- expdp+compression效能測試
- Oracle資料庫匯入匯出。imp匯入命令和exp匯出命令Oracle資料庫
- Oracle使用資料泵expdp,impdp進行資料匯出匯入Oracle
- logstash匯入movielens測試資料
- 極速匯入elasticsearch測試資料Elasticsearch
- Magicodes.IE 在100萬資料量下匯入匯出效能測試
- Oracle expdp資料泵遠端匯出Oracle
- exp和expdp的filesize引數的使用--匯出多個檔案
- 如何確定一個dmp檔案是exp匯出的還是expdp匯出的?
- oracle按照表條件expdp匯出資料Oracle
- oracle10g expdp資料泵的bug,按schema匯出,匯入impdp時無jobOracle
- 匯入視訊測試
- Oracle 12c expdp和impdp匯出匯入表Oracle
- 【資料泵】EXPDP匯出表結構(真實案例)
- clickhouse 億級資料效能測試
- 【ASK_ORACLE】一眼判斷出Oracle的dmp檔案是用expdp匯出還是exp匯出Oracle
- golang匯入本地包Golang
- expdp在匯出時對資料大小進行評估
- 資料庫 MySQL 資料匯入匯出資料庫MySql
- DDT資料驅動效能測試(一)
- 效能狗(Perfdog)測試與資料分析
- sqoop資料匯入匯出OOP
- Oracle 資料匯入匯出Oracle
- 資料泵匯出匯入
- Oracle資料匯入匯出Oracle
- phpMyAdmin匯入/匯出資料PHP
- EXP、IMP、SQLLOADER、EXPDP、IMPDP、DBMS_METADATA、SQLPLUS等方面SQL
- 109.全文檢索-ElasticSearch-入門-刪除資料&bulk批量操作匯入樣本測試資料Elasticsearch
- 大文字資料,匯入匯出到資料庫資料庫
- oracle dblink用法總結和expdp和impdp利用dblink倒入匯出到本地Oracle
- MySQL入門--匯出和匯入資料MySql
- 效能測試之入門篇
- MATLAB匯入資料Matlab
- Mysql匯入本地檔案MySql
- 資料庫效能測試:sysbench用法詳解資料庫
- 資料匯入終章:如何將HBase的資料匯入HDFS?