sitemap

RSS地图

收藏本站

设为首页

Oracle研究中心

当前位置:Oracle研究中心 > 产品DBA > Oracle DG >

【学习笔记】Oracle 11G DATAGRUAD环境BROKER配置Fast-Start Failover

时间:2016-10-26 20:23   来源:Oracle研究中心   作者:HTZ   点击:

天萃荷净 Oracle研究中心学习笔记:分享一篇关于Oralce 11G DataGruad中故障自动切换fast-start failover的案例,通过dgmgrl与Enterprise Managerg来配置fast-start failover。
FAST-START failover 就是在当主数据库出现故障时,能快速与可靠的把standby切换成主数据库,在整个过程中不需要人来干预。fast-start failover只能通过dgmgrl与Enterprise Managerg来配置。

只有maximum availability mode or maximum performance mode才能启用fast-start failover模式。在maximum availability模式下面,在切换时可以保证无数据丢失,在maximum performance mode下面,会有数据丢失,丢失多少数据由 FastStartFailoverLagLimit这个参数来配置。

只要observer进程启动过,我们就不需要人为的干预。当observer与指定的备数据库与主数据库失去连接的时间超过FastStartFailoverThreshold后,observer就会启动fast-start failover 到备数据库。如果配置了FastStartFailoverPmyShutdown为true,此时原来的主数据库将会自动的shutdown。如果配置FastStartFailoverAutoReinstate为true,当failover完成后,启动数据库时,会自动的执行Reinstate database,把原来的主数据库变成备库,并与新主库进行同步。

fast-start failover包含3个过程
测试开始:

环境:OS REDHAT 5.6 X86_64 ,DB 11.2.0.2

1,DG环境的搭建。

见11GR2 搭建活动的物理DG/DATAGRUAD (READ ONLY模式)

2,broker的配置

3,配置保护模式与日志传递方式


之前已经说了FAST-START FAILOVER只 maximum availability mode与maximum performance mode

下面我们看一下每一种保护模式对应的日志传递方式。

3.1修改保护模式:

[oracle@test admin]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.2.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle@htz
Connected.
#通过help查看命令的帮忙。
DGMGRL> help edit
Edits a configuration, database, or instance
Syntax:

EDIT CONFIGURATION SET PROTECTION MODE AS
{MaxProtection|MaxAvailability|MaxPerformance};

EDIT CONFIGURATION SET PROPERTY  = ;

EDIT DATABASE  SET PROPERTY  = ;

EDIT DATABASE  RENAME TO ;

EDIT DATABASE  SET STATE = 
[WITH APPLY INSTANCE = ];

EDIT INSTANCE  [ON DATABASE ]
SET AUTO PFILE [ = {|OFF} ];

EDIT INSTANCE  [ON DATABASE ]
SET PROPERTY  = ;

EDIT INSTANCE * ON DATABASE 
SET PROPERTY  = ;

DGMGRL> edit configuration set protection mode as maxavilability;
Syntax error before or at "maxavilability"
DGMGRL> show configuration;

Configuration - htz
#最大可用的保护模式
Protection Mode: MaxAvailability
Databases:
htzb - Primary database
htz - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
3.2 修改日志传递方式

DGMGRL> edit database htz set property logxptmode=sync;
Property "logxptmode" updated
DGMGRL> edit database htzb set property logxptmode=sync;
Property "logxptmode" updated
DGMGRL> show database htz logxptmode
LogXptMode = 'sync'
DGMGRL> show database htzb logxptmode
LogXptMode = 'sync
4 配置数据库的flashback

4.1 主库上面

SQL> select open_mode,database_role,log_mode,flashback_on from v$database;

OPEN_MODE DATABASE_ROLE LOG_MODE FLASHBACK_ON
-------------------- ---------------- ------------ ------------------
READ WRITE PRIMARY ARCHIVELOG NO
#配置flashback
SQL> alter database flashback on;

Database altered.

SQL> select open_mode,database_role,log_mode,flashback_on from v$database;

OPEN_MODE DATABASE_ROLE LOG_MODE FLASHBACK_ON
-------------------- ---------------- ------------ ------------------
READ WRITE PRIMARY ARCHIVELOG YES
#flashback的配置目录与大小
SQL> show parameter recovery

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/app/oracle/fast_recovery_
area
db_recovery_file_dest_size big integer 4032M
4.2 备库上面

SQL> select open_mode,database_role,log_mode,flashback_on from v$database;

OPEN_MODE DATABASE_ROLE LOG_MODE FLASHBACK_ON
-------------------- ---------------- ------------ ------------------
READ ONLY WITH APPLY PHYSICAL STANDBY ARCHIVELOG NO

SQL> recover managed standby database cancel;
Media recovery complete.
SQL> alter database flashback on;

Database altered.

SQL> recover managed standby database using current logfile disconnect;
Media recovery complete.
SQL> select open_mode,database_role,log_mode,flashback_on from v$database;

OPEN_MODE DATABASE_ROLE LOG_MODE FLASHBACK_ON
-------------------- ---------------- ------------ ------------------
READ ONLY WITH APPLY PHYSICAL STANDBY ARCHIVELOG YES
5 配置observer服务器

5.1 配置tnsnames.ora文件。

[oracle@test admin]$ cat tnsnames.ora
HTZB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.31)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = dedicate)
(SERVICE_NAME = htzb)
)
)

HTZ =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.30)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = dedicate)
(SERVICE_NAME = htz)
)
)
5.2 启动observer进程

[oracle@test admin]$ dgmgrl sys/oracle@htz "start observer"
DGMGRL for Linux: Version 11.2.0.2.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected.
Observer started
6 配置fast-start failover

DGMGRL> edit database htz set property FastStartFailoverTarget=htzb;
Property "faststartfailovertarget" updated
DGMGRL> edit database htzb set property FastStartFailoverTarget=htz;
Property "faststartfailovertarget" updated
于fst-start failove相关的其它几个参数:

FastStartFailoverPmyShutdown

FastStartFailoverLagLimit

FastStartFailoverAutoReinstate

ObserverConnectIdentifier

这里我们都使用默认值;我们来看一下这些值的默认值;

DGMGRL> show configuration verbose;

Configuration - htz

Protection Mode: MaxAvailability
Databases:
htzb - Primary database
htz - (*) Physical standby database

(*) Fast-Start Failover target

Properties:
FastStartFailoverThreshold = '30'
OperationTimeout = '30'
FastStartFailoverLagLimit = '30'
CommunicationTimeout = '180'
FastStartFailoverAutoReinstate = 'TRUE'
FastStartFailoverPmyShutdown = 'TRUE'
BystandersFollowRoleChange = 'ALL'

Fast-Start Failover: DISABLE

Threshold: 30 seconds
Target: htz
Observer: test
Lag Limit: 30 seconds (not in use)
Shutdown Primary: TRUE
Auto-reinstate: TRUE

Configuration Status:
SUCCESS
7 启用fast-start failover

DGMGRL> show configuration

Configuration - htz

Protection Mode: MaxAvailability
Databases:
htzb - Primary database
htz - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
DGMGRL> enable fast_start failover
Enabled.
DGMGRL>
8.测试FASOracleoracleplus.netT-START FAILOVER是否生效

DGMGRL> show configuration

Configuration - htz

Protection Mode: MaxAvailability
Databases:
htzb - Primary database
htz - (*) Physical standby database
Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS
#原主库直接shutdown abort;
SQL> shutdown abort;
ORACLE instance shut down.
SQL>
#observer进程的日志
19:03:03.93  Friday, September 07, 2012
Initiating Fast-Start Failover to database "htz"...
Performing failover NOW, please wait...
Failover succeeded, new primary is "htz"
19:03:13.24  Friday, September 07, 2012
#提示已经把主切换到htz
#在htz上面查看一下
SQL> select open_mode ,database_role from v$database;

OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ WRITE PRIMARY
已经成功
手动启动原主库
DGMGRL> show configuration;

Configuration - htz

  Protection Mode: MaxAvailability
  Databases:
    htz  - Primary database
      Warning: ORA-16817: unsynchronized fast-start failover configuration

    htzb - (*) Physical standby database (disabled)
      ORA-16661: the standby database needs to be reinstated

Fast-Start Failover: ENABLED

Configuration Status:
WARNING

DGMGRL> connect sys/oracle@htzb
Connected.
DGMGRL> startup
ORACLE instance started.
Database mounted.
ORA-16649: possible failover to another database prevents this database from being opened
#过一分会后我们再查看一下状态
DGMGRL> connect sys/oracle@htz
Connected.
DGMGRL> show configuration

Configuration - htz

  Protection Mode: MaxAvailability
  Databases:
    htz  - Primary database
    htzb - (*) Physical standby database

Fast-Start Failover: ENABLED

Configuration Status:
SUCCESS
查看状态,一切正常。

本文固定链接: http://www.htz.pw/2014/06/18/11gr-datagruad%e7%8e%af%e5%a2%83broker%e9%85%8d%e7%bd%aefast-start-failover.html | 认真就输

--------------------------------------ORACLE-DBA----------------------------------------

最权威、专业的Oracle案例资源汇总之【学习笔记】Oracle 11G DATAGRUAD环境BROKER配置Fast-Start Failover

本文由大师惜分飞原创分享,网址:http://www.oracleplus.net/arch/1076.html

Oracle研究中心

关键词:

fast-start failover只能通过dgmgrl与Enterprise Managerg来配置

Oralce DG Fast-Start Failover的配置方法

如何配置Oralce DATAGRUAD故障自动切换功能