ASM磁碟組更換磁碟的操作方法
更換儲存操作步驟
1、增加新磁碟,對新磁碟建立新asm disk
2、把新asm disk加入asm group
3、等待asm group資料重平衡完畢
4、再從asm group刪除舊磁碟對應的舊asm disk
5、等待asm group資料重平衡完畢
6、拆下舊磁碟
磁碟組asm group要改變大小:
如果原來磁碟組1T,現在想換成100G
如asm group是外部冗餘,裡面只有一個asm disk,這個asm disk 1T,則新增一個asm disk 100G,再刪除1T的asm disk
如asm group是normal冗餘,裡面有兩個asm disk,這兩個asm disk 總計1T,則新增兩個asm disk 總結100G,再刪除1T的兩個asm dis
v$asm_operation
顯示asm重平衡的資訊
V$ASM_OPERATION displays one row for every active Oracle ASM long running operation executing in the Oracle ASM instance.
select * from v$asm_operation; --此語句在ASM例項上執行才能看到準確資訊
ASM_POWER_LIMIT
ASM_POWER_LIMIT指定用於磁碟再平衡的自動儲存管理例項的最大功耗。上限越高,再平衡的速度就越快。較低的值需要更長的時間,但是消耗更少的處理和I/O資源。
ASM_POWER_LIMIT specifies the maximum power on an Automatic Storage Management instance for disk rebalancing. The higher the limit, the faster rebalancing will complete. Lower values will take longer, but consume fewer processing and I/O resources
ASM_POWER_LIMIT設定為0時,不會自動重平衡,但是可以使用下面的語句來手動重平衡(比如白天加盤了,晚上再讓它手動執行)
alter diskgroup DATA rebalance power 10; --此語句只能在ASM例項上執行,且連線方式為as sysasm
舊磁碟可以直接物理拆除,拆除後對應的asm disks自動消失了,這個asm disk可以給後面的磁碟重用,比如sdd1對應的asm disk是/dev/oracleasm/disks/OCPFRA1,把物理磁碟sdd拆掉後,/dev/oracleasm/disks/OCPFRA1自動消失了,如果以後來了個新磁碟sdk,可以oracleasm createdisk OCPFRA1 /dev/sdk1
ASM磁碟組更換磁碟的實踐案例,對空間不足的asm group更換空間更大的asm disk(本案例4-9步驟對應本文最上說明更換儲存操作步驟的1-6個步驟)
1、確定空間不足的ASM磁碟組,結果是FRA,可用空間36%
SQL> select name,total_mb,free_mb,round((free_mb/total_mb)*100) from gv$asm_diskgroup;
NAME TOTAL_MB FREE_MB ROUND((FREE_MB/TOTAL_MB)*100)
-------------------- ---------- ---------- -----------------------------
DATA 6141 4195 68
FRA 2047 739 36
2、確定FRA的冗餘方式和對應的asm disk,結果是EXTERN和/dev/oracleasm/disks/OCPFRA1
SQL> select a.path,a.name,a.mode_status,b.name diskgroupname,b.type from v$asm_disk a,v$asm_diskgroup b where a.group_number=b.group_number and b.name='FRA';
PATH NAME MODE_ST DISKGROUPN TYPE
-------------------------------------------------- -------------------- ------- ---------- ------
/dev/oracleasm/disks/OCPFRA1 FRA_0000 ONLINE FRA EXTERN
3、確定/dev/oracleasm/disks/OCPFRA1對應的物理磁碟資訊、對應的資料庫物件,結果是sdd1容量2G、對應表TABLE_TEW
[root@ASMDB ~]# ll /dev/oracleasm/disks/OCPFRA1
brw-rw---- 1 grid dba 8, 49 Jun 7 19:11 /dev/oracleasm/disks/OCPFRA1
[root@ASMDB ~]# ll /dev |grep disk |grep 8 |grep 49
brw-r----- 1 root disk 8, 49 Jun 7 16:11 sdd1
[root@ASMDB ~]# fdisk -l |grep sdd
Disk /dev/sdd: 2147 MB, 2147483648 bytes
/dev/sdd1 1 261 2096451 83 Linux
[oracle@ASMDB ~]$ sqlplus / as sysdba
SQL> select tablespace_name,file_name from dba_data_files where file_name like '%FRA%';
TABLESPACE_NAME FILE_NAME
-------------------- ------------------------------------------------------------
TEW +FRA/tew01.dbf
SQL> select table_name,tablespace_name from dba_tables where tablespace_name='TEW' and rownum<2;
TABLE_NAME TABLESPACE_NAME
------------------------------ --------------------
TABLE_TEW TEW
SQL> select count(*) from TABLE_TEW;
COUNT(*)
----------
601480
4、新增的物理磁碟是sdg1,建立asm disk為/dev/oracleasm/disks/OCPFRA2
[root@ASMDB ~]# oracleasm createdisk OCPFRA2 /dev/sdg1
[root@ASMDB ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
[root@ASMDB ~]# oracleasm listdisks
OCPDATA1
OCPDATA2
OCPDATA3
OCPFRA1
OCPFRA2
[grid@ASMDB ~]$ asmcmd lsdsk --candidate
Path
/dev/oracleasm/disks/OCPFRA2
5、把新asm disk加入asm group,必須使用as sysasm
[grid@ASMDB ~]$ sqlplus / as sysasm
SQL> alter diskgroup FRA add disk '/dev/oracleasm/disks/OCPFRA2' rebalance power 10;
Diskgroup altered.
6、等待asm group資料重平衡完畢,即v$asm_operation查詢結果為空,重平衡後立即發現asm group的空間和asm disk有變化,空間變成了新舊兩塊asm disk的總空間,可用空間74%,新asm disk /dev/oracleasm/disks/OCPFRA2加上來了
SQL> select * from v$asm_operation;
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
2 REBAL RUN 10 10 495 785 672
0
.
.
.
SQL> select * from v$asm_operation;
no rows selected
SQL> select name,total_mb,free_mb,round((free_mb/total_mb)*100) from gv$asm_diskgroup;
NAME TOTAL_MB FREE_MB ROUND((FREE_MB/TOTAL_MB)*100)
-------------------- ---------- ---------- -----------------------------
DATA 6141 4195 68
FRA 5114 3779 74
SQL> select a.path,a.name,a.mode_status,b.name diskgroupname,b.type from v$asm_disk a,v$asm_diskgroup b where a.group_number=b.group_number and b.name='FRA';
PATH NAME MODE_ST DISKGROUPN TYPE
-------------------------------------------------- -------------------- ------- ---------- ------
/dev/oracleasm/disks/OCPFRA1 FRA_0000 ONLINE FRA EXTERN
/dev/oracleasm/disks/OCPFRA2 FRA_0001 ONLINE FRA EXTERN
7、再從asm group刪除舊磁碟對應的舊asm disk,參考第三步資訊,舊磁碟sdd1對應asm disk是/dev/oracleasm/disks/OCPFRA1,但是這裡不能寫asm disk路徑名稱,只能寫asm disk名稱,即v$asm_disk.name
SQL> alter diskgroup FRA drop disk 'FRA_0000' rebalance power 10;
Diskgroup altered.
8、等待asm group資料重平衡完畢,即v$asm_operation查詢結果為空,重平衡後立即發現asm group的空間和asm disk有變化,空間變成了新asm disk的總空間,可用空間57%,舊asm disk被刪除了,且驗證該asm group上的表正常
SQL> select * from v$asm_operation;
no rows selected
SQL> select name,total_mb,free_mb,round((free_mb/total_mb)*100) from gv$asm_diskgroup;
NAME TOTAL_MB FREE_MB ROUND((FREE_MB/TOTAL_MB)*100)
-------------------- ---------- ---------- -----------------------------
DATA 6141 4195 68
FRA 3067 1734 57
SQL> select a.path,a.name,a.mode_status,b.name diskgroupname,b.type from v$asm_disk a,v$asm_diskgroup b where a.group_number=b.group_number and b.name='FRA';
PATH NAME MODE_ST DISKGROUPN TYPE
-------------------------------------------------- -------------------- ------- ---------- ------
/dev/oracleasm/disks/OCPFRA2 FRA_0001 ONLINE FRA EXTERN
[oracle@ASMDB ~]$ sqlplus / as sysdba
SQL> select count(*) from TABLE_TEW;
COUNT(*)
----------
601480
9、拆下舊磁碟,重啟電腦後啟動DB,發現一切正常,驗證結果和上面第8步的結果一致
1、增加新磁碟,對新磁碟建立新asm disk
2、把新asm disk加入asm group
3、等待asm group資料重平衡完畢
4、再從asm group刪除舊磁碟對應的舊asm disk
5、等待asm group資料重平衡完畢
6、拆下舊磁碟
磁碟組asm group要改變大小:
如果原來磁碟組1T,現在想換成100G
如asm group是外部冗餘,裡面只有一個asm disk,這個asm disk 1T,則新增一個asm disk 100G,再刪除1T的asm disk
如asm group是normal冗餘,裡面有兩個asm disk,這兩個asm disk 總計1T,則新增兩個asm disk 總結100G,再刪除1T的兩個asm dis
v$asm_operation
顯示asm重平衡的資訊
V$ASM_OPERATION displays one row for every active Oracle ASM long running operation executing in the Oracle ASM instance.
select * from v$asm_operation; --此語句在ASM例項上執行才能看到準確資訊
ASM_POWER_LIMIT
ASM_POWER_LIMIT指定用於磁碟再平衡的自動儲存管理例項的最大功耗。上限越高,再平衡的速度就越快。較低的值需要更長的時間,但是消耗更少的處理和I/O資源。
ASM_POWER_LIMIT specifies the maximum power on an Automatic Storage Management instance for disk rebalancing. The higher the limit, the faster rebalancing will complete. Lower values will take longer, but consume fewer processing and I/O resources
ASM_POWER_LIMIT設定為0時,不會自動重平衡,但是可以使用下面的語句來手動重平衡(比如白天加盤了,晚上再讓它手動執行)
alter diskgroup DATA rebalance power 10; --此語句只能在ASM例項上執行,且連線方式為as sysasm
舊磁碟可以直接物理拆除,拆除後對應的asm disks自動消失了,這個asm disk可以給後面的磁碟重用,比如sdd1對應的asm disk是/dev/oracleasm/disks/OCPFRA1,把物理磁碟sdd拆掉後,/dev/oracleasm/disks/OCPFRA1自動消失了,如果以後來了個新磁碟sdk,可以oracleasm createdisk OCPFRA1 /dev/sdk1
ASM磁碟組更換磁碟的實踐案例,對空間不足的asm group更換空間更大的asm disk(本案例4-9步驟對應本文最上說明更換儲存操作步驟的1-6個步驟)
1、確定空間不足的ASM磁碟組,結果是FRA,可用空間36%
SQL> select name,total_mb,free_mb,round((free_mb/total_mb)*100) from gv$asm_diskgroup;
NAME TOTAL_MB FREE_MB ROUND((FREE_MB/TOTAL_MB)*100)
-------------------- ---------- ---------- -----------------------------
DATA 6141 4195 68
FRA 2047 739 36
2、確定FRA的冗餘方式和對應的asm disk,結果是EXTERN和/dev/oracleasm/disks/OCPFRA1
SQL> select a.path,a.name,a.mode_status,b.name diskgroupname,b.type from v$asm_disk a,v$asm_diskgroup b where a.group_number=b.group_number and b.name='FRA';
PATH NAME MODE_ST DISKGROUPN TYPE
-------------------------------------------------- -------------------- ------- ---------- ------
/dev/oracleasm/disks/OCPFRA1 FRA_0000 ONLINE FRA EXTERN
3、確定/dev/oracleasm/disks/OCPFRA1對應的物理磁碟資訊、對應的資料庫物件,結果是sdd1容量2G、對應表TABLE_TEW
[root@ASMDB ~]# ll /dev/oracleasm/disks/OCPFRA1
brw-rw---- 1 grid dba 8, 49 Jun 7 19:11 /dev/oracleasm/disks/OCPFRA1
[root@ASMDB ~]# ll /dev |grep disk |grep 8 |grep 49
brw-r----- 1 root disk 8, 49 Jun 7 16:11 sdd1
[root@ASMDB ~]# fdisk -l |grep sdd
Disk /dev/sdd: 2147 MB, 2147483648 bytes
/dev/sdd1 1 261 2096451 83 Linux
[oracle@ASMDB ~]$ sqlplus / as sysdba
SQL> select tablespace_name,file_name from dba_data_files where file_name like '%FRA%';
TABLESPACE_NAME FILE_NAME
-------------------- ------------------------------------------------------------
TEW +FRA/tew01.dbf
SQL> select table_name,tablespace_name from dba_tables where tablespace_name='TEW' and rownum<2;
TABLE_NAME TABLESPACE_NAME
------------------------------ --------------------
TABLE_TEW TEW
SQL> select count(*) from TABLE_TEW;
COUNT(*)
----------
601480
4、新增的物理磁碟是sdg1,建立asm disk為/dev/oracleasm/disks/OCPFRA2
[root@ASMDB ~]# oracleasm createdisk OCPFRA2 /dev/sdg1
[root@ASMDB ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
[root@ASMDB ~]# oracleasm listdisks
OCPDATA1
OCPDATA2
OCPDATA3
OCPFRA1
OCPFRA2
[grid@ASMDB ~]$ asmcmd lsdsk --candidate
Path
/dev/oracleasm/disks/OCPFRA2
5、把新asm disk加入asm group,必須使用as sysasm
[grid@ASMDB ~]$ sqlplus / as sysasm
SQL> alter diskgroup FRA add disk '/dev/oracleasm/disks/OCPFRA2' rebalance power 10;
Diskgroup altered.
6、等待asm group資料重平衡完畢,即v$asm_operation查詢結果為空,重平衡後立即發現asm group的空間和asm disk有變化,空間變成了新舊兩塊asm disk的總空間,可用空間74%,新asm disk /dev/oracleasm/disks/OCPFRA2加上來了
SQL> select * from v$asm_operation;
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
EST_MINUTES ERROR_CODE
----------- --------------------------------------------
2 REBAL RUN 10 10 495 785 672
0
.
.
.
SQL> select * from v$asm_operation;
no rows selected
SQL> select name,total_mb,free_mb,round((free_mb/total_mb)*100) from gv$asm_diskgroup;
NAME TOTAL_MB FREE_MB ROUND((FREE_MB/TOTAL_MB)*100)
-------------------- ---------- ---------- -----------------------------
DATA 6141 4195 68
FRA 5114 3779 74
SQL> select a.path,a.name,a.mode_status,b.name diskgroupname,b.type from v$asm_disk a,v$asm_diskgroup b where a.group_number=b.group_number and b.name='FRA';
PATH NAME MODE_ST DISKGROUPN TYPE
-------------------------------------------------- -------------------- ------- ---------- ------
/dev/oracleasm/disks/OCPFRA1 FRA_0000 ONLINE FRA EXTERN
/dev/oracleasm/disks/OCPFRA2 FRA_0001 ONLINE FRA EXTERN
7、再從asm group刪除舊磁碟對應的舊asm disk,參考第三步資訊,舊磁碟sdd1對應asm disk是/dev/oracleasm/disks/OCPFRA1,但是這裡不能寫asm disk路徑名稱,只能寫asm disk名稱,即v$asm_disk.name
SQL> alter diskgroup FRA drop disk 'FRA_0000' rebalance power 10;
Diskgroup altered.
8、等待asm group資料重平衡完畢,即v$asm_operation查詢結果為空,重平衡後立即發現asm group的空間和asm disk有變化,空間變成了新asm disk的總空間,可用空間57%,舊asm disk被刪除了,且驗證該asm group上的表正常
SQL> select * from v$asm_operation;
no rows selected
SQL> select name,total_mb,free_mb,round((free_mb/total_mb)*100) from gv$asm_diskgroup;
NAME TOTAL_MB FREE_MB ROUND((FREE_MB/TOTAL_MB)*100)
-------------------- ---------- ---------- -----------------------------
DATA 6141 4195 68
FRA 3067 1734 57
SQL> select a.path,a.name,a.mode_status,b.name diskgroupname,b.type from v$asm_disk a,v$asm_diskgroup b where a.group_number=b.group_number and b.name='FRA';
PATH NAME MODE_ST DISKGROUPN TYPE
-------------------------------------------------- -------------------- ------- ---------- ------
/dev/oracleasm/disks/OCPFRA2 FRA_0001 ONLINE FRA EXTERN
[oracle@ASMDB ~]$ sqlplus / as sysdba
SQL> select count(*) from TABLE_TEW;
COUNT(*)
----------
601480
9、拆下舊磁碟,重啟電腦後啟動DB,發現一切正常,驗證結果和上面第8步的結果一致
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30126024/viewspace-2155829/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ASM磁碟組限制ASM
- 更換ocr和votingdisk磁碟組
- 遷移ASM磁碟組ASM
- 【ASM】Oracle asm磁碟被格式化,如何掛載該磁碟組ASMOracle
- ASM 磁碟組的建立及擴容ASM
- 【ASM】Oracle asm刪除磁碟組注意事項ASMOracle
- 一次ASM新增新的磁碟組ASM
- ASM磁碟組擴容操作文件ASM
- ORACLE ASM磁碟組空間溢位OracleASM
- 使用udev擴充套件ASM磁碟組dev套件ASM
- Oracle ASM磁碟組擴容(AIX7.1)OracleASMAI
- ASM磁碟組ORA-15042 ORA-15096ASM
- ASM重新命名包含OCR/vote file的磁碟組ASM
- Oracle RAC環境下ASM磁碟組擴容OracleASM
- Oracle RAC ASM磁碟組擴容時遇到的VIP漂移OracleASM
- 基於裸裝置的ASM磁碟組擴容方案ASM
- RAC之grid叢集安裝及ASM磁碟組配置ASM
- 遷移OCR和VotingDisk並刪除原ASM磁碟組ASM
- 【ASM】ASM磁碟頭被重寫,如何修復ASM
- ORACLE ASM的SSD磁碟空間回收分析OracleASM
- 從定位資料塊所在ASM磁碟到ASM strippingASM
- (grid重灌後圖形介面報錯)ASM磁碟組字元介面配置ASM字元
- Oracle asm磁碟損壞異常恢復OracleASM
- Oracle RAC日常運維-ASM磁碟擴容Oracle運維ASM
- 【BUILD_ORACLE】使用ASMLib包搭建ASM磁碟UIOracleASM
- ASM磁碟簡單維護,新增,刪除ASM
- 在ASM磁碟組中刪除歸檔日誌報ORA-15028ASM
- 【ARCH】Oracle 判斷asm磁碟組大小,超過閾值清理指令碼OracleASM指令碼
- asm磁碟組依賴導致資料庫自啟動報錯ASM資料庫
- 關於Oracle 10g ASM磁碟大小的限制Oracle 10gASM
- Oracle資料庫 ASM磁碟線上擴容Oracle資料庫ASM
- 組磁碟陣列的主要作用陣列
- 如何檢視Oracle RAC的asm磁碟的udev對應關係OracleASMdev
- Oracle 11.2.0.4 rac for aix acfs異常環境的克隆環境ASM磁碟組掛載緩慢OracleAIASM
- ASM磁碟頭資訊損壞和修復(kfed/dd)ASM
- 問題:未清空磁碟被新增到磁碟組觸發壞塊
- win7系統怎麼給磁碟加密?win7系統給磁碟加密操作方法Win7加密
- 【資料庫資料恢復】ASM磁碟組掉線的Oracle資料庫資料恢復案例資料庫資料恢復ASMOracle