Data Guard Broker系列之三:Data Guard Broker配置管理

配置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   0 03 : 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的管理周期

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 rights reserved .
 
Welcome to DGMGRL , type " help " for information .
Connected .
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

broker一共有下面4种状态:

Normal
正常,没有任何的警告和错误。
Warning
一个或多个数据库工作不正常,但是broker还能发挥作用,需要用show命令进一步查看。
Error
一个或多个数据库存在错误的配置或无法正常操作,需要用show命令进一步查看。
Unknown/Disabled
broker被禁用,在这种情况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         0 2 0 Set log transport destination : SetState ONLINE , phase BUILD - UP , External Cond ENABLE
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Executing SQL [ alter system set log_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         0 2 0 SQL [ alter system set log_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) ' ] Executed successfully
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Executing SQL [ alter system set log_archive_dest_state_2 = ' ENABLE ' ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 SQL [ alter system set log_archive_dest_state_2 = ' ENABLE ' ] Executed successfully
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Setting init . ora parameter with SQL [ ALTER SYSTEM SET log_archive_trace = 0 SCOPE = BOTH sid = ' torclb ' ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Executing SQL [ ALTER SYSTEM SET log_archive_trace = 0 SCOPE = BOTH sid = ' torclb ' ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 SQL [ ALTER SYSTEM SET log_archive_trace = 0 SCOPE = BOTH sid = ' torclb ' ] Executed successfully
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Setting init . ora parameter with SQL [ ALTER SYSTEM SET log_archive_format = ' log-%s-%t-%r.arc ' SCOPE = SPFILE sid = ' torclb ' ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Executing SQL [ ALTER SYSTEM SET log_archive_format = ' log-%s-%t-%r.arc ' SCOPE = SPFILE sid = ' torclb ' ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 SQL [ ALTER SYSTEM SET log_archive_format = ' log-%s-%t-%r.arc ' SCOPE = SPFILE sid = ' torclb ' ] Executed successfully
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Executing SQL [ ALTER SYSTEM SET standby_archive_dest = '' SCOPE = BOTH sid = ' torclb ' ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 SQL [ ALTER SYSTEM SET standby_archive_dest = '' SCOPE = BOTH sid = ' torclb ' ] Executed successfully
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Setting init . ora parameter with SQL [ ALTER SYSTEM SET standby_file_management = ' MANUAL ' SCOPE = BOTH sid = ' * ' ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Executing SQL [ ALTER SYSTEM SET standby_file_management = ' MANUAL ' SCOPE = BOTH sid = ' * ' ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 SQL [ ALTER SYSTEM SET standby_file_management = ' MANUAL ' SCOPE = BOTH sid = ' * ' ] Executed successfully
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Setting init . ora parameter with SQL [ ALTER SYSTEM SET archive_lag_target = 3600 SCOPE = BOTH sid = ' * ' ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Executing SQL [ ALTER SYSTEM SET archive_lag_target = 3600 SCOPE = BOTH sid = ' * ' ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 SQL [ ALTER SYSTEM SET archive_lag_target = 3600 SCOPE = BOTH sid = ' * ' ] Executed successfully
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Setting init . ora parameter with SQL [ ALTER SYSTEM SET log_archive_max_processes = 2 SCOPE = BOTH sid = ' * ' ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Executing SQL [ ALTER SYSTEM SET log_archive_max_processes = 2 SCOPE = BOTH sid = ' * ' ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 SQL [ ALTER SYSTEM SET log_archive_max_processes = 2 SCOPE = BOTH sid = ' * ' ] Executed successfully
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Setting init . ora parameter with SQL [ ALTER SYSTEM SET log_archive_min_succeed_dest = 1 SCOPE = BOTH sid = ' * ' ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Executing SQL [ ALTER SYSTEM SET log_archive_min_succeed_dest = 1 SCOPE = BOTH sid = ' * ' ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 SQL [ ALTER SYSTEM SET log_archive_min_succeed_dest = 1 SCOPE = BOTH sid = ' * ' ] Executed successfully
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Setting init . ora parameter with SQL [ ALTER SYSTEM SET db_file_name_convert = " torcla " , " torclb " SCOPE = SPFILE ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Executing SQL [ ALTER SYSTEM SET db_file_name_convert = " torcla " , " torclb " SCOPE = SPFILE ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 SQL [ ALTER SYSTEM SET db_file_name_convert = " torcla " , " torclb " SCOPE = SPFILE ] Executed successfully
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Setting init . ora parameter with SQL [ ALTER SYSTEM SET log_file_name_convert = " torcla " , " torclb " SCOPE = SPFILE ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Executing SQL [ ALTER SYSTEM SET log_file_name_convert = " torcla " , " torclb " SCOPE = SPFILE ]
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 SQL [ ALTER SYSTEM SET log_file_name_convert = " torcla " , " torclb " SCOPE = SPFILE ] Executed successfully
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Database Resource SetState succeeded
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 RSM 0 received SETSTATE request : rid = 0 x01041000 , sid = 1 , phid = 2 , econd = 7 , sitehndl = 0 x7fffffff
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Log Transport Resource : SetState ONLINE , phase BUILD - UP , External Cond ENABLE
DG 2009 - 08 - 31 - 06 : 30 : 16         0 2 0 Executing SQL [ ALTER SYSTEM ARCHIVE LOG CURRENT ]
DG 2009 - 08 - 31 - 06 : 30 : 23         0 2 0 SQL [ ALTER SYSTEM ARCHIVE LOG CURRENT ] Executed successfully

参考至:http://www.dbabeta.com/2009/learn-data-guard-broker_broker-configuration.html

如有错误,欢迎指正

邮箱:[email protected]

你可能感兴趣的:(Data,guard)