How To Change The Asm Rebalancing Power

eric0435發表於2016-12-01

ASM Rebalance
使用傳統邏輯卷管理器,擴充套件或收縮條帶化的檔案系統通常是很困難的。使用ASM,這些磁碟改變現 在呼叫重新分佈(rebalance)可以無逢操作來條帶資料。另外,這些操作可以聯機執行。儲存配置的任何改變--增加,刪除或重設定磁碟大小,都會觸發rebalance操作。ASM不會動態的圍繞 著"host areas"或"hot extents"進行移動。因為ASM跨所有磁碟與資料庫buffer cache分佈區,阻止 small chunks of data出現在磁碟的host areas,完全消除了host disks或extents。

Rebalance Operation
rebalance operation跨磁碟組中的所有磁碟總是對檔案區與空間使用提供了一種均勻分佈。對每個 檔案執行rebalance操作可以確保每個檔案跨所有磁碟均勻分佈。最關鍵的是ASM保證了I/O負載平衡 。ASM後臺程式,RBAL管理rebalance操作。RBAL程式檢查每個檔案區對映,基於新的儲存配置區會均 勻分佈。例如,有塊八磁碟的一個磁碟組,一個資料檔案有40個區(每個磁碟將會有五個區),當向磁 盤組增加兩塊大小一樣的磁碟後,資料檔案會跨10塊磁碟執行rebalance與分佈,每個磁碟只包含四 個區。只需要移動8個區就可以完成rebalance操作--,完全重新分佈區是不必要,只需要移動最小數 量的區就可以達到均勻分佈。

磁碟大小與檔案大小是影響rebalance的權重因素。一個大的磁碟將消耗更多的區。ASM rebalance操作有以下工作流程:
1.對ASM例項,DBA向磁碟組增加磁碟或從磁碟組中刪除磁碟。

2.呼叫RBAL程式來建立一個rebalance計劃,然後開始排程重新分佈操作。

3.RBAL計算評估時間與執行任務所需要的工作,然後給ASM rebalance(ARBx)程式傳送處理請求。調 用的ARBx程式的數量直接由init.ora引數asm_power_limit或在add ,drop或rebalance命令所指定的 power level所決定。

4.持續操作目錄(COD)會被更新來反映一個rebalance活動。COD在influx rebalance失敗時很重要。 恢復例項時對於rebalance與重啟將會看到一個顯著的COD條目。

5.RBAL對ARBs分佈計劃。一般,RBAL對每個檔案生成一個計劃,然而,大檔案可能被多個ARBs分解。

6.ARBx對這些區執行rebalance。每個區會被鎖定,重定位與解鎖。當一個區被鎖定時可以被讀取。 寫也仍然可以執行,但可能需要對新位置重新執行。這個操作會在v$asm_operation中顯示了REBAL。

測試過程如下:
1.檢視asm_power_limit引數設定

SQL> show parameter asm_power

NAME                                 TYPE                   VALUE
------------------------------------ ----------------------  ------------------------------
asm_power_limit                      integer                1

2.向磁碟組datadg增加磁碟

SQL> alter diskgroup datadg add disk '/dev/raw/raw5'

Diskgroup altered.

3.檢視alert_+ASM1.log

SQL> alter diskgroup datadg add disk '/dev/raw/raw5'
Thu Dec 01 15:39:18 CST 2016
NOTE: reconfiguration of group 1/0x489bd291 (DATADG), full=1
Thu Dec 01 15:39:18 CST 2016
NOTE: initializing header on grp 1 disk DATADG_0001
NOTE: cache opening disk 1 of grp 1: DATADG_0001 path:/dev/raw/raw5
NOTE: requesting all-instance disk validation for group=1
Thu Dec 01 15:39:18 CST 2016
NOTE: disk validation pending for group 1/0x489bd291 (DATADG)
SUCCESS: validated disks for 1/0x489bd291 (DATADG)
Thu Dec 01 15:39:21 CST 2016
NOTE: PST update: grp = 1
NOTE: requesting all-instance membership refresh for group=1
Thu Dec 01 15:39:21 CST 2016
NOTE: membership refresh pending for group 1/0x489bd291 (DATADG)
SUCCESS: refreshed membership for 1/0x489bd291 (DATADG)
Thu Dec 01 15:39:27 CST 2016
NOTE: starting rebalance of group 1/0x489bd291 (DATADG) at power 1
Starting background process ARB0
ARB0 started with pid=19, OS id=21560
Thu Dec 01 15:39:27 CST 2016
NOTE: assigning ARB0 to group 1/0x489bd291 (DATADG)
Thu Dec 01 15:39:31 CST 2016
NOTE: X->S down convert bast on F1B3 bastCount=2
NOTE: X->S down convert bast on F1B3 bastCount=3
NOTE: X->S down convert bast on F1B3 bastCount=4
NOTE: X->S down convert bast on F1B3 bastCount=5
NOTE: X->S down convert bast on F1B3 bastCount=6
NOTE: X->S down convert bast on F1B3 bastCount=7
Thu Dec 01 15:40:34 CST 2016
NOTE: stopping process ARB0
Thu Dec 01 15:40:37 CST 2016
SUCCESS: rebalance completed for group 1/0x489bd291 (DATADG)
Thu Dec 01 15:40:37 CST 2016
SUCCESS: rebalance completed for group 1/0x489bd291 (DATADG)
NOTE: PST update: grp = 1
NOTE: PST update: grp = 1
Thu Dec 01 15:48:29 CST 2016

當使用預設引數值asm_power_limit=1,向磁碟組增加一塊磁碟執行rebalance操作花了將近9分鐘( 從2016-12-01 15:39:12開始到2016-12-01 15:48:29完成)

手動指定rebalance power操作如下:
1.向磁碟組datadg增加磁碟

SQL> alter diskgroup datadg add disk '/dev/raw/raw6';

Diskgroup altered.

2.檢視alert_+ASM1.log

SQL> alter diskgroup datadg add disk '/dev/raw/raw6' rebalance power 4
Thu Dec 01 15:48:30 CST 2016
NOTE: reconfiguration of group 1/0x489bd291 (DATADG), full=1
Thu Dec 01 15:48:30 CST 2016
NOTE: initializing header on grp 1 disk DATADG_0002
NOTE: cache opening disk 2 of grp 1: DATADG_0002 path:/dev/raw/raw6
NOTE: requesting all-instance disk validation for group=1
Thu Dec 01 15:48:30 CST 2016
NOTE: disk validation pending for group 1/0x489bd291 (DATADG)
SUCCESS: validated disks for 1/0x489bd291 (DATADG)
Thu Dec 01 15:48:33 CST 2016
NOTE: PST update: grp = 1
NOTE: requesting all-instance membership refresh for group=1
Thu Dec 01 15:48:33 CST 2016
NOTE: membership refresh pending for group 1/0x489bd291 (DATADG)
SUCCESS: refreshed membership for 1/0x489bd291 (DATADG)
Thu Dec 01 15:48:39 CST 2016
NOTE: starting rebalance of group 1/0x489bd291 (DATADG) at power 4
Starting background process ARB0
Starting background process ARB1
ARB0 started with pid=19, OS id=25110
Thu Dec 01 15:48:39 CST 2016
Starting background process ARB2
ARB1 started with pid=21, OS id=25114
Thu Dec 01 15:48:39 CST 2016
Starting background process ARB3
ARB2 started with pid=22, OS id=25119
Thu Dec 01 15:48:40 CST 2016
NOTE: assigning ARB0 to group 1/0x489bd291 (DATADG)
ARB3 started with pid=23, OS id=25121
Thu Dec 01 15:48:40 CST 2016
NOTE: assigning ARB1 to group 1/0x489bd291 (DATADG)
NOTE: assigning ARB2 to group 1/0x489bd291 (DATADG)
NOTE: assigning ARB3 to group 1/0x489bd291 (DATADG)
Thu Dec 01 15:48:47 CST 2016
NOTE: X->S down convert bast on F1B3 bastCount=8
NOTE: X->S down convert bast on F1B3 bastCount=9
NOTE: X->S down convert bast on F1B3 bastCount=10
NOTE: X->S down convert bast on F1B3 bastCount=11
NOTE: X->S down convert bast on F1B3 bastCount=12
NOTE: X->S down convert bast on F1B3 bastCount=13
Thu Dec 01 15:49:21 CST 2016
NOTE: stopping process ARB1
NOTE: stopping process ARB2
NOTE: stopping process ARB0
NOTE: stopping process ARB3
Thu Dec 01 15:49:25 CST 2016
SUCCESS: rebalance completed for group 1/0x489bd291 (DATADG)
Thu Dec 01 15:49:25 CST 2016
SUCCESS: rebalance completed for group 1/0x489bd291 (DATADG)
NOTE: PST update: grp = 1
NOTE: PST update: grp = 1

手動指定rebalance power=4,向磁碟組增加一塊磁碟執行rebalance操作花了將近1分鐘(從2016- 12-01 15:48:30開始到2016-12-01 15:49:25完成)。

對於如何設定rebalance程式數可以參考文件《Oracle Sun Database Machine High Availability Best Practices (Doc ID 1069521.1)》

對於rebalance操作所呼叫的每個ARB程式將會建立一個ARB跟蹤檔案。這個ARB跟蹤檔案可以在DIAG目 錄上的子目錄中找到。跟蹤檔案的內容類似如下:

/u01/app/oracle/admin/+ASM/bdump/+asm1_arb0_25110.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
ORACLE_HOME = /u01/app/oracle/product/10.2.0/db
System name:	Linux
Node name:	jyrac3
Release:	2.6.18-164.el5PAE
Version:	#1 SMP Tue Aug 18 15:59:11 EDT 2009
Machine:	i686
Instance name: +ASM1
Redo thread mounted by this instance: 0 
Oracle process number: 19
Unix process pid: 25110, image: oracle@jyrac3 (ARB0)

*** SERVICE NAME:() 2016-12-01 15:48:40.086
*** SESSION ID:(34.29) 2016-12-01 15:48:40.086
ARB0 relocating file +DATADG.2.1 (1 entries)
ARB0 relocating file +DATADG.256.926895041 (34 entries)
*** 2016-12-01 15:48:58.473
ARB0 relocating file +DATADG.257.926895043 (1 entries)
ARB0 relocating file +DATADG.258.926895047 (16 entries)
ARB0 relocating file +DATADG.259.926895047 (1 entries)
ARB0 relocating file +DATADG.260.926895413 (6 entries)
ARB0 relocating file +DATADG.261.926895419 (18 entries)
*** 2016-12-01 15:49:08.569
ARB0 relocating file +DATADG.262.926895423 (19 entries)
ARB0 relocating file +DATADG.263.926895443 (8 entries)
ARB0 relocating file +DATADG.264.926895475 (33 entries)

在開始執行rebalance操作之後修改asm rebalance power
rebalance power的預設值由asm_power_limit引數所指定為1。rebalance power的值越高, rebalance操作可能完成的越快。較低的rebalance power值可能造成rebalance操作時間很長,但是 消耗較少的CPU與I/O資源。

power的取值範圍從0到11,當為0時停止rebalance,當為11時最快。從oracle 11.2.0.2開始,如果 磁碟組屬性compatible.asm被設定為11.2.0.2或更高的版本,那麼它的取值範圍為0到1024。可以動 態呼叫這個引數,然而調整asm_power_limit只會影響之後的rebalance操作。不影響正在執行的 rebalance操作。為了在開始執行rebalance操作之後修改power,可以執行如下命令:
alter diskgroup rebalance [power n];

測試情況如下:

SQL> show parameter asm_power_limit

NAME                                 TYPE                   VALUE
------------------------------------ ----------------------  ------------------------------
asm_power_limit                      integer                1


SQL> alter diskgroup datadg add disk '/dev/raw/raw5','/dev/raw/raw6';

Diskgroup altered.

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERATION  STATE         POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE  EST_MINUTES
------------ ---------- -------- ---------- ---------- ---------- ---------- ----------  -----------
           1 REBAL      RUN               1          1          2        772         60           12

檢視alert_+ASM1.log

Thu Dec 01 16:47:43 CST 2016
NOTE: reconfiguration of group 1/0x489bd291 (DATADG), full=1
Thu Dec 01 16:47:43 CST 2016
NOTE: initializing header on grp 1 disk DATADG_0001
NOTE: initializing header on grp 1 disk DATADG_0002
NOTE: cache opening disk 1 of grp 1: DATADG_0001 path:/dev/raw/raw5
NOTE: cache opening disk 2 of grp 1: DATADG_0002 path:/dev/raw/raw6
NOTE: requesting all-instance disk validation for group=1
Thu Dec 01 16:47:43 CST 2016
NOTE: disk validation pending for group 1/0x489bd291 (DATADG)
SUCCESS: validated disks for 1/0x489bd291 (DATADG)
Thu Dec 01 16:47:47 CST 2016
NOTE: PST update: grp = 1
NOTE: requesting all-instance membership refresh for group=1
Thu Dec 01 16:47:48 CST 2016
NOTE: membership refresh pending for group 1/0x489bd291 (DATADG)
SUCCESS: refreshed membership for 1/0x489bd291 (DATADG)
Thu Dec 01 16:47:54 CST 2016
NOTE: starting rebalance of group 1/0x489bd291 (DATADG) at power 1
Starting background process ARB0
ARB0 started with pid=18, OS id=16007
Thu Dec 01 16:47:54 CST 2016
NOTE: assigning ARB0 to group 1/0x489bd291 (DATADG)
Thu Dec 01 16:48:00 CST 2016
NOTE: X->S down convert bast on F1B3 bastCount=27
NOTE: X->S down convert bast on F1B3 bastCount=28
NOTE: X->S down convert bast on F1B3 bastCount=29
NOTE: X->S down convert bast on F1B3 bastCount=30
NOTE: X->S down convert bast on F1B3 bastCount=31
NOTE: X->S down convert bast on F1B3 bastCount=32
NOTE: X->S down convert bast on F1B3 bastCount=33
NOTE: X->S down convert bast on F1B3 bastCount=34
NOTE: X->S down convert bast on F1B3 bastCount=35
NOTE: X->S down convert bast on F1B3 bastCount=36
Thu Dec 01 16:48:09 CST 2016

從資訊Starting background process ARB0,可知只啟動了一個ARB程式,因為asm_power_limit引數為1

SQL> alter diskgroup datadg rebalance power 8;

Diskgroup altered.

檢視alert_+ASM1.log

Thu Dec 01 16:48:09 CST 2016
ERROR: ORA-1013 thrown in ARB0 for group number 1
Thu Dec 01 16:48:09 CST 2016
Errors in file /u01/app/oracle/admin/+ASM/bdump/+asm1_arb0_16007.trc:
ORA-01013: user requested cancel of current operation
Thu Dec 01 16:48:09 CST 2016
NOTE: stopping process ARB0
Thu Dec 01 16:48:12 CST 2016
NOTE: rebalance interrupted for group 1/0x489bd291 (DATADG)
Thu Dec 01 16:48:12 CST 2016
NOTE: PST update: grp = 1
NOTE: requesting all-instance membership refresh for group=1
Thu Dec 01 16:48:12 CST 2016
NOTE: membership refresh pending for group 1/0x489bd291 (DATADG)
SUCCESS: refreshed membership for 1/0x489bd291 (DATADG)
Thu Dec 01 16:48:18 CST 2016
NOTE: starting rebalance of group 1/0x489bd291 (DATADG) at power 8
Starting background process ARB0
Starting background process ARB1
ARB0 started with pid=18, OS id=16133
Thu Dec 01 16:48:19 CST 2016
Starting background process ARB2
ARB1 started with pid=19, OS id=16135
Thu Dec 01 16:48:19 CST 2016
Starting background process ARB3
ARB2 started with pid=21, OS id=16142
Thu Dec 01 16:48:19 CST 2016
Starting background process ARB4
ARB3 started with pid=22, OS id=16144
Thu Dec 01 16:48:19 CST 2016
Starting background process ARB5
ARB4 started with pid=23, OS id=16146
Thu Dec 01 16:48:19 CST 2016
Starting background process ARB6
ARB5 started with pid=24, OS id=16148
Thu Dec 01 16:48:20 CST 2016
Starting background process ARB7
ARB6 started with pid=25, OS id=16150
Thu Dec 01 16:48:20 CST 2016
NOTE: assigning ARB0 to group 1/0x489bd291 (DATADG)
ARB7 started with pid=26, OS id=16157
Thu Dec 01 16:48:20 CST 2016
NOTE: assigning ARB1 to group 1/0x489bd291 (DATADG)
NOTE: assigning ARB2 to group 1/0x489bd291 (DATADG)
NOTE: assigning ARB3 to group 1/0x489bd291 (DATADG)
NOTE: assigning ARB4 to group 1/0x489bd291 (DATADG)
NOTE: assigning ARB5 to group 1/0x489bd291 (DATADG)
NOTE: assigning ARB6 to group 1/0x489bd291 (DATADG)
NOTE: assigning ARB7 to group 1/0x489bd291 (DATADG)
Thu Dec 01 16:48:48 CST 2016
NOTE: stopping process ARB5
NOTE: stopping process ARB2
NOTE: stopping process ARB7
NOTE: stopping process ARB1
NOTE: stopping process ARB6
Thu Dec 01 16:49:01 CST 2016
NOTE: stopping process ARB0
Thu Dec 01 16:49:11 CST 2016
NOTE: stopping process ARB4
NOTE: stopping process ARB3
Thu Dec 01 16:49:14 CST 2016
SUCCESS: rebalance completed for group 1/0x489bd291 (DATADG)
Thu Dec 01 16:49:14 CST 2016
SUCCESS: rebalance completed for group 1/0x489bd291 (DATADG)
NOTE: PST update: grp = 1
NOTE: PST update: grp = 1

從資訊NOTE: stopping process ARB0,可知在執行alter diskgroup datadg rebalance power 8命 令後,終止了之前所啟動的rebalance程式,後面啟動了8個ARB程式來完成rebalance操作。

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

相關文章