虚拟化容器,大数据,DBA,中间件,监控。

oracle 10g rac 存储迁移

24 03月
作者:admin|分类:DBA运维

环境介绍:两台机器做的10g rac,需要用新存储替换掉老存储,服务器不变。

做之前先做个全备以防万一,下面的没有备份的步骤,只是介绍一下迁移存储的过程,给有类似需求的朋友做个参考

下面是具体实施步骤:

1、迁移votedisk

[oracle@rac1 ~]$ crsctl query css votedisk
0.     0    /dev/raw/raw2

located 1 votedisk(s).

停止两节点crs

rac1:
[root@rac1 ~]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
[root@rac1 ~]#

rac2:

[root@rac2 ~]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
[root@rac2 ~]#

备份vote盘

[root@rac1 ~]# dd if=/dev/raw/raw2 of=/oracle/vote.bak20131120 bs=1M
949+1 records in
949+1 records out
995258880 bytes (995 MB) copied, 45.3249 seconds, 22.0 MB/s
[root@rac1 ~]#

添加新的vote盘

[root@rac1 bin]# ./crsctl add css votedisk /dev/mapper/vote_10g_migrate -force
Now formatting voting disk: /dev/mapper/vote_10g_migrate
successful addition of votedisk /dev/mapper/vote_10g_migrate.
[root@rac1 bin]#

查看下添加的vote盘

[root@rac1 bin]# ./crsctl query css votedisk
0.     0    /dev/raw/raw2
1.     0    /dev/mapper/vote_10g_migrate

located 2 votedisk(s).
[root@rac1 bin]#

两节点启动crs

[root@rac1 bin]# /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds.
[root@rac1 bin]#

[root@rac2 ~]# /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds.
[root@rac2 ~]#

检查启动情况

[oracle@rac1 ~]$ crs_stat -t
Name           Type           Target    State     Host
————————————————————
ora.orcl.db    application    ONLINE    ONLINE    rac1
ora….l1.inst application    ONLINE    ONLINE    rac1
ora….l2.inst application    ONLINE    ONLINE    rac2
ora.orcl.ty.cs application    ONLINE    ONLINE    rac2
ora….cl1.srv application    ONLINE    ONLINE    rac1
ora….cl2.srv application    ONLINE    ONLINE    rac2
ora….SM1.asm application    ONLINE    ONLINE    rac1
ora….C1.lsnr application    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    ONLINE    ONLINE    rac1
ora.rac1.ons   application    ONLINE    ONLINE    rac1
ora.rac1.vip   application    ONLINE    ONLINE    rac1
ora….SM2.asm application    ONLINE    ONLINE    rac2
ora….C2.lsnr application    ONLINE    ONLINE    rac2
ora.rac2.gsd   application    ONLINE    ONLINE    rac2
ora.rac2.ons   application    ONLINE    ONLINE    rac2
ora.rac2.vip   application    ONLINE    ONLINE    rac2
一切正常

两节点停止crs

[root@rac1 bin]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
[root@rac1 bin]#

[root@rac2 ~]#  /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
[root@rac2 ~]#

删除老的vote盘

[root@rac1 bin]# ./crsctl delete css votedisk /dev/raw/raw2 -force
successful deletion of votedisk /dev/raw/raw2.
[root@rac1 bin]#

两节点启动crs

[root@rac1 bin]# /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds.
[root@rac1 bin]#

[root@rac2 ~]# /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds.
[root@rac2 ~]#

检查启动情况

[oracle@rac1 ~]$ crs_stat -t
Name           Type           Target    State     Host
————————————————————
ora.orcl.db    application    ONLINE    ONLINE    rac1
ora….l1.inst application    ONLINE    ONLINE    rac1
ora….l2.inst application    ONLINE    ONLINE    rac2
ora.orcl.ty.cs application    ONLINE    ONLINE    rac2
ora….cl1.srv application    ONLINE    ONLINE    rac1
ora….cl2.srv application    ONLINE    ONLINE    rac2
ora….SM1.asm application    ONLINE    ONLINE    rac1
ora….C1.lsnr application    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    ONLINE    ONLINE    rac1
ora.rac1.ons   application    ONLINE    ONLINE    rac1
ora.rac1.vip   application    ONLINE    ONLINE    rac1
ora….SM2.asm application    ONLINE    ONLINE    rac2
ora….C2.lsnr application    ONLINE    ONLINE    rac2
ora.rac2.gsd   application    ONLINE    ONLINE    rac2
ora.rac2.ons   application    ONLINE    ONLINE    rac2
ora.rac2.vip   application    ONLINE    ONLINE    rac2
[oracle@rac1 ~]$

检查vote盘情况

[root@rac1 bin]# ./crsctl query css votedisk
0.     0    /dev/mapper/vote_10g_migrate

located 1 votedisk(s).
[root@rac1 bin]#

vote盘迁移完成
2、迁移ocr磁盘
查看ocr

[root@rac1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version                  :          2
Total space (kbytes)     :     987880
Used space (kbytes)      :       4580
Available space (kbytes) :     983300
ID                       : 1395952022
Device/File Name         : /dev/raw/raw1
Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded

[root@rac1 bin]#

在线备份ocr

[root@rac1 bin]# ./ocrconfig -export /oracle/ocr.bak20131121 -s online
[root@rac1 bin]#

迁移ocr方法一:

编辑两个节点/etc/oracle/ocr.loc
将ocrconfig_loc的位置/dev/raw/raw1改为新存储的/dev/mapper/ocr_10g_migrate
导入ocr配置并检查

[root@rac1 bin]# ./ocrconfig -import /oracle/ocr.bak20131121
[root@rac1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version                  :          2
Total space (kbytes)     :     262144
Used space (kbytes)      :       4580
Available space (kbytes) :     257564
ID                       : 1937189729
Device/File Name         : /dev/mapper/ocr_10g_migrate
Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded

[root@rac1 bin]#
[root@rac1 bin]# /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds.
[root@rac1 bin]# ./crs_stat -t
Name           Type           Target    State     Host
————————————————————
ora.orcl.db    application    ONLINE    ONLINE    rac1
ora….l1.inst application    ONLINE    ONLINE    rac1
ora….l2.inst application    ONLINE    ONLINE    rac2
ora.orcl.ty.cs application    ONLINE    ONLINE    rac2
ora….cl1.srv application    ONLINE    ONLINE    rac1
ora….cl2.srv application    ONLINE    ONLINE    rac2
ora….SM1.asm application    ONLINE    ONLINE    rac1
ora….C1.lsnr application    ONLINE    ONLINE    rac1
ora.rac1.gsd   application    ONLINE    ONLINE    rac1
ora.rac1.ons   application    ONLINE    ONLINE    rac1
ora.rac1.vip   application    ONLINE    ONLINE    rac1
ora….SM2.asm application    ONLINE    ONLINE    rac2
ora….C2.lsnr application    ONLINE    ONLINE    rac2
ora.rac2.gsd   application    ONLINE    ONLINE    rac2
ora.rac2.ons   application    ONLINE    ONLINE    rac2
ora.rac2.vip   application    ONLINE    ONLINE    rac2

迁移ocr方法二:
镜像
./ocrconfig -replace ocrmirror /dev/mapper/ocr_10g_migrate
检查
./ocrcheck
替换
./ocrconfig -replace ocr
剩下的检查步骤略。。。同方法一

ocr迁移完成
3、迁移数据文件
启动两节点实例到mount状态

[oracle@rac1 ~]$ sqlplus  / as sysdba

SQL*Plus: Release 10.2.0.1.0 – Production on Tue Jul 9 06:59:29 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  2020192 bytes
Variable Size             188746912 bytes
Database Buffers           88080384 bytes
Redo Buffers                6365184 bytes
Database mounted.
SQL>

节点2
[oracle@rac2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 – Production on Tue Jul 9 06:58:56 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  2020192 bytes
Variable Size             159386784 bytes
Database Buffers          117440512 bytes
Redo Buffers                6365184 bytes
Database mounted.
SQL>

添加asm磁盘发现位置

节点1:

SQL>  alter system set asm_diskstring=’/dev/raw/raw*’,'/dev/mapper/*’;

System altered.

创建asm磁盘组

SQL>  create diskgroup data2 external redundancy disk ‘/dev/mapper/asm_10g_migrate’;

Diskgroup created.

节点2

SQL> alter system set asm_diskstring=’/dev/raw/raw*’,'/dev/mapper/*’;

System altered.

SQL>  alter diskgroup data2 mount;

Diskgroup altered.

SQL>

记得在asm pfile中添加disk_strings

创建文件存放目录

[oracle@rac1 ~]$ asmcmd
ASMCMD> exit
[oracle@rac1 ~]$ export ORACLE_SID=+ASM1
[oracle@rac1 ~]$ asmcmd
ASMCMD> cd data2
ASMCMD> mkdir orcl
ASMCMD> cd orcl
ASMCMD> mkdir datafile
ASMCMD> pwd
+data2/orcl
ASMCMD> cd datafile
ASMCMD> pwd
+data2/orcl/datafile
ASMCMD> ls
ASMCMD> cd ..
ASMCMD> pwd
+data2/orcl
ASMCMD> mkdir ARCHIVELOG/
ASMCMD> mkdir CONTROLFILE/
ASMCMD> mkdir ONLINELOG/
ASMCMD> mkdir PARAMETERFILE/
ASMCMD> mkdir TEMPFILE/
ASMCMD>

查询数据文件名

SQL> select FILE#,NAME from v$datafile;

FILE#
———-
NAME
——————————————————————————–
1
+DATA/orcl/datafile/system.259.820273479

2
+DATA/orcl/datafile/undotbs1.260.820273503

3
+DATA/orcl/datafile/sysaux.261.820273515

FILE#
———-
NAME
——————————————————————————–
4
+DATA/orcl/datafile/undotbs2.263.820273535

5
+DATA/orcl/datafile/users.264.820273547

rman迁移数据文件

[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 – Production on Tue Jul 9 07:21:07 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL (DBID=1348054200, not open)

RMAN> copy datafile 1 to ‘+DATA2/orcl/datafile/system01.dbf’;

Starting backup at 09-JUL-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=151 instance=orcl1 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=+DATA/orcl/datafile/system.259.820273479
output filename=+DATA2/orcl/datafile/system01.dbf tag=TAG20130709T072141 recid=1 stamp=820308133
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:36
Finished backup at 09-JUL-13

RMAN> copy datafile 2 to ‘+DATA2/orcl/datafile/undotbs01.dbf’;

Starting backup at 09-JUL-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=+DATA/orcl/datafile/undotbs1.260.820273503
output filename=+DATA2/orcl/datafile/undotbs01.dbf tag=TAG20130709T072412 recid=2 stamp=820308278
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:26
Finished backup at 09-JUL-13

RMAN> copy datafile 3 to ‘+DATA2/orcl/datafile/sysaux01.dbf’;

Starting backup at 09-JUL-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=+DATA/orcl/datafile/sysaux.261.820273515
output filename=+DATA2/orcl/datafile/sysaux01.dbf tag=TAG20130709T072505 recid=3 stamp=820308320
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 09-JUL-13

RMAN> copy datafile 4 to ‘+DATA2/orcl/datafile/undotbs02.dbf’;

Starting backup at 09-JUL-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=+DATA/orcl/datafile/undotbs2.263.820273535
output filename=+DATA2/orcl/datafile/undotbs02.dbf tag=TAG20130709T072546 recid=4 stamp=820308367
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
Finished backup at 09-JUL-13

RMAN> copy datafile 5 to ‘+DATA2/orcl/datafile/users01.dbf’;

Starting backup at 09-JUL-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=+DATA/orcl/datafile/users.264.820273547
output filename=+DATA2/orcl/datafile/users01.dbf tag=TAG20130709T072627 recid=5 stamp=820308390
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 09-JUL-13

RMAN>

更改数据文件存储位置

[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 – Production on Tue Jul 9 07:27:25 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> alter database rename file ‘+DATA/orcl/datafile/SYSTEM.259.820273479′ to ‘+DATA2/orcl/datafile/system01.dbf’;

Database altered.

SQL> alter database rename file ‘+DATA/orcl/datafile/UNDOTBS1.260.820273503′ to  ‘+DATA2/orcl/datafile/undotbs01.dbf’;

Database altered.

SQL>  alter database rename file ‘+DATA/orcl/datafile/UNDOTBS2.263.820273535′ to ‘+DATA2/orcl/datafile/undotbs02.dbf’;

Database altered.

SQL> alter database rename file ‘+DATA/orcl/datafile/SYSAUX.261.820273515′ to ‘+DATA2/orcl/datafile/sysaux01.dbf’;

Database altered.

SQL>  alter database rename file ‘+DATA/orcl/datafile/USERS.264.820273547′ to ‘+DATA2/orcl/datafile/users01.dbf’;

Database altered.

SQL>

两节点打开数据库并验证数据文件位置

SQL> alter database open;

Database altered.

SQL>
SQL> select file_name from dba_data_files;

FILE_NAME
——————————————————————————–
+DATA2/orcl/datafile/system01.dbf
+DATA2/orcl/datafile/undotbs01.dbf
+DATA2/orcl/datafile/sysaux01.dbf
+DATA2/orcl/datafile/undotbs02.dbf
+DATA2/orcl/datafile/users01.dbf

SQL>

节点2
[oracle@rac2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 – Production on Tue Jul 9 07:36:16 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> alter database open;

Database altered.

SQL>

数据文件迁移完成

4、迁移日志文件

查看日志文件

SQL> select * from v$logfile;

GROUP# STATUS  TYPE    MEMBER                         IS_
———- ——- ——- —————————— —
1         ONLINE  +DATA/orcl/onlinelog/group_1.2 NO
57.820273477

2 STALE   ONLINE  +DATA/orcl/onlinelog/group_2.2 NO
58.820273477

3 STALE   ONLINE  +DATA/orcl/onlinelog/group_3.2 NO
65.820274481

4         ONLINE  +DATA/orcl/onlinelog/group_4.2 NO
66.820274481

GROUP# STATUS  TYPE    MEMBER                         IS_
———- ——- ——- —————————— —

添加日志组

SQL> alter database add logfile thread 1 group 5 ‘+DATA2/orcl/onlinelog/group5.dbf’ size 50M;

Database altered.

SQL>  alter database add logfile thread 1 group 6 ‘+DATA2/orcl/onlinelog/group6.dbf’ size 50M;

Database altered.

SQL>  alter database add logfile thread 2  group 7 ‘+DATA2/orcl/onlinelog/group7.dbf’ size 50M;

Database altered.

SQL> alter database add logfile thread 2  group 8 ‘+DATA2/orcl/onlinelog/group8.dbf’ size 50M;

Database altered.

多切换几次日志,将当前日志组切换到刚才建的日志组上

SQL> alter system switch logfile;

System altered.

SQL> select *from v$log;

GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS
———- ———- ———- ———- ———- — —————-
FIRST_CHANGE# FIRST_TIM
————- ———
1          1         93   10485760          1 YES INACTIVE
627127 09-JUL-13

2          1         92   10485760          1 YES INACTIVE
627118 09-JUL-13

3          2         11   10485760          1 YES INACTIVE
585012 09-JUL-13

GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS
———- ———- ———- ———- ———- — —————-
FIRST_CHANGE# FIRST_TIM
————- ———
4          2         12   10485760          1 YES INACTIVE
625635 09-JUL-13

5          1         94   52428800          1 NO  CURRENT
627137 09-JUL-13

6          1         91   52428800          1 YES INACTIVE
627108 09-JUL-13

GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS
———- ———- ———- ———- ———- — —————-
FIRST_CHANGE# FIRST_TIM
————- ———
7          2         13   52428800          1 NO  CURRENT
627121 09-JUL-13

8          2          0   52428800          1 YES UNUSED
0

8 rows selected.

SQL>

删除原来的日志组

SQL> alter database drop logfile group 1;

Database altered.

SQL>  alter database drop logfile group 2;

Database altered.

SQL> alter database drop logfile group 3;

Database altered.

SQL> alter database drop logfile group 4;

Database altered.

SQL>

再次确认

SQL> select * from v$logfile;

GROUP# STATUS  TYPE    MEMBER                         IS_
———- ——- ——- —————————— —
5         ONLINE  +DATA2/orcl/onlinelog/group5.d NO
bf

6         ONLINE  +DATA2/orcl/onlinelog/group6.d NO
bf

7         ONLINE  +DATA2/orcl/onlinelog/group7.d NO
bf

8         ONLINE  +DATA2/orcl/onlinelog/group8.d NO
bf

GROUP# STATUS  TYPE    MEMBER                         IS_
———- ——- ——- —————————— —

SQL>

日志文件迁移完成

5、准备迁移临时文件和控制文件

临时表空间可以新建,也可以选择下面的方式迁移

查看临时文件

SQL> select file#,name from v$tempfile;

FILE# NAME
———- —————————————-
1 +DATA/orcl/tempfile/temp.262.820273525

查看控制文件

SQL> select * from v$controlfile;

STATUS
——-
NAME
——————————————————————————–
IS_ BLOCK_SIZE FILE_SIZE_BLKS
— ———- ————–

+DATA/orcl/controlfile/current.256.820273471
NO       16384            950

启动其中一个节点到nomount状态,另一个节点实例保持关闭状态

[oracle@rac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 – Production on Tue Jul 9 07:55:37 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 – 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL>
SQL>
SQL>
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  2020192 bytes
Variable Size             192941216 bytes
Database Buffers           83886080 bytes
Redo Buffers                6365184 bytes
SQL>

rman迁移控制文件

[oracle@rac1 ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 – Production on Tue Jul 9 07:58:01 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: orcl (not mounted)

RMAN> restore controlfile to ‘+DATA2/orcl/controlfile/control01.ctl’ from ‘+DATA/orcl/controlfile/Current.256.820273471′;

Starting restore at 09-JUL-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=145 instance=orcl1 devtype=DISK

channel ORA_DISK_1: copied control file copy
Finished restore at 09-JUL-13

RMAN>

回到sqlplus
SQL> alter system set control_files=’+DATA2/orcl/controlfile/control01.ctl’ scope=spfile;

System altered.

SQL>

控制文件迁移完成

6、迁移spifle
查看spfile

[oracle@rac1 bin]$ srvctl config database -d orcl -a
rac1 orcl1 /oracle/app/oracle/10.2.0/db_1
rac2 orcl2 /oracle/app/oracle/10.2.0/db_1
DB_NAME: orcl
ORACLE_HOME: /oracle/app/oracle/10.2.0/db_1
SPFILE: +DATA/orcl/spfileorcl.ora
DOMAIN: null
DB_ROLE: null
START_OPTIONS: null
POLICY:  AUTOMATIC
ENABLE FLAG: DB ENABLED
[oracle@rac1 bin]$

SQL> create pfile=’/tmp/pfile’ from spfile;

File created.

编辑pfile文件,修改归档路径

SQL>
SQL> create spfile=’+DATA2/orcl/spfileorcl.ora’ from pfile=’/tmp/pfile’;

File created.

SQL>
[oracle@rac1 bin]$ srvctl modify database -d orcl -p ‘+DATA2/orcl/spfileorcl.ora’
[oracle@rac1 bin]$ srvctl config database -d orcl -a
rac1 orcl1 /oracle/app/oracle/10.2.0/db_1
rac2 orcl2 /oracle/app/oracle/10.2.0/db_1
DB_NAME: orcl
ORACLE_HOME: /oracle/app/oracle/10.2.0/db_1
SPFILE: +DATA2/orcl/spfileorcl.ora
DOMAIN: null
DB_ROLE: null
START_OPTIONS: null
POLICY:  AUTOMATIC
ENABLE FLAG: DB ENABLED
[oracle@rac1 bin]$

修改两节点的pfile,更改spfile的位置

spfile迁移完成

重新启动实例到mount状态,节点2继续保持关闭状态,准备迁移临时文件

SQL> shutdown immediate;
ORA-01507: database not mounted

ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  2020192 bytes
Variable Size             192941216 bytes
Database Buffers           83886080 bytes
Redo Buffers                6365184 bytes
Database mounted.
SQL>

迁移临时文件

RMAN>  run{
2>    set newname for tempfile 1 to ‘+DATA2/orcl/tempfile’;
3>    switch tempfile all;
4>    }

executing command: SET NEWNAME
using target database control file instead of recovery catalog

renamed temporary file 1 to +DATA2/orcl/tempfile in control file

RMAN>

临时文件迁移完成

回到sqlplus
重新关闭并启动数据库,并启动节点2的数据库,检查

SQL> show parameter spfile;

NAME                                 TYPE        VALUE
———————————— ———– ——————————
spfile                               string      +DATA2/orcl/spfileorcl.ora
SQL> select file#,name from v$tempfile;

FILE# NAME
———- —————————————-
1 +DATA2/orcl/tempfile

SQL> show parameter control_files;

NAME                                 TYPE        VALUE
———————————— ———– ——————————
control_files                        string      +DATA2/orcl/controlfile/contro
l01.ctl
SQL>

至此,全部迁移完成,原来的asm磁盘组还未做处理,可以在后续进行处理。

浏览1917 评论0
返回
目录
返回
首页
Oracle 单实例 迁移到 RAC 实例 -- 使用RMAN 异机恢复 在线搭建oracle11g R2 rac+dg