1.环境介绍
源端环境:
oracle windows x86_64 11.2.0.1
目标端环境:
oracle linux x86_64 11.2.0.4
2.创建备库
原本想使用oracle duplicate进行复制创建物理dataguard,但是发现有报错ORA-17627和ORA-12577:
Errors in file d:\app\administrator\diag\rdbms\oracle\oracle\trace\oracle_ora_6012.trc:
ORA-17627: ORA-12577: Message 12577 not found; product=RDBMS; facility=ORA
Tue Apr 23 18:37:02 2019
通过搜索MOS,发现文章:
RMAN Duplicate Database from Active Primary fails with Ora-17627: Ora-12577: Message 12577 Not Found; Product=Rdbms; Facility=Ora (文档 ID 1344615.1)
这里提到了可能是不一致的word size导致的:
CAUSE
Different 'Word Size' between Primary/Standby
eg:
Primary OS Details Redhat Linux 5 64-bits
Standby OS Details Redhat Linux 4 32-bits
解决办法是使用rman的备份恢复来创建备库:
SOLUTION
Use RMAN duplicate database based on backup.
所以这里使用rman备份恢复的方式进行恢复.
注意这里发现一个小细节,我们在dg端修改参数:db_file_name_convert和log_file_name_convert
的时候,例如:
D:\APP\ADMINISTRATOR\ORADATA\ORACLE, /u01/oradata/oracle
这里我们如果不在最后的末尾将目录分隔符也替换,那么在linux上存放的目录会有问题,不是你想要的目录,如下:
Full restore complete of datafile 5 to datafile copy /u01/oradata/oracleKYEECIS.DBF. Elapsed time: 0:00:00
所以这里正确的写法为:
D:\APP\ADMINISTRATOR\ORADATA\ORACLE\, /u01/oradata/oracle/
后面带上目录分割符号,并且注意大小写,windows端必须是大写.
3.开启实时应用
standby:
alter database recover managed standby database using current logfile disconnect from session; 检查应用的延时:
select name,value,TIME_COMPUTED,DATUM_TIME from v$dataguard_stats;
4.主备切换
如果是switchover:
primary:
alter database commit to switchover to physical standby with session shutdown;
standby:
alter database commit to switchover to primary with session shutdown;
如果是failover:
standby:
alter database recover managed standby database finish force;
alter database commit to switchover to primary;
5.数据库升级
standby:
alter database open upgrade;
升级数据字典:
@$?/rdbms/admin/catupgrd.sql
这一步比较耗时,我这里执行了15分钟.
6.编译无效对象
编译无效对象:
SQL>startup
@?/rdbms/admin/utlrp
这一步根据数据库对象的多少耗时不定.
到此升级完成.