千家信息网

oracle 11g 使用ASM存储迁移

发表于:2025-01-27 作者:千家信息网编辑
千家信息网最后更新 2025年01月27日,一、环境描述rhel 6.6 + Oracle 11.2.0.4存储更换,需要添加新盘,替换掉旧的存储盘,以下为测试步骤。二、测试过程[root@roidb1 ~]# cd /etc/udev[roo
千家信息网最后更新 2025年01月27日oracle 11g 使用ASM存储迁移
一、环境描述rhel 6.6 + Oracle 11.2.0.4存储更换,需要添加新盘,替换掉旧的存储盘,以下为测试步骤。二、测试过程[root@roidb1 ~]# cd /etc/udev[root@roidb1 udev]# lsmakedev.d  rules.d  udev.conf[root@roidb1 udev]# cd rules.d/[root@roidb1 rules.d]# ls55-usm.rules                 60-pcmcia.rules         70-persistent-net.rules  98-kexec.rules60-fprint-autosuspend.rules  60-raw.rules            90-alsa.rules            99-oracle-asmdevices.rules60-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/sdf1ATA_VBOX_HARDDISK_VBf00cea14-af091329[root@roidb1 rules.d]# [root@roidb1 rules.d]# [root@roidb1 rules.d]# [root@roidb1 rules.d]# ls55-usm.rules                 60-pcmcia.rules         70-persistent-net.rules  98-kexec.rules60-fprint-autosuspend.rules  60-raw.rules            90-alsa.rules            99-oracle-asmdevices.rules60-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=="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"  ÂÂ Â ~                                                                                                                        ##传输到节点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-diskbbrw-rw---- 1 grid asmadmin 8, 32 Jan 30 19:36 /dev/asm-diskcbrw-rw---- 1 grid asmadmin 8, 48 Jan 30 19:36 /dev/asm-diskdbrw-rw---- 1 grid asmadmin 8, 64 Jan 30 19:36 /dev/asm-diskebrw-rw---- 1 grid asmadmin 8, 80 Jan 30 19:36 /dev/asm-diskf/dev/asm:total 0##查看asm磁盘SQL> col name for a40SQL> set line 200SQL> 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           MEMBERCRSDG_0000                               /dev/asm-diskb                           NORMAL           MEMBERDATADG_0000                              /dev/asm-diske                           NORMAL           MEMBERCRSDG_0001                               /dev/asm-diskc                           NORMAL           MEMBER##使用sysasm添加磁盘alter diskgroup datadg add disk '/dev/asm-diskf' ;##加快平衡速度,power=0就是停止rebalance操作,不建议使用11alter 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           0SQL> ##继续查看磁盘状态,已添加完成col name for a15col path for a15col state for a10set line 200select MODE_STATUS,HEADER_STATUS, MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;SQL> col name for a15SQL> col path for a15SQL> col state for a10SQL> set line 200SQL> 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-diskeONLINE         MEMBER                   ONLINE         NORMAL           4096       3788 CRSDG_0001      /dev/asm-diskdONLINE         MEMBER                   ONLINE         NORMAL           6144       3977 DATADG_0000     /dev/asm-diskbONLINE         MEMBER                   ONLINE         NORMAL           4096       3787 CRSDG_0000      /dev/asm-diskcONLINE         MEMBER                   ONLINE         NORMAL           8192       5306 DATADG_0001     /dev/asm-diskfSQL> ##删除磁盘alter diskgroup datadg drop disk 'DATADG_0000'; --按照name来删除alter diskgroup datadg rebalance power 11;col error_code for a5set line 200select * from v$asm_operation;##查看平衡速度SQL> col error_code for a5SQL> set line 200SQL> 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           0SQL> SQL> col name for a15SQL> col path for a15SQL> col state for a10SQL> set line 200SQL> 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-diskcONLINE         MEMBER                   ONLINE         NORMAL           4096       3787 CRSDG_0000      /dev/asm-diskbONLINE         MEMBER                   ONLINE         NORMAL           8192       3095 DATADG_0001     /dev/asm-diskfONLINE         MEMBER                   ONLINE         NORMAL           4096       3787 CRSDG_0002      /dev/asm-diskdSQL> 
0