成都网站建设设计

将想法与焦点和您一起共享

oracle11g使用ASM存储迁移

一、环境描述
rhel 6.6 + Oracle 11.2.0.4
存储更换,需要添加新盘,替换掉旧的存储盘,以下为测试步骤。

二、测试过程
[root@roidb1 ~]# cd /etc/udev
[root@roidb1 udev]# ls
makedev.d  rules.d  udev.conf
[root@roidb1 udev]# cd rules.d/
[root@roidb1 rules.d]# ls
55-usm.rules                 60-pcmcia.rules         70-persistent-net.rules  98-kexec.rules
60-fprint-autosuspend.rules  60-raw.rules            90-alsa.rules            99-oracle-asmdevices.rules
60-openct.rules              70-persistent-cd.rules  90-hal.rules
[root@roidb1 rules.d]# cat 99-oracle-asmdevices.rules 
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB134477b8-eb4c906a", 

NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB02fff4da-d0a0c3a3", 

NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VBdfa1c4b9-379f6810", 

NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB47ca97bf-4f2e68c0", 

NAME="asm-diske", OWNER="grid", GROUP="asmadmin", MODE="0660"     
[root@roidb1 rules.d]# 
[root@roidb1 rules.d]# 

##添加一块新盘
[root@roidb1 rules.d]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdf
1ATA_VBOX_HARDDISK_VBf00cea14-af091329
[root@roidb1 rules.d]# 
[root@roidb1 rules.d]# 
[root@roidb1 rules.d]# 
[root@roidb1 rules.d]# ls
55-usm.rules                 60-pcmcia.rules         70-persistent-net.rules  98-kexec.rules
60-fprint-autosuspend.rules  60-raw.rules            90-alsa.rules            99-oracle-asmdevices.rules
60-openct.rules              70-persistent-cd.rules  90-hal.rules

##修改配置文件
[root@roidb1 rules.d]# vi 99-oracle-asmdevices.rules 
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1AT
A_VBOX_HARDDISK_VB134477b8-eb4c906a", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1AT
A_VBOX_HARDDISK_VB02fff4da-d0a0c3a3", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1AT
A_VBOX_HARDDISK_VBdfa1c4b9-379f6810", NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1AT
A_VBOX_HARDDISK_VB47ca97bf-4f2e68c0", NAME="asm-diske", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1AT
A_VBOX_HARDDISK_VBf00cea14-af091329", NAME="asm-diskf", OWNER="grid", GROUP="asmadmin", MODE="0660"  Â  
~                                                                                                                        

##传输到节点2~                         
scp 99-oracle-asmdevices.rules 到rac2

[root@roidb1 rules.d]# cat 99-oracle-asmdevices.rules 
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB134477b8-eb4c906a", 

NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB02fff4da-d0a0c3a3", 

NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VBdfa1c4b9-379f6810", 

NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB47ca97bf-4f2e68c0", 

NAME="asm-diske", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VBf00cea14-af091329", 

NAME="asm-diskf", OWNER="grid", GROUP="asmadmin", MODE="0660"     
[root@roidb1 rules.d]# 
[root@roidb1 rules.d]# 
[root@roidb1 rules.d]# 

##重启udev服务,加载配置文件
[root@roidb1 rules.d]# start_udev 
Starting udev: udevd[5477]: GOTO 'pulseaudio_check_usb' has no matching label in: '/lib/udev/rules.d/90-pulseaudio.rules'

##生产/dev/asm-diskf                                                           [  OK  ]
[root@roidb1 rules.d]# ls -l /dev/asm*
brw-rw---- 1 grid asmadmin 8, 16 Jan 30 19:36 /dev/asm-diskb
brw-rw---- 1 grid asmadmin 8, 32 Jan 30 19:36 /dev/asm-diskc
brw-rw---- 1 grid asmadmin 8, 48 Jan 30 19:36 /dev/asm-diskd
brw-rw---- 1 grid asmadmin 8, 64 Jan 30 19:36 /dev/asm-diske
brw-rw---- 1 grid asmadmin 8, 80 Jan 30 19:36 /dev/asm-diskf

/dev/asm:
total 0

##查看asm磁盘
SQL> col name for a40
SQL> set line 200
SQL> select name,path,state,HEADER_STATUS from v$asm_disk;

NAME                                     PATH                                     STATE            HEADER_STATUS
---------------------------------------- ---------------------------------------- ---------------- ------------------------
                                         /dev/asm-diskf                           NORMAL           CANDIDATE  --要添加的磁盘
CRSDG_0002                               /dev/asm-diskd                           NORMAL           MEMBER
CRSDG_0000                               /dev/asm-diskb                           NORMAL           MEMBER
DATADG_0000                              /dev/asm-diske                           NORMAL           MEMBER
CRSDG_0001                               /dev/asm-diskc                           NORMAL           MEMBER

##使用sysasm添加磁盘
alter diskgroup datadg add disk '/dev/asm-diskf' ;

##加快平衡速度,power=0就是停止rebalance操作,不建议使用11
alter diskgroup datadg rebalance power 11;           

SQL> alter diskgroup datadg rebalance power 11;

Diskgroup altered.

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERATION  STATE         POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES ERROR_CODE
------------ ---------- -------- ---------- ---------- ---------- ---------- ---------- ----------- 

----------------------------------------------------------------------------------------
           2 REBAL      RUN              11         11         22         22          0           0

SQL> 

##继续查看磁盘状态,已添加完成

col name for a15
col path for a15
col state for a10
set line 200
select MODE_STATUS,HEADER_STATUS, MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;

SQL> col name for a15
SQL> col path for a15
SQL> col state for a10
SQL> set line 200
SQL> select MODE_STATUS,HEADER_STATUS, MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;

MODE_STATUS    HEADER_STATUS            MODE_STATUS    STATE        TOTAL_MB    FREE_MB NAME            PATH
-------------- ------------------------ -------------- ---------- ---------- ---------- --------------- ---------------
ONLINE         MEMBER                   ONLINE         NORMAL           4096       3787 CRSDG_0002      /dev/asm-diske
ONLINE         MEMBER                   ONLINE         NORMAL           4096       3788 CRSDG_0001      /dev/asm-diskd
ONLINE         MEMBER                   ONLINE         NORMAL           6144       3977 DATADG_0000     /dev/asm-diskb
ONLINE         MEMBER                   ONLINE         NORMAL           4096       3787 CRSDG_0000      /dev/asm-diskc
ONLINE         MEMBER                   ONLINE         NORMAL           8192       5306 DATADG_0001     /dev/asm-diskf

SQL> 

##删除磁盘

alter diskgroup datadg drop disk 'DATADG_0000'; --按照name来删除

alter diskgroup datadg rebalance power 11;

col error_code for a5
set line 200
select * from v$asm_operation;

##查看平衡速度
SQL> col error_code for a5
SQL> set line 200
SQL> select * from v$asm_operation;

GROUP_NUMBER OPERATION  STATE         POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES ERROR
------------ ---------- -------- ---------- ---------- ---------- ---------- ---------- ----------- -----
           2 REBAL      RUN              11         11         47        768       2334           0

SQL> 

SQL> col name for a15
SQL> col path for a15
SQL> col state for a10
SQL> set line 200
SQL> select MODE_STATUS,HEADER_STATUS, MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;

MODE_STATUS    HEADER_STATUS            MODE_STATUS    STATE        TOTAL_MB    FREE_MB NAME            PATH
-------------- ------------------------ -------------- ---------- ---------- ---------- --------------- ---------------
ONLINE         FORMER                   ONLINE         NORMAL              0          0                 /dev/asm-diske   ##已删除
ONLINE         MEMBER                   ONLINE         NORMAL           4096       3788 CRSDG_0001      /dev/asm-diskc
ONLINE         MEMBER                   ONLINE         NORMAL           4096       3787 CRSDG_0000      /dev/asm-diskb
ONLINE         MEMBER                   ONLINE         NORMAL           8192       3095 DATADG_0001     /dev/asm-diskf
ONLINE         MEMBER                   ONLINE         NORMAL           4096       3787 CRSDG_0002      /dev/asm-diskd

SQL> 

新闻名称:oracle11g使用ASM存储迁移
网站URL:http://chengdu.cdxwcx.cn/article/ggdpij.html