Oracle数据库 DGbroker三种保护模式的切换
1.三种保护模式
–Maximumprotection
在Maximumprotection下,可以保证从库和主库数据完全一样,做到zerodataloss.事务同时在主从两边提交完成,才算事务完成。如果从库宕机或者网络出现问题,主从库不能通讯,主库也立即宕机。在这种方式下,具有最高的保护等级。但是这种模式对主库性能影响很大,要求高速的网络连接。
–Maximumavailability
在Maximumavailability模式下,如果和从库的连接正常,运行方式等同Maximumprotection模式,事务也是主从库同时提交。如果从库和主库失去联系,则主库自动切换到Maximumperformance模式下运行,保证主库具有最大的可用性。
–Maximumperformance
在Maximumperformance,主库把归档的archivedlog通过arch进程传递给从库,在这种方式下,主库运行性能最高,但是不能保证数据不丢失,且丢失的数据受redolog的大小影响。在redolog过大的情况下,可能一天都没有归档一个日志,可以通过手工切换日志的方式来减小数据的丢失。
2.模式切换(Maximumperformance切换至Maximumavailability)
a.查看保护的模式
DGbroker查看:
DGMGRL>showconfigurationverbose; Configuration-dgc ProtectionMode:MaxPerformance Databases: atest1-Primarydatabase atest2-Physicalstandbydatabase Properties: FastStartFailoverThreshold='30' OperationTimeout='30' FastStartFailoverLagLimit='30' CommunicationTimeout='180' ObserverReconnect='0' FastStartFailoverAutoReinstate='TRUE' FastStartFailoverPmyShutdown='TRUE' BystandersFollowRoleChange='ALL' ObserverOverride='FALSE' ExternalDestination1='' ExternalDestination2='' PrimaryLostWriteAction='CONTINUE' Fast-StartFailover:DISABLED ConfigurationStatus: SUCCESS
sqlplus查看:
SQL>selectdatabase_role,protection_mode,protection_levelfromv$database; DATABASE_ROLEPROTECTION_MODEPROTECTION_LEVEL -------------------------------------------------------- PRIMARYMAXIMUMPERFORMANCEMAXIMUMPERFORMANCE
b.查看备库的日志传输模式(参数LogXptMode(sync:同步传输/async:异步传输))
DGMGRL>showdatabaseverbose'atest2'; Database-atest2 Role:PHYSICALSTANDBY IntendedState:APPLY-ON TransportLag:0seconds(computed1secondago) ApplyLag:0seconds(computed1secondago) ApplyRate:97.00KByte/s RealTimeQuery: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)' DatabaseStatus: SUCCESS
c.如果LogXptMode的值为async,就要将其修改为sync
DGMGRL>editdatabaseatest1setpropertylogxptmode=sync; Property"logxptmode"updated
d.修改完之后再次确认LogXptMode的值,如步骤b
e.切换模式(如果切换失败,则再次去确认备库LogXptMode的值)
DGMGRL>editconfigurationsetprotectionmodeasmaxavailability; Succeeded.
f.确认数据库的的保护模式,如步骤a
g.需要注意的是,步骤c中修改的sync是备库的值,切记!
3.个人小结:
a.三种模式在可以在DGbroker中自由切换(使用步骤2的方式)(在测试库中),正常情况下,数据库能迅速反应过来(查看保护模式的时候)。
b.使用Maximumperformance的时候,参数(备库)LogXptMode设置为async就好/
c.使用Maximumprotection或者Maximumavailability的时候,参数(备库)LogXptMode要设置为sync。
d.(经测试)使用Maximumprotection时,当备库出现异常(如网络问题,数据库宕机),主库会挂起(告警日志会报如下错误),当备库恢复正常之后,主库也会恢复。
LGWR:Error1034attachingtoRFSforreconnect
e.使用Maximumprotection时,在当备库出现异常的情况下,当主库挂起时,(主库)可以强制切换到Maximumperformance,但当重新切回Maximumprotection(在备库恢复时),主库需重启。
DGMGRL>editconfigurationsetprotectionmodeasmaxprotection; Operationrequiresshutdownofinstance"atest"ondatabase"atest1" Shuttingdowninstance"atest"... Unabletoconnecttodatabase ORA-12545:Connectfailedbecausetargethostorobjectdoesnotexist Failed. Warning:YouarenolongerconnectedtoORACLE. Pleasecompletethefollowingstepstofinishtheoperation: shutdowninstance"atest"ofdatabase"atest1" startupinstance"atest"ofdatabase"atest1"
以上内容是小编给大家分享的Oracle数据库DGbroker三种保护模式的切换的相关内容,希望大家喜欢,同时也感谢大家一直以来对毛票票网站的支持与厚爱。