对Oracle数据库进行容灾
2008-12-16 13:02:33 来源:WEB开发网可以手工进行gracefully切换
root@lxsfrac01#umount/oracle
root@lxsfrac01#vradmin-goradgmigrateora_rvglxsfrac02-priv
VxVMVVRvradminWARNINGV-5-52-93MakesureapplicationsusingPrimarydatavolumesarestopped.
vradmin:Continuewithmigrate(y/n)?y
root@lxsfrac01#
下面我们就在上面搭建好的VVR环境中对容灾数据进行切换测试:
注:在下面测试中,主节点为lxsfrac02,备用节点为lxsfrac01
======================================显示主备节点状态=================================
root@lxsfrac02#vradmin-goradg-lrepstatusora_rvg
ReplicatedDataSet:ora_rvg
Primary:
Hostname:lxsfrac02-priv
RVGname:ora_rvg
DGname:oradg
RVGstate:enabledforI/O
Datavolumes:1
VSets:0
SRLname:srl
SRLsize:800.00M
Totalsecondaries:1
Secondary:
Hostname:lxsfrac01-priv
RVGname:ora_rvg
DGname:oradg
RlinkfromPrimary:rlk_lxsfrac01-priv_ora_rvg
RlinktoPrimary:rlk_lxsfrac02-priv_ora_rvg
Configuredmode:asynchronous
Latencyprotection:off
SRLprotection:autodcm
Datastatus:inconsistent
Replicationstatus:resyncinprogress(autosync)
Currentmode:asynchronous
Loggingto:DCM(contains5181696Kbytes)(autosync)
TimestampInformation:N/A
BandwidthLimit:N/A
====================================显示replicationlink状态=================================
root@lxsfrac02#vxrlink-goradgstatusrlk_lxsfrac01-priv_ora_rvg
MonNov0516:52:512007
VxVMVVRvxrlinkINFOV-5-1-4467Rlinkrlk_lxsfrac01-priv_ora_rvgisuptodate
====================================在主节点插入试验数据16:55================================
oracle@lxsfrac02$sysdba
SQL*Plus:Release10.2.0.1.0-ProductiononMonNov516:55:122007
Copyright(c)1982,2005,Oracle.Allrightsreserved.
Connectedto:
OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-Production
WiththePartitioning,OLAPandDataMiningoptions
SQL>createtabletest(avarchar(20))tablespaceusers;
Tablecreated.
SQL>insertintotestvalues('1');
1rowcreated.
SQL>commit;
Commitcomplete.
SQL>insertintotestvalues('2');
1rowcreated.
SQL>
SQL>
SQL>commit;
Commitcomplete.
======================================立即异常关闭oracle和操作系统============================
root@lxsfrac02#ps-ef|egrep"ora_|asm_"|grep-vgrep|grep-vcrs|awk'{print$2}'|xargskill-9
root@lxsfrac02#
root@lxsfrac02#ps-ef|grepora
root19301016:08:13?0:02/opt/VRTSobc/pal33/bin/vxpal-aStorageAgent-x
oracle1942019419016:55:12?0:00oracleracg1(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle1941419410016:55:11pts/30:00-bash
oracle1941919414016:55:12pts/30:00sqlplus/assysdba
root198723725016:56:49pts/20:00grepora
root@lxsfrac02#
root@lxsfrac02#poweroff
从系统日志/var/tmp/messages可以查看到相关信息:
Nov516:57:26lxsfrac02poweroff:[ID662345auth.crit]poweroffedbyroot
=======================================在备用节点进行接管=======================================
root@lxsfrac01#vradmin-goradgmigrateora_rvglxsfrac01-priv
VxVMVVRvradminWARNINGV-5-52-93MakesureapplicationsusingPrimarydatavolumesarestopped.
vradmin:Continuewithmigrate(y/n)?y
MessagefromHostlxsfrac01-priv:
VxVMVVRvradminERRORV-5-52-449Secondaryora_rvgdoesnothaveanactivePrimary.
root@lxsfrac01#
root@lxsfrac01#vradmin-goradgtakeoverora_rvg
root@lxsfrac01#date
MonNov517:05:13CST2007
root@lxsfrac01#vxprint-htqgoradg
dgoradgdefaultdefault100001193985774.38.lxsfrac01
dmAMS_WMS0_2AMS_WMS0_2auto655364116224-
dmAMS_WMS0_3AMS_WMS0_3auto65536146687968-
rvora_rvg1ENABLEDACTIVEprimary1srl
rlrlk_lxsfrac02-priv_ora_rvgora_rvgENABLEDACTIVElxsfrac02-privoradgrlk_lxsfrac01-priv_ora_rvg
voravolora_rvgENABLEDACTIVE20971520SELECT-fsgen
ploravol-01oravolENABLEDACTIVE20971520CONCAT-RW
sdAMS_WMS0_3-01oravol-01AMS_WMS0_30209715200AMS_WMS0_3ENA
ploravol-02oravolENABLEDACTIVELOGONLYCONCAT-RW
sdAMS_WMS0_2-01oravol-02AMS_WMS0_20352LOGAMS_WMS0_2ENA
ploravol-03oravolENABLEDACTIVELOGONLYCONCAT-RW
sdAMS_WMS0_3-03oravol-03AMS_WMS0_322609920352LOGAMS_WMS0_3ENA
vsrlora_rvgENABLEDACTIVE1638400SELECT-SRL
plsrl-01srlENABLEDACTIVE1638400CONCAT-RW
sdAMS_WMS0_3-02srl-01AMS_WMS0_32097152016384000AMS_WMS0_3ENA
root@lxsfrac01#
================================启动备用节点Oracle数据库,并检查数据完整========================
root@lxsfrac01#mount-Fvxfs/dev/vx/dsk/oradg/oravol/oracle
root@lxsfrac01#
root@lxsfrac01#su-oracle
SunMicrosystemsInc.SunOS5.10GenericJanuary2005
oracle@lxsfrac01$sysdba
SQL*Plus:Release10.2.0.1.0-ProductiononMonNov517:05:372007
Copyright(c)1982,2005,Oracle.Allrightsreserved.
Connectedtoanidleinstance.
SQL>startup
ORACLEinstancestarted.
TotalSystemGlobalArea2147483648bytes
FixedSize2120448bytes
VariableSize496870656bytes
DatabaseBuffers1644167168bytes
RedoBuffers4325376bytes
Databasemounted.
Databaseopened.
SQL>select*fromtest;
A
--------------------
1
2
================================ 显示数据正常 ===========================
在第二个节点vxdg import oradg
然后recover
直到两个节点vxprint -htqg oradg都正常:ENABLED/ACTIVE
3.错误V-5-1-434,我遇到了两次,一次是在createpri,一次在addsec,原因是主备的DCM默认都需要mirror,所以所在的磁盘组都最少包括两块磁盘(或LUN),通过vxdg -g oradg adddisk another_disk解决。
root@lxsfrac01 # vradmin -g oradg createpri ora_rvg >system,sysaux,temp,users,example,ctlfile1,ctlfile2,ctlfile3,redo101,redo102,redo103,undo11,spfile
>srl
MessagefromPrimary:
VxVMvxassistERRORV-5-1-434Cannotallocatespacefor32blocklog
root@lxsfrac01#vradmin-goradgaddsecora_rvglxsfrac01-privlxsfrac02-priv
MessagefromHostlxsfrac02-priv:
VxVMvxassistERRORV-5-1-434Cannotallocatespacefor352blocklog
4.检查vvr后台进程
root@lxsfrac02#ps-ef|grepvrad|grep-vgrep
root98081016:24:47?0:00/usr/sbin/vradmind
如果进程状态不对,使用下面语句来手工启动:
/etc/init.d/vras-vradmind.shstart
可以看到vradmin是随系统自启动的:
root@lxsfrac02#find/etc/rc*-name'*vr*'-print
/etc/rc0.d/K01vras-vradmind
/etc/rc1.d/K01vras-vradmind
/etc/rc2.d/S96vradmind
/etc/rcS.d/K01vras-vradmind
- ››oracle 中 UPDATE nowait 的使用方法
- ››Oracle ORA-12560解决方法
- ››Oracle 10g RAC 常用维护命令
- ››Oracle如何在ASM中定位文件的分布
- ››Oracle的DBMS_RANDOM.STRING 的用法
- ››oracle 外部表导入时间日期类型数据,多字段导入
- ››Oracle中查找重复记录
- ››oracle修改用户登录密码
- ››Oracle创建删除用户、角色、表空间、导入导出等命...
- ››Oracle中登陆时报ORA-28000: the account is lock...
- ››Oracle数据库在配置文件中更改最大连接数
- ››Oracle中在pl/sql developer修改表的两种方式
更多精彩
赞助商链接