文档课题:rac环境更换OCR磁盘组. 数据库:oracle11.2.0.4 64位 系统:centos7.9 64位 环境:rac(双节点)+ dg 1、系统数据集群状态. [grid@hisdb1bin]$ crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- LocalResources -------------------------------------------------------------------------------- ora.DATA.dg ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.FRA.dg ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.LISTENER.lsnr ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.OCR.dg ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.OCRBK.dg ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.asm ONLINE ONLINE hisdb1 Started ONLINE ONLINE hisdb2 Started ora.gsd OFFLINE OFFLINE hisdb1 OFFLINE OFFLINE hisdb2 ora.net1.network ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.ons ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 -------------------------------------------------------------------------------- ClusterResources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE hisdb1 ora.cvu 1 ONLINE ONLINE hisdb1 ora.hisdb1.vip 1 ONLINE ONLINE hisdb1 ora.hisdb2.vip 1 ONLINE ONLINE hisdb2 ora.oc4j 1 ONLINE ONLINE hisdb1 ora.orcl.db 1 ONLINE ONLINE hisdb1 Open 2 ONLINE ONLINE hisdb2 Open ora.scan1.vip 1 ONLINE ONLINE hisdb1 --从磁盘组信息可以看到DATA01为投票盘. SQL>select group_number,path,voting_file from v$asm_disk GROUP_NUMBERPATH V ------------------------------------- - 3 ORCL:DATA01 Y 2 ORCL:DATA02 N 1 ORCL:DATA03 N 4 ORCL:DATA04 N [grid@hisdb1~]$ crsctl query css votedisk ## STATE File Universal Id File Name Disk group -- ----- ----------------- --------- --------- 1. ONLINE 3d6e0658f7a04f83bf368b35f2b3b53f (ORCL:DATA01) [OCR] Located 1voting disk(s). 2、ocr盘替换说明:如上所示,ocrbk为新加磁盘组,以下为更换投票盘ocr为ocrbk实验过程. 2.1、备份ocr节点1执行. --逻辑备份 [root@hisdb1~]# cd /u01/app/11.2.0/grid/bin [root@hisdb1 bin]# ./ocrconfig -export/u01/app/11.2.0/grid/cdata/hisdb-cluster/logicalbak.ocr [grid@hisdb1 hisdb-cluster]$ ll/u01/app/11.2.0/grid/cdata/hisdb-cluster/logicalbak.ocr -rw------- 1 root root 117164 Nov 5 17:46/u01/app/11.2.0/grid/cdata/hisdb-cluster/logicalbak.ocr --物理备份 [root@hisdb1bin]# ./ocrconfig -manualbackup hisdb1 2022/11/05 17:42:23 /u01/app/11.2.0/grid/cdata/hisdb-cluster/backup_20221105_174223.ocr [root@hisdb1bin]# ./ocrconfig -showbackup hisdb2 2022/10/10 13:49:03 /u01/app/11.2.0/grid/cdata/hisdb-cluster/backup00.ocr hisdb2 2022/10/07 20:28:53 /u01/app/11.2.0/grid/cdata/hisdb-cluster/backup01.ocr hisdb1 2022/10/07 09:23:06 /u01/app/11.2.0/grid/cdata/hisdb-cluster/backup02.ocr hisdb2 2022/10/10 13:49:03 /u01/app/11.2.0/grid/cdata/hisdb-cluster/day.ocr hisdb1 2022/10/06 17:23:06 /u01/app/11.2.0/grid/cdata/hisdb-cluster/week.ocr hisdb1 2022/11/05 17:42:23 /u01/app/11.2.0/grid/cdata/hisdb-cluster/backup_20221105_174223.ocr [root@hisdb1bin]# ./ocrcheck Status ofOracle Cluster Registry is as follows : Version : 3 Total space (kbytes) : 262120 Used space (kbytes) : 2992 Available space (kbytes) : 259128 ID : 1846457858 Device/File Name : +OCR Device/Fileintegrity check succeeded Device/Filenot configured Device/Filenot configured Device/Filenot configured Device/Filenot configured Cluster registry integrity checksucceeded Logical corruption check succeeded 说明:ocr系统有自动备份机制,olr需要手动备份. 2.2、替换vote节点1 root用户执行. [root@hisdb1bin]# ./crsctl replace votedisk +ocrbk Successfuladdition of voting disk 37bcb28590134ffabf4fa5ee9e4dd3ff. Successfuldeletion of voting disk 3d6e0658f7a04f83bf368b35f2b3b53f. Successfullyreplaced voting disk group with +ocrbk. CRS-4266:Voting file(s) successfully replaced [root@hisdb1bin]# ./crsctl query css votedisk ## STATE File Universal Id File Name Disk group -- ----- ----------------- --------- --------- 1. ONLINE 37bcb28590134ffabf4fa5ee9e4dd3ff (ORCL:DATA04) [OCRBK] Located 1voting disk(s). [root@hisdb2bin]# ./crsctl query css votedisk ## STATE File Universal Id File Name Disk group -- ----- ----------------- --------- --------- 1. ONLINE 37bcb28590134ffabf4fa5ee9e4dd3ff (ORCL:DATA04) [OCRBK] Located 1voting disk(s). 2.3、替换ocr节点1 root用户下执行. --添加ocrbk磁盘组. [root@hisdb1bin]# ./ocrconfig -add +ocrbk 2022-11-0518:18:17.729: [crsd(3026)]CRS-1007:TheOCR/OCR mirror location was replaced by +ocrbk. --查看ocr.loc信息 [root@hisdb1bin]# more /etc/oracle/ocr.loc #Device/file getting replaced by device +ocrbk ocrconfig_loc=+OCR ocrmirrorconfig_loc=+ocrbk local_only=false [root@hisdb1bin]# ./ocrcheck Status ofOracle Cluster Registry is as follows : Version : 3 Total space (kbytes) : 262120 Used space (kbytes) : 2992 Available space (kbytes) : 259128 ID : 1846457858 Device/File Name : +OCR Device/Fileintegrity check succeeded Device/File Name : +ocrbk Device/File integritycheck succeeded Device/Filenot configured Device/Filenot configured Device/Filenot configured Cluster registry integrity check succeeded Logical corruption check succeeded 说明:以上可以看到+OCR的信息. --删除ocr信息. [root@hisdb1bin]# ./ocrconfig -delete +ocr --再次检查. [root@hisdb1bin]# ./ocrcheck Status ofOracle Cluster Registry is as follows : Version : 3 Total space (kbytes) : 262120 Used space (kbytes) : 2992 Available space (kbytes) : 259128 ID : 1846457858 Device/File Name : +ocrbk Device/Fileintegrity check succeeded Device/Filenot configured Device/Filenot configured Device/File not configured Device/Filenot configured Cluster registry integrity checksucceeded Logical corruption check succeeded [root@hisdb1bin]# ./ocrcheck -config OracleCluster Registry configuration is : Device/File Name : +ocrbk [root@hisdb1bin]# more /etc/oracle/ocr.loc #Device/file+OCR getting replaced by device +ocrbk ocrconfig_loc=+ocrbk local_only=false --检查节点2信息. [root@hisdb2bin]# ./ocrcheck Status ofOracle Cluster Registry is as follows : Version : 3 Total space (kbytes) : 262120 Used space (kbytes) : 2992 Available space (kbytes) : 259128 ID : 1846457858 Device/File Name : +ocrbk Device/Fileintegrity check succeeded Device/Filenot configured Device/File not configured Device/Filenot configured Device/Filenot configured Cluster registry integrity checksucceeded Logical corruption check succeeded [root@hisdb2bin]# ./ocrcheck -config OracleCluster Registry configuration is : Device/File Name : +ocrbk 说明:deleteocr后,ocr信息被删除. 2.4、迁移ASM SPFILE说明:若不迁移会导致asm无法启动,此步骤节点1执行. 2.4.1、复制spfile[grid@hisdb1bin]$ asmcmd 查当前asmspfile ASMCMD>spget +OCR/hisdb-cluster/asmparameterfile/registry.253.1117371969 复制spfile至ocrbk. ASMCMD>spcopy -u +OCR/hisdb-cluster/asmparameterfile/registry.253.1117371969+ocrbk/hisdb-cluster/asmparameterfile/spfileasm.ora 说明:+ocrbk/hisdb-cluster/asmparameterfile/目录自动生成 2.4.2、设置spfile设置新spfile文件. ASMCMD>spset +ocrbk/hisdb-cluster/asmparameterfile/spfileasm.ora ASMCMD>spget +ocrbk/hisdb-cluster/asmparameterfile/spfileasm.ora 注意:修改两个节点grid用户下$ORACLE_HOME/dbs/init.ora文件内容,测试后其实可以不用修改. 3、处理原ocr磁盘组3.1、确认原ocr磁盘组确认原OCR磁盘组是否存在其它文件. ASMCMD>cd ocr ASMCMD>ls hisdb-cluster/ ASMCMD>cd hisdb-cluster ASMCMD>ls ASMPARAMETERFILE/ OCRFILE/ ASMCMD>cd asmparameterfile ASMCMD>ls REGISTRY.253.1117371969 --此前的参数文件,已复制到ocrbk磁盘组 ASMCMD>cd .. ASMCMD>cd ocrfile ASMCMD>ls REGISTRY.255.1117371971 --ocr磁盘文件,已使用replace命令转移到ocrbk磁盘组 --切换到ocrbk磁盘组目录 ASMCMD>pwd +ocrbk/hisdb-cluster/ocrfile ASMCMD>ls REGISTRY.255.1119982697 --ocrbk磁盘文件 ASMCMD>cd .. ASMCMD>ls ASMPARAMETERFILE/ OCRFILE/ ASMCMD>cd asmparameterfile ASMCMD>ls REGISTRY.253.1119984565 spfileasm.ora --从ocr磁盘组备份过来的最新参数文件 说明:确认清楚后便能删除此前的ocr磁盘组. 3.2、 删原OCR磁盘组3.2.1、重启集群[root@hisdb1bin]# ./crsctl stop crs -f CRS-2791:Starting shutdown of Oracle High Availability Services-managed resources on'hisdb1' ……(省略若干) CRS-2793:Shutdown of Oracle High Availability Services-managed resources on 'hisdb1' hascompleted CRS-4133:Oracle High Availability Services has been stopped. [root@hisdb2bin]# ./crsctl stop crs -f CRS-2791:Starting shutdown of Oracle High Availability Services-managed resources on'hisdb2' CRS-2673:Attempting to stop 'ora.crsd' on 'hisdb2' ……(省略若干) CRS-2673:Attempting to stop 'ora.gpnpd' on 'hisdb2' CRS-2677:Stop of 'ora.gpnpd' on 'hisdb2' succeeded CRS-2793:Shutdown of Oracle High Availability Services-managed resources on 'hisdb2' hascompleted CRS-4133:Oracle High Availability Services has been stopped. [root@hisdb1bin]# ./crsctl start crs CRS-4123:Oracle High Availability Services has been started. [root@hisdb2bin]# ./crsctl start crs CRS-4123:Oracle High Availability Services has been started. 3.2.2、删v$asm_diskgroup的ocr信息[grid@hisdb1hisdb-cluster]$ sqlplus / as sysasm SQL>set line 999 SQL>select name, 2 state, 3 free_mb, 4 required_mirror_free_mb, 5 usable_file_mb, 6 group_number 7 from v$asm_diskgroup; NAME STATE FREE_MB REQUIRED_MIRROR_FREE_MBUSABLE_FILE_MB GROUP_NUMBER ----------------------------------------- ---------- ----------------------- -------------- ------------ DATA MOUNTED 16490 0 16490 1 FRA MOUNTED 8921 0 8921 2 OCRBK MOUNTED 9843 0 9843 3 OCR DISMOUNTED 0 0 0 0 说明:可以看到ocr磁盘组信息依然存在. SQL>drop diskgroup ocr force including contents; Diskgroupdropped. SQL>select name, 2 state, 3 free_mb, 4 required_mirror_free_mb, 5 usable_file_mb, 6 group_number 7 from v$asm_diskgroup; NAME STATE FREE_MB REQUIRED_MIRROR_FREE_MBUSABLE_FILE_MB GROUP_NUMBER ----------------------------------------- ---------- ----------------------- -------------- ------------ DATA MOUNTED 16490 0 16490 1 FRA MOUNTED 8921 0 8921 2 OCRBK MOUNTED 9843 0 9843 3 说明:ocr磁盘组信息在视图v$asm_diskgroup中消失. 3.2.3、删集群状态中crs信息集群状态. [grid@hisdb1bin]$ crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- LocalResources -------------------------------------------------------------------------------- ora.DATA.dg ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.FRA.dg ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.LISTENER.lsnr ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.OCR.dg ONLINE OFFLINE hisdb1 ONLINE OFFLINE hisdb2 ora.OCRBK.dg ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.asm ONLINE ONLINE hisdb1 Started ONLINE ONLINE hisdb2 Started ora.gsd OFFLINE OFFLINE hisdb1 OFFLINE OFFLINE hisdb2 ora.net1.network ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.ons ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 -------------------------------------------------------------------------------- ClusterResources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE hisdb1 ora.cvu 1 ONLINE ONLINE hisdb1 ora.hisdb1.vip 1 ONLINE ONLINE hisdb1 ora.hisdb2.vip 1 ONLINE ONLINE hisdb2 ora.oc4j 1 ONLINE ONLINE hisdb1 ora.orcl.db 1 ONLINE ONLINE hisdb1 Open 2 ONLINE ONLINE hisdb2 Open ora.scan1.vip 1 ONLINE ONLINE hisdb1 说明:发现集群状态中磁盘组ocr依然存在. [root@hisdb1bin]# ./crsctl delete res ora.OCR.dg [grid@hisdb1bin]$ crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- LocalResources -------------------------------------------------------------------------------- ora.DATA.dg ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.FRA.dg ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.LISTENER.lsnr ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.OCRBK.dg ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.asm ONLINE ONLINE hisdb1 Started ONLINE ONLINE hisdb2 Started ora.gsd OFFLINE OFFLINE hisdb1 OFFLINE OFFLINE hisdb2 ora.net1.network ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 ora.ons ONLINE ONLINE hisdb1 ONLINE ONLINE hisdb2 -------------------------------------------------------------------------------- ClusterResources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE hisdb1 ora.cvu 1 ONLINE ONLINE hisdb1 ora.hisdb1.vip 1 ONLINE ONLINE hisdb1 ora.hisdb2.vip 1 ONLINE ONLINE hisdb2 ora.oc4j 1 ONLINE ONLINE hisdb1 ora.orcl.db 1 ONLINE ONLINE hisdb1 Open 2 ONLINE ONLINE hisdb2 Open ora.scan1.vip 1 ONLINE ONLINE hisdb1 说明:此后集群状态中ocr磁盘组信息消失. 4、 删多路径配置删除多路径绑定配置,删除配置/etc/multipatch.conf中原有OCR盘内容.
|