首页 > 代码库 > LVM修改

LVM修改

之前新加了个pkg,跟上一个***新增略有不同。



下面是整个步骤


1.停止oracle rac、停止pkg  

节点1执行(root用户)

[root@cmsdb1]#cd /oracle/app/oracle/p*/crs/bin

[root@cmsdb1]#./crs_stop -all

[root@cmsdb1]#./crsctl stop crs

节点2执行(root用户)

[root@cmsdb2]#./crsctl stop crs


全部关闭后,关闭pkg. 节点1执行(root用户)

[root@cmsdb1]#cmhaltpkg -v pkg1

Halting package pkg1 on node cmsdb1

Successfully halted package pkg1 on node cmsdb1

One or more packages or package instances have been halted.

cmhaltpkg: Completed successfully on all packages specified

[root@cmsdb1]#cmhaltpkg -v pkg2

Halting package pkg2 on node cmsdb2

Successfully halted package pkg2 on node cmsdb2

One or more packages or package instances have been halted.

cmhaltpkg: Completed successfully on all packages specified


2.停用卷组,将卷组集群更改为不可用,激活卷组(非GX)

节点1执行(root用户)

[root@cmsdb1]# vgchange -a n /dev/vgdata

Volume group "/dev/vgdata" has been successfully changed.

[root@cmsdb1]# vgchange -S n -c n /dev/vgdata

Configuration change completed.

Volume group "/dev/vgdata" has been successfully changed.

[root@cmsdb1]# vgchange -a y /dev/vgdata

Activated volume group.

Volume group "/dev/vgdata" has been successfully changed.


3.使用标准LVM命令进行所需的更改。一定要设置的原始逻辑卷设备文件的所有者为oracle,组设为dba,模式为660。

delete:

[root@cmsdb1]# lvremove /dev/vgdata/Lvdata1_50g

The logical volume "/dev/vgdata/Lvdata1_50g" is not empty;

do you really want to delete the logical volume (y/n) : y

Logical volume "/dev/vgdata/Lvdata1_50g" has been successfully removed.

Volume Group configuration for /dev/vgdata has been saved in /etc/lvmconf/vgdata.conf

新增:

[root@cmsdb1]# lvcreate -L 10240 -n Lvdata01_10g /dev/vgdata 

Logical volume "/dev/vgdata/Lvdata01_10g" has been successfully created with

character device "/dev/vgdata/rLvdata01_10g".

Logical volume "/dev/vgdata/Lvdata01_10g" has been successfully extended.

Volume Group configuration for /dev/vgdata has been saved in /etc/lvmconf/vgdata.conf

修改属组、授权

[root@cmsdb1]# chown -R oracle:dba /dev/vgdata

[root@cmsdb1]# chmod -R 660 /dev/vgdata


4.停用卷组,导出map文件,拷贝至节点2,GX群组

节点1(root用户)

[root@cmsdb1]#vgchange -a n /dev/vgdata

Volume group "/dev/vgdata" has been successfully changed.

[root@cmsdb1]#vgexport -p -s -v -m /tmp/vgdata.map /dev/vgdata

Beginning the export process on Volume Group "/dev/vgdata".

/dev/disk/disk7

vgexport: Preview of vgexport on volume group "/dev/vgdata" succeeded.

[root@cmsdb1]# rcp /tmp/vgdata.map cmsdb2:/tmp/vgdata.map 

[root@cmsdb1]# vgchange -S y -c y /dev/vgdata

Configuration change completed.

Volume group "/dev/vgdata" has been successfully changed.



5.节点2重新导入map文件、修改属组、授权

导出

[root@cmsdb2]#vgexport /dev/vgdata

新建

[root@cmsdb2]# mkdir /dev/vgdata 

[root@cmsdb2]# mknod /dev/vgdata/group c 64 0x050000

导入

[root@cmsdb2]# vgimport -s -v -m /tmp/vgdata.map /dev/vgdata 

Beginning the import process on Volume Group "/dev/vgdata". 

Logical volume "/dev/vgdata/Lvdata01_10g" has been successfully created 

with lv number 1. 

修改属组、授权

[root@cmsdb1]# chown -R oracle:dba /dev/vgdata

[root@cmsdb1]# chmod -R 660 /dev/vgdata


6.以GX模式激活卷组

节点1执行

[root@cmsdb1]# vgchange -a s -p /dev/vgdata

Activated volume group in Shared Mode.

This node is the Server.

Volume group "/dev/vgdata" has been successfully changed.

节点2执行

[root@cmsdb2]# vgchange -a s -p /dev/vgdata

Activated volume group in Shared Mode.

This node is the Server.

Volume group "/dev/vgdata" has been successfully changed.


7.开启pkg

[root@cmsdb1]# cmrunpkg -v pkg1

Running package pkg1 on node cmsdb1

Successfully started package pkg1 on node cmsdb1

cmrunpkg: All specified packages are running

[root@cmsdb1]# cmrunpkg -v pkg2

Running package pkg2 on node cmsdb2

Successfully started package pkg2 on node cmsdb2

cmrunpkg: All specified packages are running

[root@cmsdb1]# cmviewcl


CLUSTER        STATUS       

cmsdb          up           

  

  NODE           STATUS       STATE        

  cmsdb1         up           running      

  cmsdb2         up           running      

  

MULTI_NODE_PACKAGES


  PACKAGE        STATUS           STATE            AUTO_RUN    SYSTEM      

  pkg1           up               running          enabled     no          

  pkg2           up               running          enabled     no         

  


8.启动oracle rac

节点1、2均执行

[root@cmsdb1]# cd /oracle/app/oracle/p*/crs/bin

[root@cmsdb1]# ./crsctl start crs

Attempting to start CRS stack 

The CRS stack will be started shortly

[root@cmsdb2]# cd /oracle/app/oracle/p*/crs/bin

[root@cmsdb2]# ./crsctl start crs

Attempting to start CRS stack 

The CRS stack will be started shortly


检查集群状态

[root@cmsdb1]# ./crs_stat -t

Name           Type           Target    State     Host        

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

ora....B1.lsnr application    ONLINE    ONLINE    cmsdb1      

ora.cmsdb1.gsd application    ONLINE    ONLINE    cmsdb1      

ora.cmsdb1.ons application    ONLINE    ONLINE    cmsdb1      

ora.cmsdb1.vip application    ONLINE    ONLINE    cmsdb1      

ora....B2.lsnr application    ONLINE    ONLINE    cmsdb2      

ora.cmsdb2.gsd application    ONLINE    ONLINE    cmsdb2      

ora.cmsdb2.ons application    ONLINE    ONLINE    cmsdb2      

ora.cmsdb2.vip application    ONLINE    ONLINE    cmsdb2      

ora.ztjc.db    application    ONLINE    ONLINE    cmsdb1      

ora....c1.inst application    ONLINE    ONLINE    cmsdb1      

ora....c2.inst application    ONLINE    ONLINE    cmsdb2    


9.结束!