oracle怎么移动OCR,VoteFile,ASMSPILE到新的磁盘组

本篇内容主要讲解“oracle怎么移动OCR , Vote File , ASM SPILE到新的磁盘组”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“oracle怎么移动OCR , Vote File , ASM SPILE到新的磁盘组”吧!

创新互联建站坚持“要么做到,要么别承诺”的工作理念,服务领域包括:网站设计、成都网站建设、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的临桂网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!

在11GR2的环境下,将rac的OCR , Vote File , ASM SPILE迁移到到新的磁盘组。

现在的磁盘状态:

[root@rac1 ~]# crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group

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

 1. ONLINE   0c9ec99614ed4fe4bfdba4cb520dd00e (/dev/raw/raw1) [OCRVOTING]

Located 1 voting  disk(s).

[root@rac1 ~]#  ocrcheck

Status of Oracle  Cluster Registry is as follows :

Version                  :          3

Total space (kbytes)     :     262120

Used space (kbytes)      :       2544

Available space (kbytes) :     259576

ID                       :  827782161

 Device/File Name         : +OCRVOTING

                                    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

SQL> set line 300

SQL> col  failgroup for a40

SQL> col name  for a30

SQL> select  DISK_NUMBER,REDUNDANCY,name,FAILGROUP,VOTING_FILE from v$asm_disk;

DISK_NUMBER REDUNDANCY NAME            FAILGROUP        VOT

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

          1 UNKNOWN    OCRVOTING_0001  OCRVOTING_0001   N

          0 UNKNOWN    RAC_DATA_0000   RAC_DATA_0000    N

          0 UNKNOWN    OCRVOTING_0000  OCRVOTING_0000   Y

          2 UNKNOWN    OCRVOTING_0002  OCRVOTING_0002   N

SQL> select  name,total_mb,free_mb,usable_file_mb from v$asm_diskgroup;

 

NAME            TOTAL_MB    FREE_MB USABLE_FILE_MB

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

OCRVOTING           2997       2597           2597

RAC_DATA            9993       8077           8077   

 

可以看到,ocr磁盘组冗余度为external,而且是使用的裸设备,下面将ocr磁盘组移动到冗余度为normal类型的磁盘组里。

首先分配三块盘,因为是自己的测试环境,不需要太大,每块盘1G就可以。

创建共享磁盘

Cmd命令:

vmware-vdiskmanager.exe  -c -s 1000Mb -a lsilogic -t 2 F:\RAC\sharedisk\ocrdisk01.vmdk

vmware-vdiskmanager.exe  -c -s 1000Mb -a lsilogic -t 2 F:\RAC\sharedisk\ocrdisk02.vmdk

vmware-vdiskmanager.exe  -c -s 1000Mb -a lsilogic -t 2 F:\RAC\sharedisk\ocrdisk03.vmdk

 

两个虚拟机配置文件追加如下内容

scsi1:5.present  = "TRUE"

scsi1:5.mode =  "independent-persistent"

scsi1:5.filename  = "F:\RAC\sharedisk\ocrdisk01.vmdk"

scsi1:5.deviceType  = "plainDisk"

 

scsi1:6.present  = "TRUE"

scsi1:6.mode =  "independent-persistent"

scsi1:6.filename  = "F:\RAC\sharedisk\ocrdisk02.vmdk"

scsi1:6.deviceType  = "plainDisk"

 

scsi1:8.present  = "TRUE"

scsi1:8.mode =  "independent-persistent"

scsi1:8.filename  = "F:\RAC\sharedisk\ocrdisk03.vmdk"

scsi1:8.deviceType  = "plainDisk"

 

注意这里不能用7,7是系统保留的,不可用。

查看新增盘:

[root@rac1 ~]#  fdisk -l|grep sd

Disk /dev/sda:  19.3 GB, 19327352832 bytes

/dev/sda1   *           1          64      512000   83  Linux

/dev/sda2              64        1306     9972736   8e  Linux LVM

/dev/sda3            1306        1566     2093135   8e  Linux LVM

/dev/sda4            1567        2349     6289447+  8e  Linux LVM

Disk /dev/sdb:  1048 MB, 1048576000 bytes

/dev/sdb1               1        1000     1023984   83  Linux

Disk /dev/sdc:  1048 MB, 1048576000 bytes

/dev/sdc1               1        1000     1023984   83  Linux

Disk /dev/sdd:  10.5 GB, 10485760000 bytes

/dev/sdd1               1        1274    10233373+  83  Linux

Disk /dev/sde:  1048 MB, 1048576000 bytes

/dev/sde1               1        1000     1023984   83  Linux

Disk /dev/sdf:  1048 MB, 1048576000 bytes

Disk /dev/sdg:  1048 MB, 1048576000 bytes

Disk /dev/sdh:  1048 MB, 1048576000 bytes

 

sdf,sdg,sdh是我们新分配的三块盘。

编辑60-raw.rules文件:

[root@rac1  rules.d]# more 60-raw.rules

# Enter raw  device bindings here.

#

# An example  would be:

#   ACTION=="add", KERNEL=="sda", RUN+="/bin/raw  /dev/raw/raw1 %N"

# to bind  /dev/raw/raw1 to /dev/sda, or

#   ACTION=="add",  ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw  /dev/raw/raw2 %M %m"

# to bind  /dev/raw/raw2 to the device with major 8, minor 1.

ACTION=="add",  KERNEL=="sdb1",RUN+="/bin/raw /dev/raw/raw1 %N"

ACTION=="add",  KERNEL=="sdc1",RUN+="/bin/raw /dev/raw/raw2 %N"

ACTION=="add",  KERNEL=="sdd1",RUN+="/bin/raw /dev/raw/raw3 %N"

ACTION=="add",  KERNEL=="sde1",RUN+="/bin/raw /dev/raw/raw4 %N"

ACTION=="add",  KERNEL=="sdf",RUN+="/bin/raw /dev/raw/raw5 %N"

ACTION=="add",  KERNEL=="sdg",RUN+="/bin/raw /dev/raw/raw6 %N"

ACTION=="add",  KERNEL=="sdh",RUN+="/bin/raw /dev/raw/raw7 %N"

ACTION=="add",KERNEL=="raw[1-7]",  OWNER="grid", GROUP="oinstall", MODE="660"

重启udev并检查

[root@rac1 ~]#  start_udev

Starting udev:  [  OK  ]

[grid@rac1 ~]$  cd /dev/raw

[grid@rac1 raw]$  ll

total 0

crw-rw---- 1  grid oinstall 162, 1 Jun 10 23:44 raw1

crw-rw---- 1  grid oinstall 162, 2 Jun 10 23:43 raw2

crw-rw---- 1  grid oinstall 162, 3 Jun 10 23:43 raw3

crw-rw---- 1  grid oinstall 162, 4 Jun 10 23:43 raw4

crw-rw---- 1  grid oinstall 162, 5 Jun 10 23:43 raw5

crw-rw---- 1  grid oinstall 162, 6 Jun 10 23:43 raw6

crw-rw---- 1  grid oinstall 162, 7 Jun 10 23:43 raw7

crw-rw---- 1  root disk     162, 0 Jun 10 23:43  rawctl

 

图形界面创建OCRDG,这部分比较简单省略:

[grid@rac1 raw]$ asmca

图形界面创建成功之后,点击了mount all,下面验证一下新创建的磁盘组是否已经mount:

[grid@rac1 raw]$  sqlplus / as sysasm

SQL> col name  for a20

SQL> select  NAME,GROUP_NUMBER,STATE,type,TOTAL_MB,FREE_MB,usable_file_mb,VOTING_FILES  from v$asm_diskgroup;

 

NAME        GROUP_NUMBER STATE    TYPE      TOTAL_MB    FREE_MB  USABLE_FILE_MB VOT

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

OCRVOTING              1 MOUNTED  EXTERN        2997       2597           2597 N

RAC_DATA               2 MOUNTED  EXTERN        9993       8077           8077 N

OCRDG                  3 MOUNTED  NORMAL        3000       2715           1310 N

可以看到新创建的ocrdg磁盘组的状态已经mount,类型是normal。

 

磁盘状态:

SQL> select GROUP_NUMBER,DISK_NUMBER,MOUNT_STATUS,NAME,VOTING_FILE  from v$asm_disk;

 

GROUP_NUMBER  DISK_NUMBER MOUNT_STATUS          NAME                 VOT

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

      1           2 CACHED                OCRVOTING_0002       N

      1           1 CACHED                OCRVOTING_0001       N

      1           0 CACHED                OCRVOTING_0000       Y

     2           0 CACHED                RAC_DATA_0000        N

      3           2 CACHED                OCRDG_0002           N

    3           1 CACHED                OCRDG_0001           N

     3           0 CACHED                OCRDG_0000           N

 

7 rows selected.

 

也可以用下面命令验证:

[grid@rac1 raw]$ asmcmd lsdg

asm pfile文件位置:

[grid@rac1 ~]$ asmcmd spget

+OCRVOTING/rac-cluster/asmparameterfile/registry.253.952478315

备份之前的OCR,OLR,单节点:

[root@rac1  rules.d]# ocrconfig -manualbackup

[root@rac1  rules.d]# ocrconfig -local -manualbackup

将新磁盘组增加到OCR,root用户:

[root@rac1 rules.d]# /tpsys/app/11.2.0/grid/bin/ocrconfig -add +OCRDG

检查crs日志,命令行确认:

此时的crs日志:

2018-06-12  06:19:30.517: [  OCRRAW][2996766464]propriowv_bootbuf: Vote information on disk 1  [+OCRDG] is adjusted from [0/0] to [1/2]

2018-06-12  06:19:30.546: [  OCRRAW][2996766464]propriowv_bootbuf:  Vote information on disk 0 [+OCRVOTING] is adjusted from [2/2] to [1/2]

 

[root@rac1  rules.d]# ocrcheck

Status of Oracle  Cluster Registry is as follows :

         Version                  :          3

         Total space (kbytes)     :     262120

         Used space (kbytes)      :       2596

         Available space (kbytes) :     259524

         ID                       :  827782161

         Device/File Name         : +OCRVOTING

                                    Device/File  integrity check succeeded

         Device/File Name         :     +OCRDG

                                    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@rac1 rules.d]# /tpsys/app/11.2.0/grid/bin/ocrconfig -delete +OCRVOTING

检查crs日志,命令行确认:

此时的crs日志:

2018-06-12  06:28:07.526: [  OCRRAW][2986276608]propriowv_bootbuf: Vote information on disk 1 [] is  adjusted from [1/2] to [2/2]

2018-06-12  06:28:07.647: [  OCRASM][2986276608]proprasmo: ASM cache size is [5MB]

2018-06-12  06:28:07.647: [  OCRASM][2986276608]proprasmo: ASM cache [5MB] enabled for disk group  [OCRDG].

2018-06-12  06:28:07.693: [  OCRRAW][2986276608]proprioo: for disk 0 (+OCRDG), id match (1), total  id sets, (2) need recover (0), my votes (2), total votes (2), commit_lsn (68),  lsn (68)

[root@rac1 rules.d]# ocrcheck

Status of Oracle  Cluster Registry is as follows :

         Version                  :          3

         Total space (kbytes)     :     262120

         Used space (kbytes)      :       2596

         Available space (kbytes) :     259524

         ID                       :  827782161

         Device/File Name         :     +OCRDG

                                    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

替换vote disk:

[root@rac1 rules.d]# crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group

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

 1. ONLINE   0c9ec99614ed4fe4bfdba4cb520dd00e (/dev/raw/raw1) [OCRVOTING]

Located 1 voting  disk(s).         

 

[root@rac1 rules.d]#  /tpsys/app/11.2.0/grid/bin/crsctl replace votedisk +OCRDG

 

Successful  addition of voting disk 0a80756b9eb44f9abfae577e0e8ed2dd.

Successful  addition of voting disk 000808a364544f11bf48969149e2bf2a.

Successful  addition of voting disk 8714d5dd04634f70bf3bbd8ae1a467ac.

Successful  deletion of voting disk 0c9ec99614ed4fe4bfdba4cb520dd00e.

Successfully  replaced voting disk group with +OCRDG.

CRS-4266: Voting  file(s) successfully replaced

 

验证,root用户:

[root@rac1 rules.d]# crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group

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

 1. ONLINE   0a80756b9eb44f9abfae577e0e8ed2dd (/dev/raw/raw5) [OCRDG]

 2. ONLINE   000808a364544f11bf48969149e2bf2a (/dev/raw/raw6) [OCRDG]

 3. ONLINE   8714d5dd04634f70bf3bbd8ae1a467ac (/dev/raw/raw7) [OCRDG]

Located 3 voting  disk(s).

 

创建asm pfile到新的磁盘组:

[grid@rac1 ~]$  sqlplus / as sysasm

SQL> create pfile='/tmp/asmpfile.ora'  from spfile;

File created.

 

SQL> create spfile='+OCRDG' from  pfile='/tmp/asmpfile.ora';

File created.

 

[grid@rac1 ~]$  asmcmd spget

+OCRDG/rac-cluster/asmparameterfile/registry.253.978589927

 

使用新的pfile文件重启集群:

crsctl stop crs

crsctl start crs

[grid@rac2 ~]$ crsctl stat res -t

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

NAME           TARGET  STATE        SERVER                   STATE_DETAILS      

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

Local Resources

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

ora.LISTENER.lsnr

               ONLINE  ONLINE       rac1                                        

               ONLINE  ONLINE       rac2                                        

ora.OCRDG.dg

               ONLINE  ONLINE       rac1                                        

               ONLINE  ONLINE       rac2                                        

ora.OCRVOTING.dg

               ONLINE  ONLINE       rac1                                        

               ONLINE  ONLINE       rac2                                        

ora.RAC_DATA.dg

               ONLINE  ONLINE       rac1                                         

               ONLINE  ONLINE       rac2                                        

ora.asm

               ONLINE  ONLINE       rac1                     Started            

               ONLINE  ONLINE       rac2                     Started             

ora.eons

               ONLINE  ONLINE       rac1                                        

               ONLINE  ONLINE       rac2                                        

ora.gsd

               OFFLINE OFFLINE      rac1                                        

               OFFLINE OFFLINE      rac2                                        

ora.net1.network

               ONLINE  ONLINE       rac1                                         

               ONLINE  ONLINE       rac2                                        

ora.ons

               ONLINE  ONLINE       rac1                                        

               ONLINE  ONLINE       rac2                                         

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

Cluster Resources

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

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       rac1                                         

ora.oc4j

      1        OFFLINE OFFLINE                                                  

ora.rac1.vip

      1        ONLINE  ONLINE       rac1                                        

ora.rac2.vip

      1        ONLINE  ONLINE       rac2                                        

ora.ractest.db

      1        ONLINE  ONLINE       rac1                     Open               

      2        ONLINE  ONLINE       rac2                     Open               

ora.scan1.vip

      1        ONLINE  ONLINE       rac1                                        

成功完成!

到此,相信大家对“oracle怎么移动OCR , Vote File , ASM SPILE到新的磁盘组”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!


当前题目:oracle怎么移动OCR,VoteFile,ASMSPILE到新的磁盘组
本文地址:http://pwwzsj.com/article/gohjoo.html