DGbroker三种保护模式的切换

1.三种保护模式

1.三种保护模式

  – Maximum protection

  – Maximum protection

在Maximum protection下, 可以保证从库和主库数据完全一样,做到zero data
loss.事务同时在主从两边提交完成,才算事务完成。如果从库宕机或者网络出现问题,主从库不能通讯,主库也立即宕机。在这种方式下,具有最高的保护等级。但是这种模式对主库性能影响很大,要求高速的网络连接。

在Maximum protection下, 可以保证从库和主库数据完全一样,做到zero data loss.事务同时在主从两边提交完成,才算事务完成。如果从库宕机或者网络出现问题,主从库不能通讯,主库也立即宕机。在这种方式下,具有最高的保护等级。但是这种模式对主库性能影响很大,要求高速的网络连接。

  – Maximum availability

  – Maximum availability

在Maximum availability模式下,如果和从库的连接正常,运行方式等同Maximum
protection模式,事务也是主从库同时提交。如果从库和主库失去联系,则主库自动切换到Maximum
performance模式下运行,保证主库具有最大的可用性。

在Maximum availability模式下,如果和从库的连接正常,运行方式等同Maximum protection模式,事务也是主从库同时提交。如果从库和主库失去联系,则主库自动切换到Maximum performance模式下运行,保证主库具有最大的可用性。

  – Maximum performance

  – Maximum performance

 在Maximum performance,主库把归档的 archived
log通过arch进程传递给从库,在这种方式下,主库运行性能最高,但是不能保证数据不丢失,且丢失的数据受redo
log的大小影响。在redo
log过大的情况下,可能一天都没有归档一个日志,可以通过手工切换日志的方式来减小数据的丢失。

在Maximum performance,主库把归档的 archived log通过arch进程传递给从库,在这种方式下,主库运行性能最高,但是不能保证数据不丢失,且丢失的数据受redo log的大小影响。在redo log过大的情况下,可能一天都没有归档一个日志,可以通过手工切换日志的方式来减小数据的丢失。

2.模式切换(Maximum
performance切换至Maximum availability)

2.模式切换(Maximum performance切换至Maximum availability)

  a.查看保护的模式

  a.查看保护的模式

     DGbroker查看:

     DGbroker查看:

DGMGRL> show configuration verbose;
Configuration - dgc
 Protection Mode: MaxPerformance
 Databases:
 atest1 - Primary database
 atest2 - Physical standby database
 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: DISABLED
Configuration Status:
SUCCESS 
DGMGRL> show configuration  verbose;

Configuration - dgc

  Protection Mode: MaxPerformance
  Databases:
    atest1 - Primary database
    atest2 - Physical standby database

  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: DISABLED

Configuration Status:
SUCCESS

     sqlplus查看:

     sqlplus查看:

SQL> select database_role,protection_mode,protection_level from v$database;
DATABASE_ROLE  PROTECTION_MODE  PROTECTION_LEVEL
---------------- -------------------- --------------------
PRIMARY  MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE 
SQL> select database_role,protection_mode,protection_level from v$database;

DATABASE_ROLE     PROTECTION_MODE      PROTECTION_LEVEL
---------------- -------------------- --------------------
PRIMARY      MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE

  b.查看备库的日志传输模式(参数LogXptMode(sync:同步传输/async:异步传输))

  b.查看备库的日志传输模式(参数LogXptMode(sync:同步传输/async:异步传输))

DGMGRL> show database verbose 'atest2';
Database - atest2
 Role:   PHYSICAL STANDBY
 Intended State: APPLY-ON
 Transport Lag: 0 seconds (computed 1 second ago)
 Apply Lag:  0 seconds (computed 1 second ago)
 Apply Rate:  97.00 KByte/s
 Real Time Query: ON
 Instance(s):
 atest
 Properties:
 DGConnectIdentifier    = 'atest2'
 ObserverConnectIdentifier  = ''
 LogXptMode      = 'sync'
 DelayMins      = '0'
 Binding       = 'optional'
 MaxFailure      = '0'
 MaxConnections     = '1'
 ReopenSecs      = '300'
 NetTimeout      = '30'
 RedoCompression     = 'DISABLE'
 LogShipping      = 'ON'
 PreferredApplyInstance   = ''
 ApplyInstanceTimeout   = '0'
 ApplyParallel     = 'AUTO'
 StandbyFileManagement   = 'AUTO'
 ArchiveLagTarget    = '0'
 LogArchiveMaxProcesses   = '4'
 LogArchiveMinSucceedDest  = '1'
 DbFileNameConvert    = ''
 LogFileNameConvert    = ''
 FastStartFailoverTarget   = ''
 InconsistentProperties   = '(monitor)'
 InconsistentLogXptProps   = '(monitor)'
 SendQEntries     = '(monitor)'
 LogXptStatus     = '(monitor)'
 RecvQEntries     = '(monitor)'
 ApplyLagThreshold    = '0'
 TransportLagThreshold   = '0'
 TransportDisconnectedThreshold = '30'
 SidName       = 'atest'
 StaticConnectIdentifier   = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vijay02.database.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=atest2_DGMGRL)(INSTANCE_NAME=atest)(SERVER=DEDICATED)))'
 StandbyArchiveLocation   = '/u01/app/oracle/oradata/ATEST/archivelog'
 AlternateLocation    = ''
 LogArchiveTrace     = '0'
 LogArchiveFormat    = '%t_%s_%r.dbf'
 TopWaitEvents     = '(monitor)'
Database Status:
SUCCESS 
DGMGRL> show database verbose 'atest2';

Database - atest2

  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   0 seconds (computed 1 second ago)
  Apply Lag:       0 seconds (computed 1 second ago)
  Apply Rate:      97.00 KByte/s
  Real Time Query: ON
  Instance(s):
    atest

  Properties:
    DGConnectIdentifier             = 'atest2'
    ObserverConnectIdentifier       = ''
    LogXptMode                      = 'sync'
    DelayMins                       = '0'
    Binding                         = 'optional'
    MaxFailure                      = '0'
    MaxConnections                  = '1'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'
    RedoCompression                 = 'DISABLE'
    LogShipping                     = 'ON'
    PreferredApplyInstance          = ''
    ApplyInstanceTimeout            = '0'
    ApplyParallel                   = 'AUTO'
    StandbyFileManagement           = 'AUTO'
    ArchiveLagTarget                = '0'
    LogArchiveMaxProcesses          = '4'
    LogArchiveMinSucceedDest        = '1'
    DbFileNameConvert               = ''
    LogFileNameConvert              = ''
    FastStartFailoverTarget         = ''
    InconsistentProperties          = '(monitor)'
    InconsistentLogXptProps         = '(monitor)'
    SendQEntries                    = '(monitor)'
    LogXptStatus                    = '(monitor)'
    RecvQEntries                    = '(monitor)'
    ApplyLagThreshold               = '0'
    TransportLagThreshold           = '0'
    TransportDisconnectedThreshold  = '30'
    SidName                         = 'atest'
    StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vijay02.database.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=atest2_DGMGRL)(INSTANCE_NAME=atest)(SERVER=DEDICATED)))'
    StandbyArchiveLocation          = '/u01/app/oracle/oradata/ATEST/archivelog'
    AlternateLocation               = ''
    LogArchiveTrace                 = '0'
    LogArchiveFormat                = '%t_%s_%r.dbf'
    TopWaitEvents                   = '(monitor)'

Database Status:
SUCCESS

  c.如果LogXptMode的值为async,就要将其修改为sync

  c.如果LogXptMode的值为async,就要将其修改为sync

DGMGRL> edit database atest1 set property logxptmode=sync;
Property "logxptmode" updated 
DGMGRL> edit database atest1 set property logxptmode=sync;
Property "logxptmode" updated

  d.修改完之后再次确认LogXptMode的值,如步骤b

  d.修改完之后再次确认LogXptMode的值,如步骤b

  e.切换模式(如果切换失败,则再次去确认备库LogXptMode的值)

  e.切换模式(如果切换失败,则再次去确认备库LogXptMode的值)

DGMGRL> edit configuration set protection mode as maxavailability;
Succeeded.
DGMGRL> edit configuration set protection mode as maxavailability;
Succeeded.

  f. 确认数据库的的保护模式,如步骤a

  f. 确认数据库的的保护模式,如步骤a

  g.需要注意的是,步骤c中修改的sync是备库的值,切记!

  g.需要注意的是,步骤c中修改的sync是备库的值,切记!

 3.个人小结:

 3.个人小结:

  a.三种模式在可以在DGbroker中自由切换(使用步骤2的方式)(在测试库中),正常情况下,数据库能迅速反应过来(查看保护模式的时候)。

  a.三种模式在可以在DGbroker中自由切换(使用步骤2的方式)(在测试库中),正常情况下,数据库能迅速反应过来(查看保护模式的时候)。

  b.使用Maximum
performance的时候,参数(备库)LogXptMode设置为async就好/

  b.使用Maximum
performance的时候,参数(备库)LogXptMode设置为async就好/

  c.使用Maximum protection或者Maximum
availability的时候,参数(备库)LogXptMode要设置为sync。

  c.使用Maximum protection或者Maximum
availability的时候,参数(备库)LogXptMode要设置为sync。

  d.(经测试)使用Maximum
protection时,当备库出现异常(如网络问题,数据库宕机),主库会挂起(告警日志会报如下错误),当备库恢复正常之后,主库也会恢复。

  d.(经测试)使用Maximum
protection时,当备库出现异常(如网络问题,数据库宕机),主库会挂起(告警日志会报如下错误),当备库恢复正常之后,主库也会恢复。

LGWR: Error 1034 attaching to RFS for reconnect

LGWR: Error 1034 attaching to RFS for reconnect

  e.使用Maximum
protection时,在当备库出现异常的情况下,当主库挂起时,(主库)可以强制切换到
Maximum performance,但当重新切回Maximum
protection(在备库恢复时),主库需重启。

  e.使用Maximum
protection时,在当备库出现异常的情况下,当主库挂起时,(主库)可以强制切换到 Maximum
performance,但当重新切回Maximum
protection(在备库恢复时),主库需重启。

DGMGRL> edit configuration set protection mode as maxprotection;
Operation requires shutdown of instance "atest" on database "atest1"
Shutting down instance "atest"...
Unable to connect to database
ORA-12545: Connect failed because target host or object does not exist
Failed.
Warning: You are no longer connected to ORACLE.
Please complete the following steps to finish the operation:
 shut down instance "atest" of database "atest1"
 start up instance "atest" of database "atest1"
DGMGRL> edit configuration set protection mode as maxprotection;
Operation requires shutdown of instance "atest" on database "atest1"
Shutting down instance "atest"...
Unable to connect to database
ORA-12545: Connect failed because target host or object does not exist

Failed.
Warning: You are no longer connected to ORACLE.

Please complete the following steps to finish the operation:
    shut down instance "atest" of database "atest1"
    start up instance "atest" of database "atest1"

冠亚体育手机网站,以上内容是小编给大家分享的Oracle数据库
DGbroker三种保护模式的切换的相关内容,希望大家喜欢,同时也感谢大家一直以来对脚本之家网站的支持与厚爱。

 

您可能感兴趣的文章:

  • ASP.NET Core 数据保护(Data
    Protection)上篇
  • 在ASP.NET
    2.0中操作数据之七十一:保护连接字符串及其它设置信息
  • C++多线程编程时的数据保护
  • 探究在C++程序并发时保护共享数据的问题
  • 利用DOS命令来对抗U盘病毒保护U盘数据
  • 利用MySQL加密函数保护Web网站敏感数据的方法分享
  • 设置密码保护的SqlServer数据库备份文件与恢复文件的方法
  • 如何保护MySQL中重要数据的方法
  • 保护你的Sqlite数据库(SQLite数据库安全秘籍)
  • ASP.NET Core 数据保护(Data Protection
    集群场景)下篇

Post Author: admin

发表评论

电子邮件地址不会被公开。 必填项已用*标注