環(huán)境描述:
創(chuàng)新互聯(lián)公司專注于企業(yè)全網(wǎng)整合營(yíng)銷推廣、網(wǎng)站重做改版、肥東網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5響應(yīng)式網(wǎng)站、成都做商城網(wǎng)站、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁(yè)設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為肥東等各大城市提供網(wǎng)站開(kāi)發(fā)制作服務(wù)。
ORACLE Version:11.2.0.3.0
RHEL6.4+ASMlib
由于共享存儲(chǔ)需進(jìn)行升級(jí),故需對(duì)所有ASM磁盤(pán)進(jìn)行在線遷移。
1.收集信息
su - grid
export ORACLE_SID=+ASM1
sqlplus / as sysasm
col NAME for a10
col LABEL for a20
col STATE for a10
col FAILGROUP for a10
col PATH for a20
set line 150
SELECT GROUP_NUMBER, DISK_NUMBER, LABEL, STATE, FAILGROUP, NAME, PATH, TOTAL_MB, FREE_MB FROM V$ASM_DISK;
GROUP_NUMBER DISK_NUMBER LABEL STATE FAILGROUP NAME PATH TOTAL_MB FREE_MB
------------ ----------- -------------------- ---------- ---------- ---------- -------------------- ---------- ---------
1 0 DATA01 NORMAL DATA01 DATA01 ORCL:DATA01 20479 16773
1 1 DATA02 NORMAL DATA02 DATA02 ORCL:DATA02 20479 16773
2 0 FRA01 NORMAL FRA01 FRA01 ORCL:FRA01 30719 28906
3 0 OCR01 NORMAL OCR01 OCR01 ORCL:OCR01 2046 1921
3 1 OCR02 NORMAL OCR02 OCR02 ORCL:OCR02 2046 1952
3 2 OCR03 NORMAL OCR03 OCR03 ORCL:OCR03 2046 1954
3 3 OCR04 NORMAL OCR04 OCR04 ORCL:OCR04 2046 1955
2.備份整庫(kù)以及OCR磁盤(pán)組
export ORACLE_SID=JSTDB1
rman target /
crosscheck archivelog all;
delete expired archivelog all;
backup format '/u01/rman/fulldb_%d_%U' database include current controlfile plus archivelog delete input;
su - root
ocrconfig -export /u01/rman/ocr.bak
3.映射新磁盤(pán)給操作系統(tǒng)
Disk /dev/sdi: 21.5 GB
Disk /dev/sdk: 32.2 GB
Disk /dev/sdl: 2147 MB
Disk /dev/sdj: 21.5 GB
Disk /dev/sdm: 2147 MB
Disk /dev/sdn: 2147 MB
4.標(biāo)識(shí)為ASM磁盤(pán)
/etc/init.d/oracleasm createdisk NEW_DATA01 /dev/sdi1
/etc/init.d/oracleasm createdisk NEW_DATA02 /dev/sdj1
/etc/init.d/oracleasm createdisk NEW_FRA01 /dev/sdk1
/etc/init.d/oracleasm createdisk NEW_OCR01 /dev/sdl1
/etc/init.d/oracleasm createdisk NEW_OCR02 /dev/sdm1
/etc/init.d/oracleasm createdisk NEW_OCR03 /dev/sdn1
/etc/init.d/oracleasm scandisks
/etc/init.d/oracleasm listdisks
col NAME for a10
col LABEL for a20
col STATE for a10
col FAILGROUP for a10
col PATH for a20
set line 150
SELECT GROUP_NUMBER, DISK_NUMBER, LABEL, STATE, FAILGROUP, NAME, PATH, TOTAL_MB, FREE_MB FROM V$ASM_DISK;
GROUP_NUMBER DISK_NUMBER LABEL STATE FAILGROUP NAME PATH TOTAL_MB FREE_MB
------------ ----------- -------------------- ---------- ---------- ---------- -------------------- ---------- ---------
0 0 NEW_DATA01 NORMAL ORCL:NEW_DATA01 00
0 1 NEW_DATA02 NORMAL ORCL:NEW_DATA02 00
0 2 NEW_FRA01 NORMAL ORCL:NEW_FRA01 00
0 3 NEW_OCR01 NORMAL ORCL:NEW_OCR01 00
0 4 NEW_OCR02 NORMAL ORCL:NEW_OCR02 00
0 5 NEW_OCR03 NORMAL ORCL:NEW_OCR03 00
1 0 DATA01 NORMAL DATA01 DATA01 ORCL:DATA01 20479 16773
1 1 DATA02 NORMAL DATA02 DATA02 ORCL:DATA02 20479 16773
2 0 FRA01 NORMAL FRA01 FRA01 ORCL:FRA01 30719 30142
3 0 OCR01 NORMAL OCR01 OCR01 ORCL:OCR01 2046 1921
3 1 OCR02 NORMAL OCR02 OCR02 ORCL:OCR02 2046 1952
3 2 OCR03 NORMAL OCR03 OCR03 ORCL:OCR03 2046 1954
3 3 OCR04 NORMAL OCR04 OCR04 ORCL:OCR04 2046 1955
14 rows selected.
5.添加磁盤(pán)到ASM磁盤(pán)組
ALTER DISKGROUP DATA ADD DISK 'ORCL:NEW_DATA01';
ALTER DISKGROUP DATA ADD DISK 'ORCL:NEW_DATA02';
ALTER DISKGROUP FRA ADD DISK 'ORCL:NEW_FRA01';
ALTER DISKGROUP OCR ADD DISK 'ORCL:NEW_OCR01';
ALTER DISKGROUP OCR ADD DISK 'ORCL:NEW_OCR02';
ALTER DISKGROUP OCR ADD DISK 'ORCL:NEW_OCR03';
或者使用asmca圖形界面添加
6.刪除磁盤(pán)
ALTER DISKGROUP DATA DROP DISK DATA01;
ALTER DISKGROUP DATA DROP DISK DATA02;
ALTER DISKGROUP FRA DROP DISK FRA01;
ALTER DISKGROUP OCR DROP DISK OCR01;
ALTER DISKGROUP OCR DROP DISK OCR02;
ALTER DISKGROUP OCR DROP DISK OCR03;
ALTER DISKGROUP OCR DROP DISK OCR04;
查看刪除后的狀態(tài)
col NAME for a10
col LABEL for a20
col STATE for a10
col FAILGROUP for a10
col PATH for a20
set line 150
SELECT GROUP_NUMBER, DISK_NUMBER, LABEL, STATE, FAILGROUP, NAME, PATH, TOTAL_MB, FREE_MB FROM V$ASM_DISK;
GROUP_NUMBER DISK_NUMBER LABEL STATE FAILGROUP NAME PATH TOTAL_MB FREE_MB
------------ ----------- -------------------- ---------- ---------- ---------- -------------------- ---------- ---------
0 2 NEW_FRA01 NORMAL ORCL:NEW_FRA01 00
0 3 NEW_OCR01 NORMAL ORCL:NEW_OCR01 00
0 4 NEW_OCR02 NORMAL ORCL:NEW_OCR02 00
0 5 NEW_OCR03 NORMAL ORCL:NEW_OCR03 00
1 0 DATA01 DROPPING DATA01 DATA01 ORCL:DATA01 20479 20240
1 1 DATA02 NORMAL DATA02 DATA02 ORCL:DATA02 20479 18089
2 0 FRA01 NORMAL FRA01 FRA01 ORCL:FRA01 30719 30142
3 0 OCR01 NORMAL OCR01 OCR01 ORCL:OCR01 2046 1921
3 1 OCR02 NORMAL OCR02 OCR02 ORCL:OCR02 2046 1952
3 2 OCR03 NORMAL OCR03 OCR03 ORCL:OCR03 2046 1954
3 3 OCR04 NORMAL OCR04 OCR04 ORCL:OCR04 2046 1955
1 2 NEW_DATA01 NORMAL NEW_DATA01 NEW_DATA01 ORCL:NEW_DATA01 20479 18085
1 3 NEW_DATA02 NORMAL NEW_DATA02 NEW_DATA02 ORCL:NEW_DATA02 20479 18086
14 rows selected.
或者使用asmca圖形界面刪除
7.查看reblance的狀態(tài)
COL ERROR_CODE FOR A10;
select * from v$asm_operation;
GROUP_NUMBER OPERATION STATE POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES ERROR_CODE
------------ --------------- ---------- ---------- ---------- ---------- ---------- ---------- ----------- ----------
1 REBAL RUN 1 1 1359 2480 1800 0
select * from v$asm_operation;
GROUP_NUMBER OPERATION STATE POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES ERROR_CODE
------------ --------------- ---------- ---------- ---------- ---------- ---------- ---------- ----------- ----------
3 REBAL REAP 1 1 130148 1390 0
select * from v$asm_operation;
GROUP_NUMBER OPERATION STATE POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES ERROR_CODE
------------ --------------- ---------- ---------- ---------- ---------- ---------- ---------- ----------- ----------
3 REBAL WAIT 1
可以看到刪除的狀態(tài):RUN->REAP->WAIT->結(jié)束
調(diào)整reblance的速度
alter diskgroup DATA rebalance power 8;
select * from v$asm_operation;
GROUP_NUMBER OPERATION STATE POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES ERROR_CODE
------------ --------------- ---------- ---------- ---------- ---------- ---------- ---------- ----------- ----------
1 REBAL RUN 8 8 120 4006 1440 2
Reblance成功
select * from v$asm_operation;
no rows selected
9.查看RAC的狀態(tài)
crsctl status res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.FRA.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.LISTENER.lsnr
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.OCR.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.asm
ONLINE ONLINE rac1 Started
ONLINE ONLINE rac2 Started
ora.gsd
ONLINE OFFLINE rac1
ONLINE OFFLINE rac2
ora.net1.network
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.ons
ONLINE ONLINE rac1
ONLINE ONLINE rac2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2
ora.LISTENER_SCAN2.lsnr
1 ONLINE ONLINE rac2
ora.LISTENER_SCAN3.lsnr
1 ONLINE ONLINE rac2
ora.cvu
1 ONLINE ONLINE rac2
ora.jstdb.db
1 ONLINE ONLINE rac1 Open
2 ONLINE ONLINE rac2 Open
ora.paydb.db
1 ONLINE ONLINE rac1 Open
2 ONLINE ONLINE rac2 Open
ora.oc4j
1 ONLINE ONLINE rac2
ora.rac1.vip
1 ONLINE ONLINE rac1
ora.rac2.vip
1 ONLINE ONLINE rac2
ora.scan1.vip
1 ONLINE ONLINE rac2
ora.scan2.vip
1 ONLINE ONLINE rac2
ora.scan3.vip
1 ONLINE ONLINE rac2
10.將drop后的磁盤(pán)從存儲(chǔ)系統(tǒng)中取消映射
11.重啟服務(wù)器(生產(chǎn)系統(tǒng)請(qǐng)慎重此操作)測(cè)試RAC狀態(tài)正常