Home >Database >Mysql Tutorial >DG之物理Standby的failover
1.检查归档文件是否连续 ORCLPRE: ORCLPRE_STD startup ORACLE instance started. Total System Global Area 167772160 bytes Fixed Size 1218316 bytes Variable Size 75499764 bytes Database Buffers 88080384 bytes Redo Buffers 2973696 bytes Database
1.检查归档文件是否连续
ORCLPRE:
ORCLPRE_STD >startup
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 75499764 bytes
Database Buffers 88080384 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
ORCLPRE_STD >select thread#,low_sequence#,high_sequence# from v$archive_gap;
no rows selected
若有记录,把列出的记录号对应的归档转换到待转换的Standby,不然数据会不一致。并加入数据字典(Alter database register physical logfile 'filespecl')
2.检查归档文件是否完整
ORCLPRE_STD >select distinct thread#,max(sequence#) over(partition by thread#) A from v$archived_log;
THREAD# A
---------- ----------
1 39
ORCLPDG:
ORCLPDG_PRI >startup
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 62916852 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
ORCLPDG_PRI >select distinct thread#,max(sequence#) over(partition by thread#) A from v$archived_log;
THREAD# A
---------- ----------
1 39
若最大序号不同,需要复制到待转换的Standby。
3.启动failover
ORCLPRE_STD >alter database recover managed standby database finish force;//force停止当前活动的RFS进程(RFS是REDO传输服务)。
Database altered.
4.切换物理Standby为Primary
ORCLPRE_STD >alter database commit to switchover to primary;
Database altered.
5.启动新的Primary
ORCLPRE_STD >select status from v$instance;
STATUS
------------
STARTED
ORCLPRE_STD >alter database open;
alter database open
*
ERROR at line 1:
ORA-01507: database not mounted
ORCLPRE_STD >shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
ORCLPRE_STD >startup
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 75499764 bytes
Database Buffers 88080384 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
ORCLPRE_STD >select * from scott.test;
ID
----------
1
2
3
4
5
6
6 rows selected.