dd模擬asm磁碟容災測試

oracle_mao發表於2012-06-26

環境:

操作機器:192.168.96.139

GRID版本:11R2    DB版本:11R1

思路:

首先建立新磁碟組TEST_ZKF,磁碟組裡包括2塊磁碟disk138disk141,且狀態為member。選另外2塊磁碟disk139disk140作為候選盤(本實驗中先講disk139disk140從磁碟組裡drop,然後再用dd命令講磁碟頭內容清空,隨後磁碟的狀態就變為CANDIDATE

步驟:

1、         disk138disk139disk140disk141從磁碟組DATA_ZKF磁碟組裡drop

SQL>alter diskgroup data_zkf drop disk DATA_ZKF_0009;

SQL>alter diskgroup data_zkf drop disk DATA_ZKF_0010;

SQL>alter diskgroup data_zkf drop disk DATA_ZKF_0011;

SQL>alter diskgroup data_zkf drop disk DATA_ZKF_0012;

備註:DATA_ZKF_0009為磁碟在磁碟組裡的名字,可以從v$asm_disk中得到。

2、         建立新磁碟組TEST_ZKF

SQL>create diskgroup TEST_ZKF external redundancy disk ‘/dev/rdisk/disk138’;

SQL>alter diskgroup TEST_ZKF add disk ‘/dev/rdisk/disk141’;

3、         在磁碟組裡建立表空間以及表

SQL>create tablespace mao ‘+TEST_ZKF’;

SQL>create table t(id int) tablespace mao;

4、         關閉DB,關閉ASM

SQL>conn / as sysasm

SQL>shutdown abort

5、         disk141disk139上的內容清空

dd if=/dev/zero f=disk141 bs=1k

dd  if=/dev/zero  of=disk139  bs=1k count=1

此時可以再重啟asm,然後檢視兩塊磁碟的狀態就變為CANDIDATE

6、         dddisk138磁碟上的內容複製到disk139上,將disk141的內容複製到disk140上。

dd  if=/dev/disk138   of=/dev/disk139 bs=644000k

dd  if=/dev/disk141   of=/dev/disk140 bs=644000k

7、         disk138disk141清空

dd if=/dev/zero f=/dev/rdisk/disk138 bs=1k count=1

dd if=/dev/zero f=/dev/rdisk/disk141  bs=1k count=1

8、         asm重啟,檢視各個磁碟狀態

SQL> select name,path,header_status from v$asm_disk;

 

NAME                           PATH                           HEADER_STATU

------------------------------ ------------------------------ ------------

                                     /dev/rdisk/disk138             CANDIDATE

                                      /dev/rdisk/disk141             CANDIDATE

OCR_ZKF_0000                   /dev/rdisk/disk127             MEMBER

REDO_ZKF_0000                  /dev/rdisk/disk128             MEMBER

DATA_ZKF_0000                  /dev/rdisk/disk129             MEMBER

DATA_ZKF_0001                  /dev/rdisk/disk130             MEMBER

DATA_ZKF_0002                  /dev/rdisk/disk131             MEMBER

DATA_ZKF_0003                  /dev/rdisk/disk132             MEMBER

DATA_ZKF_0004                  /dev/rdisk/disk133             MEMBER

DATA_ZKF_0005                  /dev/rdisk/disk134             MEMBER

DATA_ZKF_0006                  /dev/rdisk/disk135             MEMBER

 

NAME                           PATH                           HEADER_STATU

------------------------------ ------------------------------ ------------

DATA_ZKF_0007                  /dev/rdisk/disk136             MEMBER

DATA_ZKF_0008                  /dev/rdisk/disk137             MEMBER

TEST_ZKF_0000                  /dev/rdisk/disk139             MEMBER

TEST_ZKF_0001                  /dev/rdisk/disk140             MEMBER

 

15 rows selected.

可以再檢視下錶的資訊,這裡不再贅述。

 

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

相關文章