ITPUX技术网

交流 . 资讯 . 分享
Make progress together!
Oracle数据库DBA高级工程师培训视频
Oracle数据库培训-备份恢复-性能优化-集群容灾
mysql数据库视频教程

oracle 10g rac hacmp迁移到asm实施步骤

内容发布:paulyi| 发布时间:2014-2-17 21:08:11
本帖最后由 paulyi 于 2014-2-17 21:09 编辑

oracle 10g rac hacmp 迁移数据库到asm实施步骤

1 实验目的
oracle 11gR2版本开始在建库选项中不支持裸设备来创建数据库,只能用共享文件系统和asm来创建数据库,不再支持raw来存放数据文件。
很多客户都是用裸设备来管理数据库,Oracle 提供了方法把裸设备迁移到asm中,以下为具体的实验步骤。

2 实验环境和原来裸设备信息

迁移前的数据库环境信息
数据库版本 环境 数据库名 实例名 IP地址 操作系统和主机名
oracle10.2.0.4 hacmp5.5 orcl orcl1 192.168.3.225 aix6.1+p520
RAC orcl orcl2 192.168.3.223 aix6.1+p650

迁移后的数据库环境信息
数据库版本 环境 数据库名 实例名 IP地址 操作系统和主机名
数据库版本 环境 数据库名 实例名 IP地址 操作系统和主机名
oracle10.2.0.4 asm orcl orcl1 192.168.3.225 aix6.1+p520
RAC orcl orcl2 192.168.3.223 aix6.1+p650

原lv信息
vg名称 lv名称 作用
datavg ocrnewlv ocr盘
rvotenewlv vote盘
system_lv 数据库system表空间
undo1_lv 节点1 undo表空间
sysaux_lv 数据库 sysaux表空间
user_lv 数据库 user表空间
Undo2_lv 节点2 undo 表空间
temp_lv 数据库 temp表空间
redo11_lv 数据库重做日志
redo12_lv 数据库重做日志
redo21_lv 数据库重做日志
redo22_lv 数据库重做日志
control1_lv 数据库控制文件
control2_lv 数据库控制文件
control3_lv 数据库控制文件
spfile_lv 数据库参数文件

迁移到asm磁盘组信息
磁盘组名称 磁盘名称 作用
hdisk11 ocr盘
hdisk10 vote盘
dgtest hdisk5 存放数据文件,控制文件,参数文件,重做日志文件
hdisk6
hdisk7

3 实验步骤
前提是hdisk5,hdisk6,hdisk7,hdisk10,hdisk11已经是从存储中划分到p520,p650节点上,并且赋予权限给oracle用户,并且两边节点先创建好asm实例和磁盘组dgtest。

3.1 迁移ocr盘到hdisk11磁盘中
在线做,不需要停crs
查看当前ocr盘
[oracle@p650:/oracle/app/oracle]$ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 130852
Used space (kbytes) : 4636
Available space (kbytes) : 126216
ID : 1542042236
Device/File Name : /dev/rocrnewlv
Device/File integrity check succeeded
Cluster registry integrity check succeeded
对当前ocr盘增加镜象
[root@p650:/crs/app/oracle/product/crs_1/bin]#./ocrconfig -replace ocrmirror /dev/rhdisk11

查看镜象后的ocr盘
ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 130852
Used space (kbytes) : 4636
Available space (kbytes) : 126216
ID : 1542042236
Device/File Name : /dev/rocrnewlv
Device/File integrity check succeeded
Device/File Name : /dev/rhdisk11
Device/File integrity check succeeded
Cluster registry integrity check succeeded
从ocr盘去掉ocrnewlv裸设备
[root@p520:/crs/app/oracle/product/crs_1/bin]#./ocrconfig -replace ocr
查看最后的设置,成功迁移到hdisk11磁盘中
[root@p520:/crs/app/oracle/product/crs_1/bin]#./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 130852
Used space (kbytes) : 4636
Available space (kbytes) : 126216
ID : 1542042236
Device/File Name : /dev/rhdisk11
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded

3.2 迁移vote盘到hdisk10中
需要两边节点停止crs
查看当前vote盘
[root@p520:/crs/app/oracle/product/crs_1/bin]#./crsctl query css votedisk
0. 0 /dev/rvotenewv
located 1 votedisk(s).
增加vote镜象盘
[root@p520:/crs/app/oracle/product/crs_1/bin]#./crsctl add css votedisk '/dev/rhdisk10' -force
Now formatting voting disk: /dev/rhdisk10
successful addition of votedisk /dev/rhdisk10
查看镜象后的vote盘
[root@p520:/crs/app/oracle/product/crs_1/bin]#./crsctl query css votedisk
0. 0 /dev/rvotenewlv
1. 0 /dev/rhdisk10
从vote盘中删除votenewlv裸设备
[root@p520:/crs/app/oracle/product/crs_1/bin]#./crsctl delete css votedisk '/dev/rvotenewlv' -force
successful deletion of votedisk /dev/rvotenewlv
查看最后vote盘,成功迁移到hdisk10磁盘中
[root@p650:/crs/app/oracle/product/crs_1/bin]#./crsctl query css votedisk
0. 0 /dev/rhdisk10
located 1 votedisk(s).
两边节点启动crs
查看两边节点资源状态
crs_stat -t

3.3 设置参数到asm磁盘组中
控制文件,数据文件,和日志文件到磁盘中。
sqlplus “/as sysdba”
SQL> alter system set db_create_file_dest='+dgtest' scope=spfile;
System altered.
SQL> alter system set db_create_online_log_dest_1='+dgtest' scope=spfile;
System altered.
SQL> alter system set db_create_online_log_dest_2='+dgtest' scope=spfile;
System altered.
SQL> alter system set control_files='+dgtest/orcl/control01.ctl' scope=spfile;
System altered.

3.4 迁移控制文件到磁盘组中
关闭p520实例,在p650实例中做迁移
关闭p650实例,启动到nomount状态,恢复控制文件到asm磁盘组中
[oracle@p650:/oracle/app/oracle]$rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Fri May 28 18:12:36 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area 4982833152 bytes
Fixed Size 2090856 bytes
Variable Size 889194648 bytes
Database Buffers 4076863488 bytes
Redo Buffers 14684160 bytes
RMAN> restore controlfile from '/dev/rcontrol1_lv';
Starting restore at 28-MAY-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=147 instance=orcl2 devtype=DISK
channel ORA_DISK_1: copied control file copy
output filename=+DGTEST/orcl/control01.ctl
Finished restore at 28-MAY-10

RMAN> alter database mount; --把数据库启动到mount状态
database mounted
released channel: ORA_DISK_1

3.5 迁移数据文件到asm磁盘组中
RMAN> backup as copy database format '+dgtest';
Starting backup at 28-MAY-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/dev/rsystem_lv
output filename=+DGTEST/orcl/datafile/system.257.720209735 tag=TAG20100528T181535 recid=1 stamp=720209766
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=/dev/rundo1_lv
output filename=+DGTEST/orcl/datafile/undotbs1.258.720209771 tag=TAG20100528T181535 recid=2 stamp=720209792
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=/dev/rundo2_lv
output filename=+DGTEST/orcl/datafile/undotbs2.259.720209797 tag=TAG20100528T181535 recid=3 stamp=720209816
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/dev/rsysaux_lv
output filename=+DGTEST/orcl/datafile/sysaux.260.720209821 tag=TAG20100528T181535 recid=4 stamp=720209834
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/dev/ruser_lv
output filename=+DGTEST/orcl/datafile/users.261.720209837 tag=TAG20100528T181535 recid=5 stamp=720209837
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
copying current control file
output filename=+DGTEST/orcl/controlfile/backup.262.720209837 tag=TAG20100528T181535 recid=6 stamp=720209838
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 28-MAY-10
channel ORA_DISK_1: finished piece 1 at 28-MAY-10
piece handle=+DGTEST/orcl/backupset/2010_05_28/nnsnf0_tag20100528t181535_0.263.720209843 tag=TAG20100528T181535 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 28-MAY-10

RMAN> switch database to copy;

datafile 1 switched to datafile copy "+DGTEST/orcl/datafile/system.257.720209735"
datafile 2 switched to datafile copy "+DGTEST/orcl/datafile/undotbs1.258.720209771"
datafile 3 switched to datafile copy "+DGTEST/orcl/datafile/sysaux.260.720209821"
datafile 4 switched to datafile copy "+DGTEST/orcl/datafile/users.261.720209837"
datafile 5 switched to datafile copy "+DGTEST/orcl/datafile/undotbs2.259.720209797"
RMAN> recover database;
RMAN> alter database open;

3.6 迁移temp文件到asm磁盘组中
SQL> alter tablespace temp add tempfile '+dgtest' size 100M;
Tablespace altered.
SQL> alter database tempfile '/dev/rtemp_lv' drop;
Database altered.


3.7 迁移重做日志到asm磁盘组中
SQL> alter database add logfile thread 1 group 5 size 50m;
Database altered.
SQL> alter database add logfile thread 1 group 6 size 50m;
Database altered.
SQL> alter database add logfile thread 2 group 7 size 50m;
Database altered.
SQL> alter database add logfile thread 2 group 8 size 50m;
Database altered.
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.

3.8 对控制文件做镜象
SQL> alter system set control_files='+dgtest/orcl/control01.ctl','+dgtest/orcl/control02.ctl' scope=spfile;
Database altered.
SQL> alter database backup controlfile to '+dgtest/orcl/control02.ctl';
Database altered.

3.9 检查是否全部迁移到asm磁盘组中
[oracle@p520:/oracle/app/oracle/admin/orcl/bdump]$rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Fri May 28 19:04:58 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1247702683)
RMAN> report schema;
using target database control file instead of recovery catalog
Report of database schema
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 300 SYSTEM *** +DGTEST/orcl/datafile/system.257.720209735
2 200 UNDOTBS1 *** +DGTEST/orcl/datafile/undotbs1.258.720209771
3 120 SYSAUX *** +DGTEST/orcl/datafile/sysaux.260.720209821
4 5 USERS *** +DGTEST/orcl/datafile/users.261.720209837
5 200 UNDOTBS2 *** +DGTEST/orcl/datafile/undotbs2.259.720209797

List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
2 100 TEMP 100 +DGTEST/orcl/tempfile/temp.264.720210427
数据文件已经全部迁移到asm磁盘组中
SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
+DGTEST/orcl/onlinelog/group_5.265.720210499
+DGTEST/orcl/onlinelog/group_5.266.720210503
+DGTEST/orcl/onlinelog/group_6.267.720210527
+DGTEST/orcl/onlinelog/group_6.268.720210531
+DGTEST/orcl/onlinelog/group_7.269.720210549
+DGTEST/orcl/onlinelog/group_7.270.720210553
+DGTEST/orcl/onlinelog/group_8.271.720210575
+DGTEST/orcl/onlinelog/group_8.272.720210579
日志文件已经全部迁移到asm磁盘组中
8 rows selected.


SQL> select name from v$tempfile;

NAME
--------------------------------------------------------------------------------
+DGTEST/orcl/tempfile/temp.264.720210427
临时数据文件已经全部迁移到asm磁盘组中

SQL> select name from v$controlfile;
NAME
+DGTEST/orcl/control01.ctl
+DGTEST/orcl/control02.ctl
控制文件已经全部迁移到asm磁盘组中

3.10 启动另外一节点
sqlplus “/as sysdba”
startup

迁移完毕

3.11 测试
两边节点关闭crs和重新启动crs
crsctl stop crs
crsctl start crs




上一篇:oracle出现resmgr:become active等待事件分析
下一篇:oracle 11gR2 rac 创建数据库database报ORA-00200错误
回复

使用道具 举报

1框架
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表