天天看點

impdp oracle叢集,oracle導入指令impdp中cluster選項的作用

oracle導入指令impdp中cluster選項的作用

發現問題

同僚反映在使用oracle的impdp指令導入的時候,報以下錯誤:

最開始以為目錄不正确,在資料庫中使用指令select * from dba_directories檢視directory的路徑是正确的,dumpfile檔案也确實在正确的目錄下。再排查目錄的權限也是正确的。

找出原因

這時候,另外一個同僚也做了同樣的導入動作,但是并沒有報錯。經過對比,發現沒有出現問題的同僚加了一個參數cluster=N。那肯定是這個參數的問題,使用指令impdp -help,得到如下解釋:

CLUSTER

Utilize cluster resources and distribute workers across the Oracle RAC [YES].

--通過Oracle RAC來利用叢集的資源和分布的勞工(勞工應該就是指執行個體,但是極其籠統,反正我是沒看出來啥意思)

雖然沒看明白啥意思,但是可以定位到因為是RAC的原因導緻的。繼續找oracle rac cluster相關的關鍵字,找到如下描述:

Using PARALLEL During An Export In An Oracle RAC Environment

In an Oracle Real Application Clusters (Oracle RAC) environment, if an export operation has PARALLEL=1, then all Data Pump processes reside on the instance where the job is started. Therefore, the directory object can point to local storage for that instance.

If the export operation has PARALLEL set to a value greater than 1, then Data Pump processes can reside on instances other than the one where the job was started. Therefore, the directory object must point to shared storage that is accessible by all instances of the Oracle RAC.

在cluster=n的時候,多個并行使用的是同一個執行個體進行導出和導入。但是如果cluster=y的時候,如果沒開并行,使用一個執行個體,如果開了并行,這時候,會使用多個執行個體。但是directory并不是在一個共享目錄中,是以另外一個執行個體會因為找不到directory而報錯。

解決方法

cluster=n和parallel=10組合,開并行,但是關閉叢集導入導出。

cluster=y和parallel=1,關閉并行,可以打開叢集導入導出,但是這是沒有意義的,即使打開,也沒有起效。

cluster=y和parallel=10和directory在共享目錄上,可以同時使用叢集導入和并行。