Oracle 11gR2 Dataguard Broker配置

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:1542

Data Guard Broker

Oracle Data Guard Broker 是一个分布式管理框架,它不但自动化了 Data Guard 配置的创建、维护和监视,并对这些操作进行统一管理。可以通过 Oracle 企业管理器(它使用Broker)或 Broker 的专用命令行界面(DGMGRL) 执行所有管理操作。Data Guard Broker 11 g 还可以使用最大可用性或最佳性能模式将 Data Guard 配置为在数据库出现故障时自动切换。

Data Guard Broker· 使用最大可用性或最佳性能模式针对配置启用自动数据库故障切换。· 启用可配置事件来触发对目标备用数据库的即时自动切换。· 改善了对重做传输选项的支持,使管理员可以为重做传输服务指定连接描述。· 消除在最大可用性和最佳性能保护模式间更换的数据库停机时间。· 支持使用Oracle 集群件和冷故障切换集群针对高可用性配置单一实例数据库。
1. 主库Broker配置
1) 查询dg_broker_start参数
SQL> show parameter dg_broker_start;
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
dg_broker_start boolean FALSE

SQL> alter system set dg_broker_start = true;
System altered.

2) listener.ora文件中加入静态监听
$ vi $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File:/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.121)(PORT =1521))
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = fxopt)
(ORACLE_HOME = /app/sungard/oracle/product/11.2.0/dbhome_1)
(SID_NAME = fxopt)
)
(SID_DESC =
(GLOBAL_DBNAME = fxopt_DGMGRL)
(ORACLE_HOME = /app/sungard/oracle/product/11.2.0/dbhome_1)
(SID_NAME = fxopt)
)
)
ADR_BASE_LISTENER = /app/oracle

说明:
# GLOBAL_DBNAME具有固定的格式:_DGMGRL.。
这里一定要用DB_UNIQUE_NAME,否则会报错:
Starting instance "fxopt"...
Unable to connect to database
ORA-12170: TNS:Connect timeout occurred

Failed.
Warning: You are no longer connected to ORACLE.

Please complete the following steps to finish switchover:
start up instance "fxopt" of database"fxopt_std"

3) 重新载入监听配置
$ lsnrctl reload
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 07-MAR-2014 13:30:35
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.121)(PORT=1521)))
The command completed successfully

$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 07-MAR-2014 13:30:43
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.100.121)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNRfor Linux: Version 11.2.0.1.0 - Production
Start Date 05-MAR-201414:53:01
Uptime 1days 22 hr. 37 min. 48 sec
Trace Level off
Security ON:Local OS Authentication
SNMP OFF
Listener Parameter File /app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /app/oracle/diag/tnslsnr/awspre01/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.121)(PORT=1521)))
Services Summary...
Service "fxopt" has 2 instance(s).
Instance "fxopt", status UNKNOWN, has 1 handler(s) for thisservice...
Instance "fxopt", status READY, has 1 handler(s) for thisservice...
Service "fxoptXDB" has 1 instance(s).
Instance "fxopt", status READY, has 1 handler(s) for thisservice...
Service "fxopt_DGMGRL" has 1 instance(s).
Instance "fxopt", status UNKNOWN, has 1 handler(s) for thisservice...
The command completed successfully

2. 备库Broker配置
1) 查询dg_broker_start参数
SQL> show parameter dg_broker_start;
NAME TYPE VALUE
------------------------------------ ----------------------------------------------------
dg_broker_start boolean FALSE

SQL> alter system set dg_broker_start = true;
System altered.

2) listener.ora文件中加入静态监听
$ vi $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.122)(PORT =1521))
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = fxopt)
(ORACLE_HOME = /app/sungard/oracle/product/11.2.0/dbhome_1)
(SID_NAME = fxopt)
)
(SID_DESC =
(GLOBAL_DBNAME = fxopt_std_DGMGRL)
(ORACLE_HOME = /app/sungard/oracle/product/11.2.0/dbhome_1)
(SID_NAME = fxopt)
)
)
ADR_BASE_LISTENER = /app/oracle

3) 重新载入监听配置
$ lsnrctl reload
$ lsnrctl status

3. Broker配置(在主库上操作)
说明:dgmgrl可以安装到非主备库服务器上,因为但心主备库当掉,dgmgrl也当掉,无法对主备进行监控。
可以在第三方主机上安装oracle客户端,配置连接主备库的tnsname.ora服务器,即可远程启动dgmgrl进程。

另外,在配置Broker的时候需要使用DB_UNIQUE_NAME,所以如果DB_UNIQUE_NAME相同的情况下,在添加备库到配置库的时候会报错:
DGMGRL> add database fxopt as connect identifier is standby maintained asphysical;
Error: ORA-16642: DB_UNIQUE_NAME mismatch.
也不确定相同DB_UNIQUE_NAME的情况下能不能配Broker,如果有知道的朋友请留言!在此先谢!

1) 配置Broker
$ dgmgrl sys/oracle
DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> create configuration DGFXOPTDB as primary database is fxopt connectidentifier is primary;
Configuration "dgfxoptdb" created with primary database"fxopt"
DGMGRL> add database fxopt_std as connect identifier is standby maintainedas physical;
Database "fxopt_std" added
DGMGRL> enable configuration
Enabled.
DGMGRL> show configuration;
Configuration - dgfxoptdb
Protection Mode: MaxAvailability
Databases:
fxopt - Primary database
fxopt_std - Physical standby database
Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL> show database fxopt
Database - fxopt
Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
fxopt

Database Status:
SUCCESS

DGMGRL> show database fxopt_std
Database - fxopt_std
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Real Time Query: ON
Instance(s):
fxopt

Database Status:
SUCCESS

2) DGMGRL命令
$ dgmgrl
DGMGRL for 32-bit Windows: Version 11.2.0.1.0 - Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> help
The following commands are available:
add Adds a standby database to thebroker configuration
connect Connects to an Oracle database instance
convert Converts a database from one type to another
create Creates a broker configuration
disable Disables a configuration, a database, orfast-start failover
edit Edits a configuration, database, orinstance
enable Enables a configuration, a database, orfast-start failover
exit Exits the program
failover Changes a standby database to be the primarydatabase
help Displays description and syntax for acommand
quit Exits the program
reinstate Changes a database marked for reinstatement intoa viable standby
rem Comment to be ignored by DGMGRL
remove Removes a configuration, database, orinstance
show Displays information about aconfiguration, database, or instance
shutdown Shuts down a currently running Oracle databaseinstance
start Starts the fast-start failover observer
startup Starts an Oracle database instance
stop Stops the fast-start failover observer
switchover Switches roles between a primary and standby database

Use "help " to see syntax for individual commands.

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】