Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6548453
  • 博文数量: 1005
  • 博客积分: 8199
  • 博客等级: 中将
  • 技术积分: 13071
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-25 20:19
个人简介

脚踏实地、勇往直前!

文章分类

全部博文(1005)

文章存档

2020年(2)

2019年(93)

2018年(208)

2017年(81)

2016年(49)

2015年(50)

2014年(170)

2013年(52)

2012年(177)

2011年(93)

2010年(30)

分类: Oracle

2017-07-06 17:33:07


我这里的情况是只安装好CRS后的磁盘组替换(还未安装数据库),磁盘组由原来的OCR替换成OCR2,替换主要是3部分的内容:
1.ASM实例spfile迁移到新的磁盘组
2.VOTING换成替换成新的磁盘组
3.OCR迁移到新的磁盘组

------------------------第一部分:ASM实例spfile迁移------------------------------------
1.当前的磁盘组
[root@host01 bin]# ./crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   106a87848a5b4fedbf4ddbcbd1e26e37 (/dev/asm-ocr1) [OCR]
 2. ONLINE   7ae040313a5a4fa7bf834a292fcb59ac (/dev/asm-ocr2) [OCR]
 3. ONLINE   9b572ed4a7094ff0bf3694e3cc3ec711 (/dev/asm-ocr3) [OCR]
Located 3 voting disk(s).

[root@host01 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2644
         Available space (kbytes) :     259476
         ID                       :  711457285
         Device/File Name         :       +OCR
                                    Device/File integrity check succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
          Cluster registry integrity check succeeded
          Logical corruption check succeeded

2.创建另外一个磁盘组
create diskgroup OCR2 normal redundancy disk '/dev/asm-redo1','/dev/asm-redo2' ATTRIBUTE 'compatible.rdbms' = '11.2', 'compatible.asm' = '11.2';

3.挂载磁盘出
alter diskgroup OCR2 mount; 

 4.备份创建pfile
节点1:
create pfile='/tmp/pfile_asm1.ora' from spfile;
节点2:
create pfile='/tmp/pfile_asm2.ora' from spfile;

5.在新磁盘OCR2上创建spfile
----------------------节点1上操作-----------------------------
SQL> shutdown abort
ASM instance shutdown

SQL> startup pfile=/tmp/pfile_asm1.ora;
ASM instance started

 Total System Global Area 1135747072 bytes
Fixed Size                  2260728 bytes
Variable Size            1108320520 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted

 SQL> create spfile='+OCR2' from pfile='/tmp/pfile_asm1.ora';
create spfile='+OCR2' from pfile='/tmp/pfile_asm1.ora'
*
ERROR at line 1:
ORA-17635: failure in obtaining physical sector size for '+OCR2'

 SQL> select name,state from v$asm_diskgroup;

NAME       STATE
---------- ----------------------
OCR        MOUNTED
OCR2       DISMOUNTED


SQL> alter diskgroup OCR2 mount;

Diskgroup altered.
SQL> create spfile='+OCR2' from pfile='/tmp/pfile_asm1.ora';

SQL> shutdown abort
ASM instance shutdown
SQL> startup
ASM instance started

Total System Global Area 1135747072 bytes
Fixed Size                  2260728 bytes
Variable Size            1108320520 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
SQL> show parameters spfile;

NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
spfile                               string
+OCR2/rac-cluster/asmparameter
file/registry.253.948644593


节点2 ASM实例需要重新启动
SQL>shutdown abort
SQL>startup

--------------------------第二部分(任意一个节点上操作):votedisk替换到新的磁盘组------------------------------------
6.votedisk替换到新的磁盘组
[root@host01 bin]# ./crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   106a87848a5b4fedbf4ddbcbd1e26e37 (/dev/asm-ocr1) [OCR]
 2. ONLINE   7ae040313a5a4fa7bf834a292fcb59ac (/dev/asm-ocr2) [OCR]
 3. ONLINE   9b572ed4a7094ff0bf3694e3cc3ec711 (/dev/asm-ocr3) [OCR]
Located 3 voting disk(s).

[root@host01 bin]# ./crsctl replace votedisk +OCR2
Failed to create voting files on disk group OCR2.
Change to configuration failed, but was successfully rolled back.
CRS-4000: Command Replace failed, or completed with errors.


查看OC2磁盘组只有2块磁盘,做votedisk需要奇数块磁盘
SQL> select GROUP_NUMBER,name,FAILGROUP,OS_MB,TOTAL_MB,path from v$asm_disk;


GROUP_NUMBER NAME       FAILGROUP       OS_MB TOTAL_MB PATH
------------ ---------- ---------- ---------- -------- ---------------
           0                             1023        0 /dev/asm-data6
           0                             5119        0 /dev/asm-data4
           0                             1023        0 /dev/asm-data5
           0                             5119        0 /dev/asm-data3
           0                             5119        0 /dev/asm-data2
           0                             5119        0 /dev/asm-data1
           1 OCR_0002   OCR_0002         1023     1023 /dev/asm-ocr3
           1 OCR_0000   OCR_0000         1023     1023 /dev/asm-ocr1
           2 OCR2_0000  OCR2_0000        5119     5119 /dev/asm-redo1
           1 OCR_0001   OCR_0001         1023     1023 /dev/asm-ocr2
           2 OCR2_0001  OCR2_0001        5119     5119 /dev/asm-redo2
           
添加一块磁盘
alter diskgroup OCR2 add disk '/dev/asm-data6';


[root@host01 bin]# ./crsctl replace votedisk +OCR2
Successful addition of voting disk 89d26d9652d34fc3bf05c3e60b92dfc4.
Successful addition of voting disk 25966081425c4f07bf52701f42ca092e.
Successful addition of voting disk 3080d0c0314a4feebfbf9511ad47ab92.
Successful deletion of voting disk 106a87848a5b4fedbf4ddbcbd1e26e37.
Successful deletion of voting disk 7ae040313a5a4fa7bf834a292fcb59ac.
Successful deletion of voting disk 9b572ed4a7094ff0bf3694e3cc3ec711.
Successfully replaced voting disk group with +OCR2.
CRS-4266: Voting file(s) successfully replaced




[root@host01 bin]# ./crsctl query css votedisk;
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   89d26d9652d34fc3bf05c3e60b92dfc4 (/dev/asm-redo1) [OCR2]
 2. ONLINE   25966081425c4f07bf52701f42ca092e (/dev/asm-redo2) [OCR2]
 3. ONLINE   3080d0c0314a4feebfbf9511ad47ab92 (/dev/asm-data6) [OCR2]
Located 3 voting disk(s).

--------------------------------------第三部分(任意一个节点上操作):OCR替换到新的磁盘---------------------------------------
7.OCR换到新的磁盘
[root@host01 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2640
         Available space (kbytes) :     259480
         ID                       :  711457285
         Device/File Name         :       +OCR
                                    Device/File integrity check succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
          Cluster registry integrity check succeeded
          Logical corruption check succeeded

[root@host01 bin]# ./ocrconfig -add +OCR2
[root@host01 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2640
         Available space (kbytes) :     259480
         ID                       :  711457285
         Device/File Name         :       +OCR
                                    Device/File integrity check succeeded
         Device/File Name         :      +OCR2
                                    Device/File integrity check succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
          Cluster registry integrity check succeeded
          Logical corruption check succeeded

[root@host01 bin]# ./ocrconfig -replace +OCR -replacement +OCR2
PROT-29: The Oracle Cluster Registry location is already configured

##删除原来的OCR
[root@host01 bin]# ./ocrconfig -delete +OCR
[root@host01 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2640
         Available space (kbytes) :     259480
         ID                       :  711457285
         Device/File Name         :      +OCR2
                                    Device/File integrity check succeeded
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
                                    Device/File not configured
          Cluster registry integrity check succeeded
          Logical corruption check succeeded

 8.删除原来的磁盘组

SQL> drop diskgroup OCR;                                              
drop diskgroup OCR
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15053: diskgroup "OCR" contains existing files

[grid@host01 ~]$ asmcmd
ASMCMD> ls
OCR/
OCR2/
ASMCMD> cd OCR
ASMCMD> ls
rac-cluster/
ASMCMD> pwd
+OCR
ASMCMD> ls
rac-cluster/
ASMCMD> rm -rf rac-cluster ##这里一定要小心,不要删除错了

 SQL> connect / as sysasm
Connected.
SQL> drop diskgroup OCR; 
drop diskgroup OCR
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15073: diskgroup OCR is mounted by another ASM instance
另外一个节点已经mounted
在节点2上执行:
SQL> alter diskgroup OCR dismount;

返回节点1:
SQL> drop diskgroup OCR;
Diskgroup dropped.



-- The End ---
阅读(3789) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~