oracle data guard broker配置与使用(上)
2017-07-24 17:18
435 查看
背景需求:有时候手工切换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 <connect identifier>;
DGMGRL> create configuration dg as primary database is dg1 connect identifier is dg1;
Configuration "dg" created with primary database "dg1"
2:添加备库配置
DGMGRL> help add
Adds a standby database to the broker configuration
Syntax:
ADD DATABASE <database name>
[AS CONNECT IDENTIFIER IS <connect identifier>]
[MAINTAINED AS {PHYSICAL|LOGICAL}];
DGMGRL> add database dg2 as connect identifier is dg2;
Database "dg2" added
3:生效配置参数
DGMGRL> enable configuration
Enabled.
4:显示配置参数
DGMGRL> show configuration
Configuration - dg
Protection Mode: MaxPerformance
Databases:
dg1 - Primary database
dg2 - Physical standby database
Warning: ORA-16792: configurable property value is inconsistent with database setting
Fast-Start Failover: DISABLED
Configuration Status:
WARNING
Note:出现警告,配置参数值不正确
查看报错信息
DGMGRL> show database dg2 statusreport
STATUS REPORT
INSTANCE_NAME SEVERITY ERROR_TEXT
orcl WARNING ORA-16714: the value of property ArchiveLagTarget is inconsistent with the database setting
orcl WARNING ORA-16714: the value of property LogArchiveMaxProcesses is inconsistent with the database setting
orcl WARNING ORA-16714: the value of property LogArchiveMinSucceedDest is inconsistent with the database setting
orcl WARNING ORA-16714: the value of property LogArchiveTrace is inconsistent with the database setting
orcl WARNING ORA-16714: the value of property LogArchiveFormat is inconsistent with the database setting
DGMGRL> show database dg1 statusreport
STATUS REPORT
INSTANCE_NAME SEVERITY ERROR_TEXT
Note:DG2(备库)报归档格式不识别
解决方法:
主库
SQL> show parameter format;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_format string %t_%s_%r.dbf
备库
SQL> show parameter format;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_format string %t_%s_%r.dbf
Note:不知道为什么报此错误
更新一下配置的格式
DGMGRL> edit database dg2 set property LogArchiveFormat='%t_%s_%r.dbf';
DGMGRL> enable configuration
Enabled.
DGMGRL> show configuration
Configuration - dg
Protection Mode: MaxPerformance
Databases:
dg1 - Primary database
dg2 - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
5:查看主库所有的参数配置
DGMGRL> show database verbose dg1
Database - dg1
Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
orcl
Properties:
DGConnectIdentifier = 'dg1'
ObserverConnectIdentifier = ''
LogXptMode = 'ASYNC'
DelayMins
4000
= '0'
Binding = 'optional'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '300'
NetTimeout = '30'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '4'
LogArchiveMinSucceedDest = '1'
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
ApplyLagThreshold = '0'
TransportLagThreshold = '0'
TransportDisconnectedThreshold = '30'
SidName = 'orcl'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.200)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=dg1_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/home/standbylog'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'
Database Status:
SUCCESS
6:查看备库的所有参数配置
DGMGRL> show database verbose dg2;
Database - dg2
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
Apply Rate: 0 Byte/s
Real Time Query: ON
Instance(s):
orcl
Properties:
DGConnectIdentifier = 'dg2'
ObserverConnectIdentifier = ''
LogXptMode = 'SYNC'
DelayMins = '0'
Binding = 'OPTIONAL'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '300'
NetTimeout = '30'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ApplyParallel = 'AUTO'
StandbyFileManagement = 'AUTO'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '4'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = ''
LogFileNameConvert = ''
FastStartFailoverTarget = 'dg1'
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
ApplyLagThreshold = '0'
TransportLagThreshold = '0'
TransportDisconnectedThreshold = '30'
SidName = 'orcl'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.201))(CONNECT_DATA=(SERVICE_NAME=dg2_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/home/standbylog'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'
Database Status:
SUCCESS
7:开启failover
DGMGRL> ENABLE FAST_START FAILOVER;
Error: ORA-16651: requirements not met for enabling fast-start failover
Note:没有满足需求
开启dg1的sync同步模式
DGMGRL> edit database dg1 set property LogXptMode='SYNC';
Property "logxptmode" updated
更改为最大可用性
DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;
Succeeded.
DGMGRL> show configuration;
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg1 - Primary database
dg2 - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
8:再次开启failover
DGMGRL> ENABLE FAST_START FAILOVER;
Enabled.
DGMGRL> show configuration;
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg1 - Primary database
Warning: ORA-16819: fast-start failover observer not started
dg2 - (*) Physical standby database
Warning: ORA-16819: fast-start failover observer not started
Fast-Start Failover: ENABLED
Configuration Status:
WARNING
Note:报错没有开启观察进程
9:设置阈值为10
DGMGRL> EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold = 10;
Property "faststartfailoverthreshold" updated
开启观察进程
DGMGRL> start observer;
Observer started
再次查看配置
DGMGRL> show configuration;
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg1 - Primary database
dg2 - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
配置完成
前提:
配置好了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 <connect identifier>;
DGMGRL> create configuration dg as primary database is dg1 connect identifier is dg1;
Configuration "dg" created with primary database "dg1"
2:添加备库配置
DGMGRL> help add
Adds a standby database to the broker configuration
Syntax:
ADD DATABASE <database name>
[AS CONNECT IDENTIFIER IS <connect identifier>]
[MAINTAINED AS {PHYSICAL|LOGICAL}];
DGMGRL> add database dg2 as connect identifier is dg2;
Database "dg2" added
3:生效配置参数
DGMGRL> enable configuration
Enabled.
4:显示配置参数
DGMGRL> show configuration
Configuration - dg
Protection Mode: MaxPerformance
Databases:
dg1 - Primary database
dg2 - Physical standby database
Warning: ORA-16792: configurable property value is inconsistent with database setting
Fast-Start Failover: DISABLED
Configuration Status:
WARNING
Note:出现警告,配置参数值不正确
查看报错信息
DGMGRL> show database dg2 statusreport
STATUS REPORT
INSTANCE_NAME SEVERITY ERROR_TEXT
orcl WARNING ORA-16714: the value of property ArchiveLagTarget is inconsistent with the database setting
orcl WARNING ORA-16714: the value of property LogArchiveMaxProcesses is inconsistent with the database setting
orcl WARNING ORA-16714: the value of property LogArchiveMinSucceedDest is inconsistent with the database setting
orcl WARNING ORA-16714: the value of property LogArchiveTrace is inconsistent with the database setting
orcl WARNING ORA-16714: the value of property LogArchiveFormat is inconsistent with the database setting
DGMGRL> show database dg1 statusreport
STATUS REPORT
INSTANCE_NAME SEVERITY ERROR_TEXT
Note:DG2(备库)报归档格式不识别
解决方法:
主库
SQL> show parameter format;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_format string %t_%s_%r.dbf
备库
SQL> show parameter format;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_format string %t_%s_%r.dbf
Note:不知道为什么报此错误
更新一下配置的格式
DGMGRL> edit database dg2 set property LogArchiveFormat='%t_%s_%r.dbf';
DGMGRL> enable configuration
Enabled.
DGMGRL> show configuration
Configuration - dg
Protection Mode: MaxPerformance
Databases:
dg1 - Primary database
dg2 - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
5:查看主库所有的参数配置
DGMGRL> show database verbose dg1
Database - dg1
Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
orcl
Properties:
DGConnectIdentifier = 'dg1'
ObserverConnectIdentifier = ''
LogXptMode = 'ASYNC'
DelayMins
4000
= '0'
Binding = 'optional'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '300'
NetTimeout = '30'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '4'
LogArchiveMinSucceedDest = '1'
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
ApplyLagThreshold = '0'
TransportLagThreshold = '0'
TransportDisconnectedThreshold = '30'
SidName = 'orcl'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.200)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=dg1_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/home/standbylog'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'
Database Status:
SUCCESS
6:查看备库的所有参数配置
DGMGRL> show database verbose dg2;
Database - dg2
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
Apply Rate: 0 Byte/s
Real Time Query: ON
Instance(s):
orcl
Properties:
DGConnectIdentifier = 'dg2'
ObserverConnectIdentifier = ''
LogXptMode = 'SYNC'
DelayMins = '0'
Binding = 'OPTIONAL'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '300'
NetTimeout = '30'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ApplyParallel = 'AUTO'
StandbyFileManagement = 'AUTO'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '4'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = ''
LogFileNameConvert = ''
FastStartFailoverTarget = 'dg1'
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
ApplyLagThreshold = '0'
TransportLagThreshold = '0'
TransportDisconnectedThreshold = '30'
SidName = 'orcl'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.201))(CONNECT_DATA=(SERVICE_NAME=dg2_DGMGRL)(INSTANCE_NAME=orcl)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/home/standbylog'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'
Database Status:
SUCCESS
7:开启failover
DGMGRL> ENABLE FAST_START FAILOVER;
Error: ORA-16651: requirements not met for enabling fast-start failover
Note:没有满足需求
开启dg1的sync同步模式
DGMGRL> edit database dg1 set property LogXptMode='SYNC';
Property "logxptmode" updated
更改为最大可用性
DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;
Succeeded.
DGMGRL> show configuration;
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg1 - Primary database
dg2 - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
8:再次开启failover
DGMGRL> ENABLE FAST_START FAILOVER;
Enabled.
DGMGRL> show configuration;
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg1 - Primary database
Warning: ORA-16819: fast-start failover observer not started
dg2 - (*) Physical standby database
Warning: ORA-16819: fast-start failover observer not started
Fast-Start Failover: ENABLED
Configuration Status:
WARNING
Note:报错没有开启观察进程
9:设置阈值为10
DGMGRL> EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold = 10;
Property "faststartfailoverthreshold" updated
开启观察进程
DGMGRL> start observer;
Observer started
再次查看配置
DGMGRL> show configuration;
Configuration - dg
Protection Mode: MaxAvailability
Databases:
dg1 - Primary database
dg2 - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
配置完成
相关文章推荐
- oracle data guard broker配置与使用(下)
- Oracle 10g Data Guard Broker 配置文档
- Oracle 10g Data Guard Broker 配置文档
- Managing EBS 12 Physical Standby Databases with Oracle Data Guard Broker
- Oracle 11g Data Guard Broker Switchover Fast_start Failover
- Data Guard Broker配置篇
- Data Guard Broker配置
- 配置data guard broker时遇到的几个问题
- Data Guard Broker配置与主备库切换指南
- Oracle Data Guard 重要配置参数
- Oracle Data Guard fast-start failover配置与应用
- oracle数据库高可用配置之Data Guard(DG)基础配置
- Oracle 11gR2 Active Data Guard 配置 (windows 环境)
- Oracle 11G Physical Standby Database Active Data Guard - 安装配置
- [Oracle维护工程师手记]Data Guard Broker中改属性是否需要两侧分别执行?
- Oracle 11g Data Guard Broker操作笔记
- Data Guard Broker配置与主备库切换指南
- Oracle Data Guard的配置
- Oracle Data Pump 工具系列:Data Pump 使用权限配置详解
- Oracle 10.2.0.3.0 Data Guard windows配置