Chinaunix首页 | 论坛 | 博客
  • 博客访问: 390326
  • 博文数量: 58
  • 博客积分: 2096
  • 博客等级: 大尉
  • 技术积分: 608
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-29 16:09
个人简介

专注于数据库技术研究和实践,目前就职于互联网金融企业,提供Oracle数据库技术支持和维护。 联系电话:18616803656

文章分类

全部博文(58)

文章存档

2020年(1)

2019年(4)

2018年(1)

2017年(3)

2015年(4)

2014年(7)

2012年(1)

2011年(27)

2010年(8)

2009年(2)

我的朋友

分类: Oracle

2014-03-07 14:48:37

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                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                05-MAR-2014 14:53:01
Uptime                    1 days 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 this service...
 Instance "fxopt", status READY, has 1 handler(s) for this service...
Service "fxoptXDB" has 1 instance(s).
 Instance "fxopt", status READY, has 1 handler(s) for this service...
Service "fxopt_DGMGRL" has 1 instance(s).
 Instance "fxopt", status UNKNOWN, has 1 handler(s) for this service...
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 as physical;
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 connect identifier is primary;
Configuration "dgfxoptdb" created with primary database "fxopt"
DGMGRL> add database fxopt_std as connect identifier is standby maintained as 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 the broker 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, or fast-start failover
edit           Edits a configuration, database, or instance
enable         Enables a configuration, a database, or fast-start failover
exit           Exits the program
failover       Changes a standby database to be the primary database
help           Displays description and syntax for a command
quit           Exits the program
reinstate      Changes a database marked for reinstatement into a viable standby
rem            Comment to be ignored by DGMGRL
remove         Removes a configuration, database, or instance
show           Displays information about a configuration, database, or instance
shutdown       Shuts down a currently running Oracle database instance
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.

阅读(7137) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~