配置data guard broker配置文件基本参数
每个数据库中都会维护两份配置文件,这样能保证任何时候我们都有一个可用的配置文件存在,两份配置文件的位置和名字根据系统参数 DG_BROKER_CONFIG_FILE1,DG_BROKER_CONFIG_FILE2决定,如果没有设置将使用默认的值来创建。在设置这两个参 数的时候需要注意下面几个问题:
- RAC系统中每个数据库实例中的参数设置必须是一致的。
- 只有在broker没有运行的时候才能修改此参数,即DG_BROKER_START=FALSE的时候。
- These parameters must specify a raw device, ASM file, or cluster file system file that resolves to the same set of physical files for all RAC instances.
在修改DG_BROKER_CONFIG_FILEn的时候,如果指向的配置文件不是放在裸设备上的话不需要其他的更多的操作,重新启动DMON进 程(设置DG_BROKER_START=TRUE)之后会自动的生成配置文件,如果配置放在裸设备上则需要手工的将配置文件的内容从旧的位置复制到新位 置上。
启动data guard broker
只需要将初始化参数DG_BROKER_START设置为TRUE则系统会自动的启动DMON进程,将其设置为FALSE之后则DMON进程会自动退出。
-- 设置为TRUE
SYS@torcla> alter system set dg_broker_start=true;
System altered.
-- 再看进程能看到ora_dmon_torcla已经启用
SYS@torcla> !ps -ef|grep dmon_torcla| grep -v grep
oracle 10665 1 003:57 ? 00:00:00 ora_dmon_torcla
-- 再给他设置成FALSE
SYS@torcla> alter system set dg_broker_start =false;
System altered.
-- 再看DMON进程已经不见了
SYS@torcla> !ps -ef|grep dmon_torcla|grep -v grep
data guard broker的管理周期
data guard broker的管理周期 |
data guard broker状态查看
在DGMGRL中可以通过show configuration命令查看broker当前的状态信息,如下:
oracle@orainst[torclb]:~
$dgmgrl sys/12345@torclb.mycompany
DGMGRL for Linux: Version 10.2.0.2.0 - Production
Copyright(c)2000, 2005, Oracle. All rightsreserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration
Configuration
Name: FSF
Enabled: YES
ProtectionMode: MaxPerformance
Fast-Start Failover: DISABLED
Databases:
torcla - Physical standby database
torclb - Primary database
Current status for "FSF":
SUCCESS
broker一共有下面4种状态:
Normal正常,没有任何的警告和错误。Warning一个或多个数据库工作不正常,但是broker还能发挥作用,需要用show命令进一步查看。Error一个或多个数据库存在错误的配置或无法正常操作,需要用show命令进一步查看。Unknown/Disabledbroker被禁用,在这种情况broker是不会监控配置中的数据库的。
禁用和启动操作
禁用和启用操作分为两个层次的,第一个层次是数据库级别的,对应于ENABLE/DISABLE DATABASE命令,受影响的是被操作的数据库,另一个层次是配置级别的,对应于ENABLE/DISABLE CONFIGURATION命令,影响的是被broker管理的所有的数据库。但是不管是什么级别的禁用/启用操作都是影响的DMON进程对于受影响数据 库的下列操作:
- 管理和监控受影响的数据库
- 管理受影响的数据库的配置信息,比如说通过DGMGRL修改数据库参数什么的。
注意:
- 禁用操作并不会影响data guard的正常运行,日志传送服务或是日志应用服务等等就还是正常的工作的。
- 被禁用的数据库的配置信息并不会从broker配置信息中删除,只是相应数据库的状态信息改变了而已。
- 如果在禁用的状态下更改了数据库的属性,那在启用操作执行之前这些被更改的属性将不能被应用到对应的数据库的,但是启动配置之后这些更改将会马上的被应用到数据库中。
DGMGRL> disable configuration
Disabled.
DGMGRL> show configuration
Configuration
Name: FSF
Enabled: NO
Protection Mode: MaxPerformance
Fast-Start Failover: DISABLED
Databases:
torcla - Physical standby database
torclb - Primary database
Current status for "FSF":
DISABLED
DGMGRL> enable configuration
Enabled.
DGMGRL> show configuration
Configuration
Name: FSF
Enabled: YES
Protection Mode: MaxPerformance
Fast-Start Failover: DISABLED
Databases:
torcla - Physical standby database
torclb - Primary database
Current status for "FSF":
SUCCESS
enable configuration的时候broker会重新设定数据库的很多系统的初始化参数,确保数据库运行的参数和broker配置文件中所设定的是一致 的,这些动作我们可以从broker monitoring的日志DRCdb_unique_name.log里面看到,这个日志文件存放位置和alert.log是一样的,下面是 primary数据库上的一部分日志示例:
DG 2009-08-31-06:30:16 020 Set logtransportdestination: SetStateONLINE, phaseBUILD-UP, ExternalCondENABLE
DG 2009-08-31-06:30:16 020 Executing SQL [altersystemsetlog_archive_dest_2 = 'service="(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=orainst.desktop.mycompany.com)(PORT=8000)))(CONNECT_DATA=(SERVICE_NAME=torcla_XPT.mycompany)(INSTANCE_NAME=torcla)(SERVER=dedicated)))"', ' LGWR SYNC AFFIRM delay=0 OPTIONAL max_failure=0 max_connections=1 reopen=300 db_unique_name="torcla" register net_timeout=180 valid_for=(online_logfile,primary_role)']
DG 2009-08-31-06:30:16 020 SQL [altersystemsetlog_archive_dest_2 = 'service="(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=orainst.desktop.mycompany.com)(PORT=8000)))(CONNECT_DATA=(SERVICE_NAME=torcla_XPT.mycompany)(INSTANCE_NAME=torcla)(SERVER=dedicated)))"', ' LGWR SYNC AFFIRM delay=0 OPTIONAL max_failure=0 max_connections=1 reopen=300 db_unique_name="torcla" register net_timeout=180 valid_for=(online_logfile,primary_role)']Executedsuccessfully
DG2009-08-31-06:30:16 020ExecutingSQL [altersystemsetlog_archive_dest_state_2 = 'ENABLE']
DG2009-08-31-06:30:16 020SQL [altersystemsetlog_archive_dest_state_2 = 'ENABLE']Executedsuccessfully
DG2009-08-31-06:30:16 020Settinginit.oraparameterwithSQL[ALTERSYSTEMSETlog_archive_trace=0SCOPE=BOTHsid='torclb']
DG2009-08-31-06:30:16 020ExecutingSQL[ALTERSYSTEMSETlog_archive_trace=0SCOPE=BOTHsid='torclb']
DG2009-08-31-06:30:16 020SQL [ALTERSYSTEMSETlog_archive_trace=0SCOPE=BOTHsid='torclb']Executedsuccessfully
DG2009-08-31-06:30:16 020Settinginit.oraparameterwithSQL[ALTERSYSTEMSETlog_archive_format='log-%s-%t-%r.arc'SCOPE=SPFILEsid='torclb']
DG2009-08-31-06:30:16 020ExecutingSQL [ALTERSYSTEMSETlog_archive_format='log-%s-%t-%r.arc'SCOPE=SPFILEsid='torclb']
DG2009-08-31-06:30:16 020SQL [ALTERSYSTEMSETlog_archive_format='log-%s-%t-%r.arc'SCOPE=SPFILEsid='torclb'] Executedsuccessfully
DG2009-08-31-06:30:16 020ExecutingSQL[ALTERSYSTEMSETstandby_archive_dest=''SCOPE=BOTHsid='torclb']
DG2009-08-31-06:30:16 020SQL [ALTERSYSTEMSETstandby_archive_dest=''SCOPE=BOTHsid='torclb']Executedsuccessfully
DG2009-08-31-06:30:16 020Settinginit.oraparameterwithSQL[ALTERSYSTEMSETstandby_file_management='MANUAL'SCOPE=BOTHsid='*']
DG2009-08-31-06:30:16 020ExecutingSQL[ALTERSYSTEMSETstandby_file_management='MANUAL'SCOPE=BOTHsid='*']
DG2009-08-31-06:30:16 020SQL[ALTERSYSTEMSETstandby_file_management='MANUAL'SCOPE=BOTHsid='*'] Executedsuccessfully
DG2009-08-31-06:30:16 020Settinginit.oraparameterwithSQL[ALTERSYSTEMSETarchive_lag_target=3600SCOPE=BOTHsid='*']
DG2009-08-31-06:30:16 020ExecutingSQL[ALTERSYSTEMSETarchive_lag_target=3600SCOPE=BOTHsid='*']
DG2009-08-31-06:30:16 020SQL [ALTERSYSTEMSETarchive_lag_target=3600SCOPE=BOTHsid='*']Executedsuccessfully
DG2009-08-31-06:30:16 020Settinginit.oraparameterwithSQL[ALTERSYSTEMSETlog_archive_max_processes=2SCOPE=BOTHsid='*']
DG2009-08-31-06:30:16 020ExecutingSQL[ALTERSYSTEMSETlog_archive_max_processes=2SCOPE=BOTHsid='*']
DG2009-08-31-06:30:16 020SQL[ALTERSYSTEMSETlog_archive_max_processes=2SCOPE=BOTHsid='*'] Executedsuccessfully
DG2009-08-31-06:30:16 020Settinginit.oraparameterwithSQL[ALTERSYSTEMSETlog_archive_min_succeed_dest=1SCOPE=BOTHsid='*']
DG2009-08-31-06:30:16 020ExecutingSQL[ALTERSYSTEMSETlog_archive_min_succeed_dest=1SCOPE=BOTHsid='*']
DG2009-08-31-06:30:16 020SQL[ALTERSYSTEMSETlog_archive_min_succeed_dest=1SCOPE=BOTHsid='*'] Executedsuccessfully
DG2009-08-31-06:30:16 020Settinginit.oraparameterwithSQL[ALTERSYSTEMSETdb_file_name_convert="torcla","torclb"SCOPE=SPFILE]
DG2009-08-31-06:30:16 020ExecutingSQL[ALTERSYSTEMSETdb_file_name_convert="torcla","torclb"SCOPE=SPFILE]
DG2009-08-31-06:30:16 020SQL[ALTERSYSTEMSETdb_file_name_convert="torcla","torclb"SCOPE=SPFILE] Executedsuccessfully
DG2009-08-31-06:30:16 020Settinginit.oraparameterwithSQL[ALTERSYSTEMSETlog_file_name_convert="torcla","torclb"SCOPE=SPFILE]
DG2009-08-31-06:30:16 020ExecutingSQL[ALTERSYSTEMSETlog_file_name_convert="torcla","torclb"SCOPE=SPFILE]
DG2009-08-31-06:30:16 020SQL[ALTERSYSTEMSETlog_file_name_convert="torcla","torclb"SCOPE=SPFILE] Executedsuccessfully
DG2009-08-31-06:30:16 020DatabaseResourceSetStatesucceeded
DG2009-08-31-06:30:16 020RSM0receivedSETSTATErequest: rid=0x01041000, sid=1, phid=2, econd=7,sitehndl=0x7fffffff
DG2009-08-31-06:30:16 020LogTransportResource: SetStateONLINE, phaseBUILD-UP,ExternalCondENABLE
DG2009-08-31-06:30:16 020ExecutingSQL [ALTERSYSTEMARCHIVELOGCURRENT]
DG2009-08-31-06:30:23 020SQL [ALTERSYSTEMARCHIVELOGCURRENT] Executedsuccessfully
参考至:http://www.dbabeta.com/2009/learn-data-guard-broker_broker-configuration.html
如有错误,欢迎指正
邮箱:czmcj@163.com
作者:czmmiao 文章出处:http://czmmiao.iteye.com/blog/2124856