在linux 下配置RAC LVM

LINUX 双节点的RAC,其中一个节点在共享存储上建立了lvm,在另一个节点来激活.

 
配置环境:RH EL4  +  Oracle 10g  RAC
 
1、RAC1 的lvm 信息
[root@rac1 mapper]# lvdisplay
 --- Logical volume ---
 LV Name                /dev/rootvg/lvocr
 VG Name                rootvg
 LV UUID                OrIiVb-Z8Bu-zWdB-VPUq-2BaK-oBdR-i3rHPn
 LV Write Access        read/write
 LV Status              available
 # open                 0
 LV Size                500.00 MB
 Current LE             125
 Segments               1
 Allocation             inherit
 Read ahead sectors     0
 Block device           253:0
  
[root@rac1 mapper]# ls -l
total 0
crw------- 1 root root 10, 63 Jul 28 14:37 control
brw-rw---- 1 root disk 253, 0 Jul 28 17:44 rootvg-lvocr
[root@rac1 mapper]#
 
2、在另一个节点用mknod建立块设备文件
 
[root@rac2 ~]# mknod
mknod: too few arguments
Try `mknod --help' for more information.
[root@rac2 ~]# mknod --help
Usage: mknod [OPTION]... NAME TYPE [MAJOR MINOR]
Create the special file NAME of the given TYPE.
 
 -Z, --context=CONTEXT   set security context (quoted string)
Mandatory arguments to long options are mandatory for short options too.
 -m, --mode=MODE   set permission mode (as in chmod), not a=rw - umask
      --help     display this help and exit
      --version output version information and exit
 
Both MAJOR and MINOR must be specified when TYPE is b, c, or u, and they
must be omitted when TYPE is p. If MAJOR or MINOR begins with 0x or 0X,
it is interpreted as hexadecimal; otherwise, if it begins with 0, as octal;
otherwise, as decimal. TYPE may be:
 
 b      create a block (buffered) special file
 c, u   create a character (unbuffered) special file
 p      create a FIFO
 
Report bugs to bug-coreutils@gnu.org.
[root@rac2 ~]# cd   /dev/mapper
[root@rac2 mapper]# mknod rootvg-lvocr b 253 0
[root@rac2 mapper]# ls -l
total 0
crw------- 1 root root 10, 63 Jul 28 14:38 control
brw-r--r-- 1 root root 253, 0 Jul 28 18:09 rootvg-lvocr
[root@rac2 mapper]# vgdisplay
 No volume groups found
 
将两个节点系统重启:
 
在节点2 执行以下操作:
 
[root@rac2 mapper]# vgimport rootvg
 /dev/cdrom: open failed: Read-only file system
 /dev/cdrom: open failed: Read-only file system
 Attempt to close device '/dev/cdrom' which is not open.
 Volume group "rootvg" is not exported
[root@rac2 mapper]# ls
control rootvg-lvocr
[root@rac2 mapper]# vgchange -a n rootvg
 0 logical volume(s) in volume group "rootvg" now active
[root@rac2 mapper]# vgchange -a y rootvg
 1 logical volume(s) in volume group "rootvg" now active
[root@rac2 mapper]# lvdisplay
 --- Logical volume ---
 LV Name                /dev/rootvg/lvocr
 VG Name                rootvg
 LV UUID                OrIiVb-Z8Bu-zWdB-VPUq-2BaK-oBdR-i3rHPn
 LV Write Access        read/write
 LV Status              available
 # open                 0
 LV Size                500.00 MB
 Current LE             125
 Segments               1
 Allocation             inherit
 Read ahead sectors     0
 Block device           253:0
  
[root@rac2 mapper]# vgdisplay rootvg
 --- Volume group ---
 VG Name               rootvg
 System ID            
 Format                lvm2
 Metadata Areas        1
 Metadata Sequence No 5
 VG Access             read/write
 VG Status             resizable
 MAX LV                0
 Cur LV                1
 Open LV               0
 Max PV                0
 Cur PV                1
 Act PV                1
 VG Size               4.00 GB
 PE Size               4.00 MB
 Total PE              1023
 Alloc PE / Size       125 / 500.00 MB
 Free PE / Size       898 / 3.51 GB
 VG UUID               1Mst0z-ZAmU-0uAp-vQC2-z1vD-ZABs-tc6I8f
 
 
在RAC2上建立一个lvm
 
[root@rac2 mapper]# lvcreate -L 500m -n lvora rootvg
 Logical volume "lvora" created
[root@rac2 mapper]# ls -l
total 0
crw------- 1 root root 10, 63 Jul 28 14:38 control
brw-r--r-- 1 root root 253, 0 Jul 28 18:09 rootvg-lvocr
brw-rw---- 1 root disk 253, 1 Jul 28 18:16 rootvg-lvora
[root@rac2 mapper]#
 
在RAC1 激活lvm
 
[root@rac1 mapper]# ls -l
total 0
crw------- 1 root root 10, 63 Jul 28 14:37 control
brw-rw---- 1 root disk 253, 0 Jul 28 17:44 rootvg-lvocr
[root@rac1 mapper]# mknod rootvg-lvora b 253 1
[root@rac1 mapper]# ls -l
total 0
crw------- 1 root root 10, 63 Jul 28 14:37 control
brw-rw---- 1 root disk 253, 0 Jul 28 17:44 rootvg-lvocr
brw-r--r-- 1 root root 253, 1 Jul 28 18:17 rootvg-lvora
[root@rac1 mapper]# vgchange -a n rootvg
 0 logical volume(s) in volume group "rootvg" now active
[root@rac1 mapper]# vgchange -a y rootvg
 2 logical volume(s) in volume group "rootvg" now active
[root@rac1 mapper]# lvdisplay
 --- Logical volume ---
 LV Name                /dev/rootvg/lvocr
 VG Name                rootvg
 LV UUID                OrIiVb-Z8Bu-zWdB-VPUq-2BaK-oBdR-i3rHPn
 LV Write Access        read/write
 LV Status              available
 # open                 0
 LV Size                500.00 MB
 Current LE             125
 Segments               1
 Allocation             inherit
 Read ahead sectors     0
 Block device           253:0
  
 --- Logical volume ---
 LV Name                /dev/rootvg/lvora
 VG Name                rootvg
 LV UUID                hmI83p-e0p0-bznb-IoT2-Er1j-6zzw-OM4Li4
 LV Write Access        read/write
 LV Status              available
 # open                 0
 LV Size                500.00 MB
 Current LE             125
 Segments               1
 Allocation             inherit
 Read ahead sectors     0
 Block device           253:1
  
[root@rac1 mapper]#