Windows 10gR2 RAC迁移OCR和Vote Disk以及ASM磁盘组上的数据

概要:本文详细记录如何把运行在Windows 2K8环境上的Oracle 10gR2 双节点RAC数据库的OCR、Vote Disk以及存放在ASM磁盘组里的数据,迁移至新存储的步骤。

迁移之前的存储信息:

wps_clip_image-4627

如上图所示,我们的最终目标是要把OCR、Vote Disk,DATA、FLASH磁盘组从Disk 2,Disk 3上分别迁移至Disk 4和Disk 5。

接下来给出详细的操作步骤和流程:

1  迁移OCR

A 创建磁盘分区

C:\Users\Administrator>diskpart

Microsoft DiskPart version 6.1.7601

Copyright (C) 1999-2008 Microsoft Corporation.

On computer: HAMNODE1

DISKPART> list disk

Disk ###  Status         Size     Free     Dyn  Gpt

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

Disk 0    Online           40 GB      0 B

Disk 1    Online           20 GB    19 GB

Disk 2    Online         6149 MB  2048 KB

Disk 3    Online         6149 MB  2048 KB

Disk 4    Online         6149 MB  6147 MB

Disk 5    Online           10 GB    10 GB

DISKPART> select disk 4

Disk 4 is now the selected disk.

DISKPART> list part

There are no partitions on this disk to show.

DISKPART> create part ext

DiskPart succeeded in creating the specified partition.

DISKPART> create part log size=320

DiskPart succeeded in creating the specified partition.

DISKPART> create part log

DiskPart succeeded in creating the specified partition.

DISKPART> list part

Partition ###  Type              Size     Offset

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

Partition 0    Extended          6147 MB  1024 KB

Partition 1    Logical            320 MB  2048 KB

* Partition 2    Logical           5825 MB   323 MB

DISKPART>

分区之后:

wps_clip_image-12024

注:您应该在其他节点上看到同样的磁盘分区信息。且,建议在其他节点上将Windows系统自动给新分区分配的盘符移除掉。

B 准备磁盘,创建裸设备链接

C:\oracle\product\10.2.0\crs\BIN\GUIOracleOBJManager.exe

wps_clip_image-12115

wps_clip_image-24325

wps_clip_image-17645

wps_clip_image-13996

同样,执行完上述操作,您应该在RAC的所有节点上通过

C:\oracle\product\10.2.0\crs\BIN\GUIOracleOBJManager.exe程序看到相同的信息。

C 手工备份OCR

ocrconfig -export c:\oracle…..\backup_filename

备份之前,可以查看下OCR的自动备份信息:

c:\oracle\product\10.2.0\crs\BIN>ocrconfig -showbackup

hamnode2     2014/05/08 06:01:07     C:\oracle\product\10.2.0\crs\cdata\crs

hamnode2     2014/05/07 23:44:04     C:\oracle\product\10.2.0\crs\cdata\crs

hamnode2     2014/05/07 19:44:04     C:\oracle\product\10.2.0\crs\cdata\crs

hamnode2     2014/05/06 16:34:35     C:\oracle\product\10.2.0\crs\cdata\crs

hamnode1     2014/04/30 07:09:51     C:\oracle\product\10.2.0\crs\cdata\crs

c:\oracle\product\10.2.0\crs\BIN>

执行备份:

c:\oracle\product\10.2.0\crs\BIN>ocrconfig -export C:\oracle\product\10.2.0\crs\cdata\crs\backup_ocr_140508.bak

c:\oracle\product\10.2.0\crs\BIN>cd ..\cdata\crs

c:\oracle\product\10.2.0\crs\cdata\crs>dir

Volume in drive C has no label.

Volume Serial Number is BA2B-5F59

Directory of c:\oracle\product\10.2.0\crs\cdata\crs

05/08/2014  07:50 AM    <DIR>          .

05/08/2014  07:50 AM    <DIR>          ..

05/06/2014  03:24 AM         4,063,232 backup00.ocr

05/05/2014  11:24 PM         4,063,232 backup01.ocr

05/05/2014  07:24 PM         4,063,232 backup02.ocr

05/08/2014  07:43 AM            94,029 backup_ocr_140508.bak

05/02/2014  06:23 AM         4,042,752 day.ocr

05/05/2014  03:24 PM         4,063,232 day_.ocr

05/02/2014  01:04 AM            93,359 hw_backup_ocr.bak

04/30/2014  07:09 AM         4,042,752 week.ocr

8 File(s)     24,525,820 bytes

2 Dir(s)  20,506,509,312 bytes free

c:\oracle\product\10.2.0\crs\cdata\crs>

D 添加OCR镜像

ocrconfig -replace ocrmirror \\.\ocrmirror

添加之前,查看OCR信息:

c:\oracle\product\10.2.0\crs\BIN>ocrcheck

Status of Oracle Cluster Registry is as follows :

Version                  :          2

Total space (kbytes)     :     327452

Used space (kbytes)      :       3836

Available space (kbytes) :     323616

ID                       :  478679697

Device/File Name         : \\.\ocrcfg

Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded

c:\oracle\product\10.2.0\crs\BIN>

添加OCRMIRROR并验证:

c:\oracle\product\10.2.0\crs\BIN>ocrconfig -replace ocrmirror \\.\ocrmirror

c:\oracle\product\10.2.0\crs\BIN>ocrcheck

Status of Oracle Cluster Registry is as follows :

Version                  :          2

Total space (kbytes)     :     327452

Used space (kbytes)      :       3836

Available space (kbytes) :     323616

ID                       :  478679697

Device/File Name         : \\.\ocrcfg

Device/File integrity check succeeded

Device/File Name         : \\.\ocrmirror

Device/File integrity check succeeded

Cluster registry integrity check succeeded

c:\oracle\product\10.2.0\crs\BIN>

E 删除OCR device并验证

c:\oracle\product\10.2.0\crs\BIN>ocrconfig -replace ocr

c:\oracle\product\10.2.0\crs\BIN>ocrcheck

Status of Oracle Cluster Registry is as follows :

Version                  :          2

Total space (kbytes)     :     327452

Used space (kbytes)      :       3836

Available space (kbytes) :     323616

ID                       :  478679697

Device/File Name         : \\.\ocrmirror

Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded

c:\oracle\product\10.2.0\crs\BIN>

F 重启CRS并验证

至此,我们通过给OCR添加1份镜像然后删除原主OCR的方式,完成对OCR的迁移。

注:通过这种方式,删除原OCR之后,新添加的OCR镜像自动成为主OCR。

2 迁移Vote Disk

A 创建磁盘分区

这里的创建磁盘分区如创建OCR磁盘分区时,方法一致:

C:\Users\Administrator>diskpart

Microsoft DiskPart version 6.1.7601

Copyright (C) 1999-2008 Microsoft Corporation.

On computer: HAMNODE1

DISKPART> list disk

Disk ###  Status         Size     Free     Dyn  Gpt

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

Disk 0    Online           40 GB      0 B

Disk 1    Online           20 GB    19 GB

Disk 2    Online         6149 MB  2048 KB

Disk 3    Online         6149 MB  2048 KB

Disk 4    Online         6149 MB  2048 KB

Disk 5    Online           10 GB    10 GB

DISKPART> select disk 5

Disk 5 is now the selected disk.

DISKPART> list part

There are no partitions on this disk to show.

DISKPART> create part ext

DiskPart succeeded in creating the specified partition.

DISKPART> create part log size=196

DiskPart succeeded in creating the specified partition.

DISKPART> create part log

DiskPart succeeded in creating the specified partition.

DISKPART> list part

Partition ###  Type              Size     Offset

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

Partition 0    Extended            10 GB  1024 KB

Partition 1    Logical            196 MB  2048 KB

* Partition 2    Logical              9 GB   199 MB

DISKPART>

分区之后的信息:

wps_clip_image-12445

注:您应该在其他节点上看到同样的磁盘分区信息。且,建议在其他节点上将Windows系统自动给新分区分配的盘符移除掉。

B 准备磁盘,创建裸设备链接

这里的创建磁盘分区如创建OCR磁盘分区时,方法一致:

C:\oracle\product\10.2.0\crs\BIN\GUIOracleOBJManager.exe

wps_clip_image-12507

wps_clip_image-3414

C 查看Vote Disk信息

c:\oracle\product\10.2.0\crs\BIN>crsctl query css votedisk

0.     0    \\.\votedsk1

located 1 votedisk(s).

c:\oracle\product\10.2.0\crs\BIN>

D 备份Vote Disk

c:\oracle\product\10.2.0\crs\BIN>ocopy \\.\votedsk1 c:\oracle\product\10.2.0\crs\cdata\crs\votedisk_140508.bak

C:\ORACLE\PRODUCT\10.2.0\CRS\CDATA\CRS\VOTEDISK_140508.BAK

c:\oracle\product\10.2.0\crs\BIN>cd ..\cdata\crs

c:\oracle\product\10.2.0\crs\cdata\crs>dir

Volume in drive C has no label.

Volume Serial Number is BA2B-5F59

Directory of c:\oracle\product\10.2.0\crs\cdata\crs

05/08/2014  08:37 AM    <DIR>          .

05/08/2014  08:37 AM    <DIR>          ..

05/06/2014  03:24 AM         4,063,232 backup00.ocr

05/05/2014  11:24 PM         4,063,232 backup01.ocr

05/05/2014  07:24 PM         4,063,232 backup02.ocr

05/08/2014  07:43 AM            94,029 backup_ocr_140508.bak

05/02/2014  06:23 AM         4,042,752 day.ocr

05/05/2014  03:24 PM         4,063,232 day_.ocr

05/02/2014  01:04 AM            93,359 hw_backup_ocr.bak

05/08/2014  08:37 AM       205,520,896 VOTEDISK_140508.BAK

04/30/2014  07:09 AM         4,042,752 week.ocr

9 File(s)    230,046,716 bytes

2 Dir(s)  20,299,304,960 bytes free

c:\oracle\product\10.2.0\crs\cdata\crs>

E 停止CRS

c:\oracle\product\10.2.0\crs\BIN>srvctl stop database -d hamrac

c:\oracle\product\10.2.0\crs\BIN>srvctl stop asm -n hamnode1

c:\oracle\product\10.2.0\crs\BIN>srvctl stop asm -n hamnode2

c:\oracle\product\10.2.0\crs\BIN>srvctl stop nodeapps -n hamnode2

c:\oracle\product\10.2.0\crs\BIN>srvctl stop nodeapps -n hamnode1

c:\oracle\product\10.2.0\crs\BIN>crs_stat -t

Name           Type           Target    State     Host

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

ora....SM1.asm application    OFFLINE   OFFLINE

ora....E1.lsnr application    OFFLINE   OFFLINE

ora....de1.gsd application    OFFLINE   OFFLINE

ora....de1.ons application    OFFLINE   OFFLINE

ora....de1.vip application    OFFLINE   OFFLINE

ora....SM2.asm application    OFFLINE   OFFLINE

ora....E2.lsnr application    OFFLINE   OFFLINE

ora....de2.gsd application    OFFLINE   OFFLINE

ora....de2.ons application    OFFLINE   OFFLINE

ora....de2.vip application    OFFLINE   OFFLINE

ora.hamrac.db  application    OFFLINE   OFFLINE

ora....c1.inst application    OFFLINE   OFFLINE

ora....c2.inst application    OFFLINE   OFFLINE

c:\oracle\product\10.2.0\crs\BIN>crsctl stop crs

Stopping resources. This could take several minutes.

Successfully stopped CRS resources.

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

c:\oracle\product\10.2.0\crs\BIN>

注:最后一步停止CRS时,您需要到RAC所有节点上都停止CRS!

F 添加Vote Disk

c:\oracle\product\10.2.0\crs\BIN>crsctl add css votedisk \\.\votedsk2 -force

Now formatting voting disk: \\.\votedsk2

successful addition of votedisk \\.\votedsk2.

c:\oracle\product\10.2.0\crs\BIN>crsctl query css votedisk

0.     0    \\.\votedsk1

1.     0    \\.\votedsk2

located 2 votedisk(s).

c:\oracle\product\10.2.0\crs\BIN>

G 删除原Vote Disk

c:\oracle\product\10.2.0\crs\BIN>crsctl delete css votedisk \\.\votedsk1 -force

successful deletion of votedisk \\.\votedsk1.

c:\oracle\product\10.2.0\crs\BIN>crsctl query css votedisk

0.     0    \\.\votedsk2

located 1 votedisk(s).

c:\oracle\product\10.2.0\crs\BIN>

H 启动CRS并验证

3 迁移ASM DATA磁盘组

A 查看ASM磁盘信息

C:\Users\Administrator>asmtool -list

NTFS                             \Device\Harddisk0\Partition1              100M

NTFS                             \Device\Harddisk0\Partition2            40858M

Oracle Raw Device file           \Device\Harddisk2\Partition1              320M

ORCLDISKDATA1                    \Device\Harddisk2\Partition2             5825M

Oracle Raw Device file           \Device\Harddisk3\Partition1              196M

ORCLDISKFRA0                     \Device\Harddisk3\Partition2             5949M

Oracle Raw Device file           \Device\Harddisk4\Partition1              320M

\Device\Harddisk4\Partition2             5825M

Oracle Raw Device file           \Device\Harddisk5\Partition1              196M

\Device\Harddisk5\Partition2            10044M

C:\Users\Administrator>set oracle_sid=+asm1

C:\Users\Administrator>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Fri May 9 01:57:46 2014

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

SQL> col path for a30

SQL> set line 120

SQL> select name,state,total_mb,free_mb,path from v$asm_disk;

NAME                           STATE      TOTAL_MB    FREE_MB PATH

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

DATA_0001                      NORMAL         5825       4215 \\.\ORCLDISKDATA1

FRA_0000                       NORMAL         5949       5667 \\.\ORCLDISKFRA0

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

NAME                           STATE         TOTAL_MB    FREE_MB

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

DATA                           MOUNTED           5825       4215

FRA                            MOUNTED           5949       5667

SQL>

结合上述,看到DATA磁盘组[目前只有1个ASM磁盘,DATA_0001]对应于\Device\Harddisk2\Partition2设备。

FRA磁盘组[目前也只有1个ASM磁盘,FRA_0000]对应于\Device\Harddisk3\Partition2。

B DATA磁盘组添加磁盘

wps_clip_image-12595

wps_clip_image-31477

wps_clip_image-22238

wps_clip_image-12359

wps_clip_image-21133

wps_clip_image-15974

wps_clip_image-10317

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

NAME                           STATE         TOTAL_MB    FREE_MB

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

DATA                           MOUNTED          11650      10038

FRA                            MOUNTED           5949       5667

SQL> select name,state,total_mb,free_mb,path from v$asm_disk;

NAME                           STATE      TOTAL_MB    FREE_MB PATH

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

DATA_0001                      NORMAL         5825       5019 \\.\ORCLDISKDATA1

FRA_0000                       NORMAL         5949       5667 \\.\ORCLDISKFRA0

DATA_0000                      NORMAL         5825       5019 \\.\ORCLDISKDATA0

SQL>

C DATA磁盘组移除旧磁盘

SQL> alter diskgroup data drop disk data_0001;

Diskgroup altered.

SQL> select name,state,total_mb,free_mb,path from v$asm_disk;

NAME                           STATE      TOTAL_MB    FREE_MB PATH

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

DATA_0001                      DROPPING       5825       5186 \\.\ORCLDISKDATA1

FRA_0000                       NORMAL         5949       5667 \\.\ORCLDISKFRA0

DATA_0000                      NORMAL         5825       4852 \\.\ORCLDISKDATA0

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

NAME                           STATE         TOTAL_MB    FREE_MB

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

DATA                           MOUNTED          11650      10038

FRA                            MOUNTED           5949       5667

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES

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

1 REBAL RUN           1          1        776        808       1451           0

SQL>

直到最后:

SQL> select * from v$asm_operation;

no rows selected

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

NAME                           STATE         TOTAL_MB    FREE_MB

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

DATA                           MOUNTED           5825       4215

FRA                            MOUNTED           5949       5667

SQL> select name,state,total_mb,free_mb,path from v$asm_disk;

NAME                           STATE      TOTAL_MB    FREE_MB PATH

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

NORMAL         5825          0 \\.\ORCLDISKDATA1

FRA_0000                       NORMAL         5949       5667 \\.\ORCLDISKFRA0

DATA_0000                      NORMAL         5825       4215 \\.\ORCLDISKDATA0

SQL>

4 迁移ASM FRA磁盘组

A FRA磁盘组添加新磁盘

wps_clip_image-12791

wps_clip_image-4041

wps_clip_image-21263

SQL> select name,state,total_mb,free_mb,path from v$asm_disk;

NAME                           STATE      TOTAL_MB    FREE_MB PATH

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

NORMAL         5825          0 \\.\ORCLDISKDATA1

FRA_0000                       NORMAL         5949       5842 \\.\ORCLDISKFRA0

DATA_0000                      NORMAL         5825       4215 \\.\ORCLDISKDATA0

FRA_0001                       NORMAL        10044       9867 \\.\ORCLDISKFRA1

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

NAME                           STATE         TOTAL_MB    FREE_MB

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

DATA                           MOUNTED           5825       4215

FRA                            MOUNTED          15993      15709

SQL>

B FRA磁盘组删除旧磁盘

SQL> alter diskgroup fra drop disk fra_0000;

Diskgroup altered.

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

NAME                           STATE         TOTAL_MB    FREE_MB

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

DATA                           MOUNTED           5825       4215

FRA                            MOUNTED          15993      15709

SQL> select name,state,total_mb,free_mb,path from v$asm_disk;

NAME                           STATE      TOTAL_MB    FREE_MB PATH

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

NORMAL         5825          0 \\.\ORCLDISKDATA1

FRA_0000                       DROPPING       5949       5920 \\.\ORCLDISKFRA0

DATA_0000                      NORMAL         5825       4215 \\.\ORCLDISKDATA0

FRA_0001                       NORMAL        10044       9789 \\.\ORCLDISKFRA1

SQL> select * from v$asm_operation;

no rows selected

SQL> select name,state,total_mb,free_mb,path from v$asm_disk;

NAME                           STATE      TOTAL_MB    FREE_MB PATH

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

NORMAL         5825          0 \\.\ORCLDISKDATA1

NORMAL         5949          0 \\.\ORCLDISKFRA0

DATA_0000                      NORMAL         5825       4215 \\.\ORCLDISKDATA0

FRA_0001                       NORMAL        10044       9762 \\.\ORCLDISKFRA1

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

NAME                           STATE         TOTAL_MB    FREE_MB

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

DATA                           MOUNTED           5825       4215

FRA                            MOUNTED          10044       9762

SQL>

其他具体操作步骤类似。

5 删除磁盘分区

删除卷、磁盘分区信息之后:

wps_clip_image-19324

最终,对于OCR、Vote Disk的数据,我们分别通过添加镜像的方式,然后删除现有的配置,进而间接的将OCR、Vote Disk分别从Disk 2、Disk 3迁移到Disk 4和Disk 5。

对于存放在ASM 磁盘的DATA和FRA中的数据,我们是通过先对现有DATA、FRA 磁盘组分别添加ASM磁盘,然后删除磁盘组中原有的旧ASM磁盘,进而完成迁移ASM 磁盘数据的目标!

6 注意事项

1 Note:

Note:

You can migrate the RAC OCR when CRS is running ,but you cannot migrate the Voting Disk when the CRS is running.That means we must stop the CRS before we can migrate the Voting Disk.

2 Note:

Also,you must backup the voting disk when the CRS is running,or else if you shutdown the CRS first,and then you cannot use the ocopy command to backup the voting disk.

3 Note:

PROT-22: Storage too small

wps_clip_image-21036

Cause:

The ocrmirror disk space is less than the ocr disk space.

wps_clip_image-2601

Solution:

Enlarge the ocrmirror disk space as the same as the ocr disk space.

4 Note:

PROT-21: Invalid parameter

wps_clip_image-27194

Cause:

PROT-21 error is encountered because the cluster is not yet fully aware of the newly created logical drive that is being specified for <filename> in the ocrconfig -replace command.

Solution:[Doc ID 1059663.1]

This code defect is fixed in patch bundle 31 (and higher) for Oracle on Windows.
Patch 31 is available for download from My Oracle Support under the following patch numbers:

Microsoft Windows (32-bit) – 9233830
Microsoft Windows Itanium (64-bit) – 9233831
Microsoft Windows x64 (64-bit) – 9233832

There is also a relatively simple workaround available.  Namely, stop and restart the Oracle Object Service after creating the symbolic link for the new logical drive and before running the ‘ocrconfig -replace’ command.

评论 (1)

  • SFan| 2014年6月13日

    很好的例子.,之前学了一段时间Oracle ,感觉与Oracle已经越走越远了..现在运维岗….

  • 发表评论

    邮箱地址不会被公开。 必填项已用*标注