使用VBOX模拟存储迁移的环境,OS:RHEL5.9,DB:Oracle 10.2.0.4 RAC ASM 2Nodes。
ASM使用Extern Redundancy,不使用ASM的rebalance功能,ocr和votedisk存放在raw里。
迁移包括controlfile,datafile,tempfile,spfile,ocr,votedisk。
迁移前路径
ocr /dev/sdf1 /dev/raw/raw1, /dev/sdf2 /dev/raw/raw2
votedisk /dev/sdg1 /dev/raw/raw3, /dev/sdg2 /dev/raw/raw4, /dev/sdg3 /dev/raw/raw5
ASM +DATA /dev/sdb
ASM +FRA /dev/sdc
迁移后路径
ocr /dev/sdh1 /dev/raw/raw6, /dev/sdh2 /dev/raw/raw7
votedisk /dev/sdi1 /dev/raw/raw8, /dev/sdi2 /dev/raw/raw9, /dev/sdi3 /dev/raw/raw10
ASM +DATAFG /dev/sdd
ASM +FRADG /dev/sde
迁移votedisk和ocr
[oracle@racdb1 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 497744
Used space (kbytes) : 4360
Available space (kbytes) : 493384
ID : 803449477
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw2
Device/File integrity check succeeded
Cluster registry integrity check succeeded
[oracle@racdb1 ~]$
[oracle@racdb1 ~]$ crsctl query css votedisk
0. 0 /dev/raw/raw3
1. 0 /dev/raw/raw4
2. 0 /dev/raw/raw5
located 3 votedisk(s).
关闭RAC环境的crs
[root@racdb1 ~]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Nov 24 16:06:49.700 | INF | daemon shutting down
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
[root@racdb2 ~]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Nov 24 16:07:11.360 | INF | daemon shutting down
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
备份votedisk
[root@racdb1 ~]# dd if=/dev/raw/raw3 of=/u01/votedisk.bak
添加votedisk
[root@racdb1 ~]# /u01/app/oracle/product/10.2.0/db_1/bin/crsctl add css votedisk /dev/raw/raw8 -force
Now formatting voting disk: /dev/raw/raw8
successful addition of votedisk /dev/raw/raw8.
[root@racdb1 ~]# /u01/app/oracle/product/10.2.0/db_1/bin/crsctl add css votedisk /dev/raw/raw9 -force
Now formatting voting disk: /dev/raw/raw9
successful addition of votedisk /dev/raw/raw9.
[root@racdb1 ~]# /u01/app/oracle/product/10.2.0/db_1/bin/crsctl add css votedisk /dev/raw/raw10 -force
Now formatting voting disk: /dev/raw/raw10
successful addition of votedisk /dev/raw/raw10.
删除旧的votedisk
[root@racdb1 ~]# /u01/app/oracle/product/10.2.0/db_1/bin/crsctl delete css votedisk /dev/raw/raw3 -force
successful deletion of votedisk /dev/raw/raw3.
[root@racdb1 ~]# /u01/app/oracle/product/10.2.0/db_1/bin/crsctl delete css votedisk /dev/raw/raw4 -force
successful deletion of votedisk /dev/raw/raw4.
[root@racdb1 ~]# /u01/app/oracle/product/10.2.0/db_1/bin/crsctl delete css votedisk /dev/raw/raw5 -force
successful deletion of votedisk /dev/raw/raw5.
启动crs
[root@racdb1 ~]# /u01/app/oracle/product/10.2.0/db_1/bin/crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
[root@racdb2 ~]# /u01/app/oracle/product/10.2.0/db_1/bin/crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
检查crs状态,votedisk路径
[oracle@racdb1 ~]$ crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
[oracle@racdb1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE racdb1
ora....B1.lsnr application ONLINE ONLINE racdb1
ora.racdb1.gsd application ONLINE ONLINE racdb1
ora.racdb1.ons application ONLINE ONLINE racdb1
ora.racdb1.vip application ONLINE ONLINE racdb1
ora....SM2.asm application ONLINE ONLINE racdb2
ora....B2.lsnr application ONLINE ONLINE racdb2
ora.racdb2.gsd application ONLINE ONLINE racdb2
ora.racdb2.ons application ONLINE ONLINE racdb2
ora.racdb2.vip application ONLINE ONLINE racdb2
ora.zhongwc.db application ONLINE ONLINE racdb2
ora....c1.inst application ONLINE ONLINE racdb1
ora....c2.inst application ONLINE ONLINE racdb2
ora.....zwc.cs application ONLINE ONLINE racdb1
ora....wc1.srv application ONLINE ONLINE racdb1
[oracle@racdb1 ~]$
[oracle@racdb1 ~]$ crsctl query css votedisk
0. 0 /dev/raw/raw8
1. 0 /dev/raw/raw9
2. 0 /dev/raw/raw10
located 3 votedisk(s).
备份ocr
[root@racdb1 bin]# /u01/app/oracle/product/10.2.0/crs/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 497744
Used space (kbytes) : 4360
Available space (kbytes) : 493384
ID : 803449477
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw2
Device/File integrity check succeeded
Cluster registry integrity check succeeded
[root@racdb1 bin]#
[root@racdb1 bin]# /u01/app/oracle/product/10.2.0/crs/bin/ocrconfig -export /u01/ocr_bak -s online
迁移ocr
[root@racdb1 bin]# /u01/app/oracle/product/10.2.0/crs/bin/ocrconfig -replace ocr /dev/raw/raw6
[root@racdb1 bin]# /u01/app/oracle/product/10.2.0/crs/bin/ocrconfig -replace ocrmirror /dev/raw/raw7
check ocr
[oracle@racdb2 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 497744
Used space (kbytes) : 4360
Available space (kbytes) : 493384
ID : 803449477
Device/File Name : /dev/raw/raw6
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw7
Device/File integrity check succeeded
Cluster registry integrity check succeeded
迁移datafile,controlfile,logfile,spfile
创建ASM DISKGROUP
asm_diskgroups='DATA','FRA','DATADG','FRADG'
[oracle@racdb1 ~]$ export ORACLE_SID=+ASM1
[oracle@racdb1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sun Nov 24 16:40:05 2013
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> col name for a8
SQL> col path for a15
SQL> select a.path,b.name,b.state from v$asm_disk a,v$asm_diskgroup b where a.group_number=b.group_number(+) order by 1;
PATH NAME STATE
--------------- -------- ----------------------
/dev/asm-diskb DATA MOUNTED
/dev/asm-diskc FRA MOUNTED
/dev/asm-diskd
/dev/asm-diske
SQL> create diskgroup datadg external redundancy disk '/dev/asm-diskd';
Diskgroup created.
SQL> create diskgroup fradg external redundancy disk '/dev/asm-diske';
Diskgroup created.
SQL> select a.path,b.name,b.state from v$asm_disk a,v$asm_diskgroup b where a.group_number=b.group_number(+) order by 1;
PATH NAME STATE
--------------- -------- ----------------------