背景需求:有时候手工切换ADG,步骤繁琐,麻烦。这里介绍oracle自带的broker工具的快捷切换以及它的failover特性
前提:
配置好了DG(ADG)
安装了oracle软件(一般都安装了)
1:配置监听(添加下面内容)
(SID_DESC =
(GLOBAL_DBNAME=dg1_DGMGRL)
(ORACLE_HOME = /u01/oracle/11g)
(SID_NAME =orcl)
)
2:启动broken(主库和备库都切换)
alter system set dg_broker_start=true;
3:开启闪回(主库和备库都开启)
主库
SQL> alter database flashback on;
Database altered.
SQL> select open_mode,database_role,log_mode,flashback_on from v$database;
OPEN_MODE DATABASE_ROLE LOG_MODE FLASHBACK_ON
-------------------- ---------------- ------------ ------------------
READ WRITE PRIMARY ARCHIVELOG YES
备库
SQL> select database_role from v$database;
DATABASE_ROLESQL> recover managed standby database cancel;
Media recovery complete.
SQL> alter database flashback on;
Database altered.
SQL> recover managed standby database using current logfile disconnect;
Media recovery complete.
SQL> select open_mode,database_role,log_mode,flashback_on from v$database;
OPEN_MODE DATABASE_ROLE LOG_MODE FLASHBACK_ON
-------------------- ---------------- ------------ ------------------
READ ONLY WITH APPLY PHYSICAL STANDBY ARCHIVELOG YES
----------------
PHYSICAL STANDBY
开始配置Broker
1:创建主库配置
[oracle@ADG1 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/manager@dg1
Connected.
DGMGRL> help create
Creates a broker configuration
Syntax:
CREATE CONFIGURATION <configuration name> AS
PRIMARY DATABASE IS <database name>
CONNECT IDENTIFIER IS <con