快速匯出資料

li__hl8888發表於2016-05-20


   1>EXAMPLE1
 

2億

exp sms/sms file=smsmg_p7.dmp tables=SMSMG:M07 direct=y recordlength=65535 statistics=none

匯出時間大約28分鐘:

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export specified tables via Direct Path ...
. . exporting table                    SMSMG
. . exporting partition                            M07  256466785 rows exported
Export terminated successfully without warnings.
42.33user 666.59system 28:02.65elapsed 42%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (27major+3131minor)pagefaults 0swaps
匯出檔案大小為59G左右:
-rw-r--r--  1 oracle oinstall 63306875535 Sep 25 23:27 smsmg_p7.dmp

主機為4顆4核 處理器:

[root@sms proc]# cat cpuinfo |grep CPU
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz
model name      : Intel(R) Xeon(R) CPU           E7330  @ 2.40GHz


2>EXAMPLE 2

exp的效能還是可以接受的。雖然expdp是Oracle 10g推薦的邏輯匯出方式,但是仍然有很多人並不習慣這一方式,這與expdp的使用複雜度有關,我覺得expdp的directory方式應當簡化,由引數行定義就好了,後臺由資料庫自動去維護。

最近在做匯出時比較了一下幾種方式對於速度的影響,記錄一下資料供參考。
nohup time exp sms/sms file=smsmg_p2.dmp tables=SMSMG:M02 &                                  ******************** 1.3yi  50min
nohup time exp sms/sms file=smsmg_p3.dmp tables=SMSMG:M03 direct=y recordlength=65535 &     *************1.8yi   22min
nohup time expdp sms/sms dumpfile=smsmg_p4.dmp directory=dataorg tables=SMSMG:M04 PARALLEL=2 &    *****1.6yi   32Min

    3>EXAMPLE3

單表測試,1363292行記錄,116.6 MB左右資料


1.使用並行 expdp

花費時間:
Tue Apr 27 10:21:54 CST 2004 - Tue Apr 27 10:21:10 CST 2004 = 43秒

$ cat bak.sh
date
expdp eygle/eygle dumpfile=big_big_table.dmp directory=dpdata tables=big_big_table job_name=exptab parallel=4

date

2.使用正常 expdp


花費時間:
Tue Apr 27 10:23:36 CST 2004 - Tue Apr 27 10:23:02 CST 2004 = 34 秒

看來並行的差異需要更大的資料量的測試

$ cat bak2.sh date expdp eygle/eygle dumpfile=big_big_table2.dmp directory=dpdata tables=big_big_table job_name=exptab date

3.常規路徑exp

花費時間:Tue Apr 27 10:27:00 CST 2004 - Tue Apr 27 10:24:54 CST 2004 = 2:06

這是花費時間最長的.
是 126/34 = 370.58823529411764705882352941176%

expdp明顯快於exp

$ cat bak3.sh date exp eygle/eygle file=big_big_table3.dmp tables=big_big_table date


4>直接路徑exp:

cat bak4.sh date exp eygle/eygle file=big_big_table3.dmp tables=big_big_table direct=y date


4〉IMPORT 資料:

IMPDP遠遠優於imp

imp:

$ cat rev2.sh date imp eygle/eygle file=big_big_table3.dmp tables=big_big_table date

$ ./rev2.sh  407s


IMPDP:

花費時間: Tue Apr 27 11:07:06 CST 2004 - Tue Apr 27 11:06:40 CST 2004 = 26s
與imp相比這個速度實在是驚人.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8568259/viewspace-2103742/,如需轉載,請註明出處,否則將追究法律責任。

相關文章