dataguard broker failover 配置

datagurad broker :

其中dgmgrl的主要作用是:

先解释下dgmgrl 的作用

The Data Guard command-line interface (DGMGRL) enables you to control and
monitor a Data Guard configuration from the DGMGRL prompt or within scripts. You
can perform most of the activities required to manage and monitor the databases in the
configuration using DGMGRL commands.
DGMGRL also includes commands to create an observer process that continuously
monitors the primary and target standby databases and evaluates whether failover is
necessary, and then initiates a fast-start failover when conditions warrant.

datagurad broker的进程:

[oracle@oradg ~]$ ps -ef|grep dmon
oracle 6053 1 0 01:18 ? 00:00:00 ora_dmon_orcl

[oracle@oraprimary ~]$ ps -ef|grep dmon
oracle 4592 1 0 01:15 ? 00:00:00 ora_dmon_orcl

这个进程在prd 和standby 上各有一个

因为这两个节点会彼此交换主备节点的相关信息

它的作用是:

Whether you use Oracle Enterprise Manager or DGMGRL to manage a
database, the DMON process is the server-side component that interacts
with the local database and the DMON processes of the other databases
to perform the requested function. The DMON process is also
responsible for monitoring the health of the broker configuration and
for ensuring that every database has a consistent description of the
config

开启 datagurad broker failover

db_recovery_file_dest string
db_recovery_file_dest_size big integer 0
recovery_parallelism integer 0

SQL> alter system set db_recovery_file_dest_size=2048m scope=spfile
  2  /

System altered.

SQL> alter system set db_recovery_file_dest='/u01/app/recovery'
  2  scope=spfile
  3  /

System altered.


restart the database,you will see:  

SQL> show parameter recovery 

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest            string  /u01/app/recovery
db_recovery_file_dest_size       big integer 2G
recovery_parallelism             integer     0

–Edit configuration set Protection mode as MaxAvailability;

DGMGRL> show configuration

Configuration - dg

  Protection Mode: MaxAvailability
  Databases:
    orcl_prd - Primary database
    orcl_dg  - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

– alter database flashback on

然而主备库都要开启闪回,我这里备库的开启闪回失败了,因为我主备库的日子已经不一致了

无奈之下 我重新跑下如下命令:

 duplicate target database for standby nofilenamecheck from active database;

然后发现主库,备库的状态都正确了

SQL> alter database open
  2  /

Database altered.

SQL> show parameter broker

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1           string  /u01/app/oracle/product/11.2.0
                         /dbhome_1/dbs/dr1orcl_dg.dat
dg_broker_config_file2           string  /u01/app/oracle/product/11.2.0
                         /dbhome_1/dbs/dr2orcl_dg.dat
dg_broker_start              boolean     TRUE
SQL> alter database flashback on
  2  /

Database altered.

SQL> 


and then

DGMGRL> show configuration;

Configuration - dg

  Protection Mode: MaxAvailability
  Databases:
    orcl_prd - Primary database
    orcl_dg  - Physical standby database
      Error: ORA-16766: Redo Apply is stopped

解决方法

SQL> alter database recover managed standby database using current logfile disconnect from session;

Database altered.

and then 


DGMGRL> show configuration;

Configuration - dg

  Protection Mode: MaxAvailability
  Databases:
    orcl_prd - Primary database
    orcl_dg  - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL> 

and then 到此为止 最大可用性 闪回 等已经配置完毕了

DGMGRL> enable fast_start failover
Enabled.
DGMGRL> 



and then 
DGMGRL> show configuration verbose;

Configuration - dg

  Protection Mode: MaxAvailability
  Databases:
    orcl_prd - Primary database
      Warning: ORA-16819: fast-start failover observer not started

    orcl_dg  - (*) Physical standby database
      Warning: ORA-16819: fast-start failover observer not started

and then

DGMGRL> start observer

该start observer 的窗口可能不应该关闭,需要在主库和备库的第三台服务器上去做
否则后面会报一个错误

错误如下:

Data Guard Broker Status Summary:
  Type                        Name                             Severity  Status
  Configuration               dg                                Warning  ORA-16607
  Primary Database            orcl_prd                            Error  ORA-16820
  Physical Standby Database   orcl_dg                             Error  ORA-16820

and you will see

DGMGRL> show configuration verbose;

Configuration - dg

  Protection Mode: MaxAvailability
  Databases:
    orcl_prd - Primary database
    orcl_dg  - (*) Physical standby database

  (*) Fast-Start Failover target

  Properties:
    FastStartFailoverThreshold      = '30'
    OperationTimeout                = '30'
    FastStartFailoverLagLimit       = '30'
    CommunicationTimeout            = '180'
    ObserverReconnect               = '0'
    FastStartFailoverAutoReinstate  = 'TRUE'
    FastStartFailoverPmyShutdown    = 'TRUE'
    BystandersFollowRoleChange      = 'ALL'
    ObserverOverride                = 'FALSE'
    ExternalDestination1            = ''
    ExternalDestination2            = ''
    PrimaryLostWriteAction          = 'CONTINUE'

Fast-Start Failover: ENABLED

  Threshold:          30 seconds
  Target:             orcl_dg
  Observer:           oraprimary
  Lag Limit:          30 seconds (not in use)
  Shutdown Primary:   TRUE
  Auto-reinstate:     TRUE
  Observer Reconnect: (none)
  Observer Override:  FALSE

Configuration Status:
SUCCESS


and in both databases you will see
SQL> select fs_failover_status from v$database;

FS_FAILOVER_STATUS
----------------------
SYNCHRONIZED

最近这一周把dataguard 手动挡和自动挡都不算精细的研究了下,在网络资源这样丰富的2017年,要想学不会一样东西都是一件难度很大的事情,只要用心的付出,福慧双修,时间会给我们一个交代!看看我们能不能在一个领域有深入下去的能力!

                           stephen 2017.9.10 晚 于合肥
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值