1.三种保护模式
– Maximum protection
在Maximum protection下, 可以保证从库和主库数据完全一样,做到zero data loss.事务同时在主从两边提交完成,才算事务完成。如果从库宕机或者网络出现问题,主从库不能通讯,主库也立即宕机。在这种方式下,具有最高的保护等级。但是这种模式对主库性能影响很大,要求高速的网络连接。
– Maximum availability
在Maximum availability模式下,如果和从库的连接正常,运行方式等同Maximum protection模式,事务也是主从库同时提交。如果从库和主库失去联系,则主库自动切换到Maximum performance模式下运行,保证主库具有最大的可用性。
– Maximum performance
在Maximum performance,主库把归档的 archived log通过arch进程传递给从库,在这种方式下,主库运行性能最高,但是不能保证数据不丢失,且丢失的数据受redo log的大小影响。在redo log过大的情况下,可能一天都没有归档一个日志,可以通过手工切换日志的方式来减小数据的丢失。
2.模式切换(Maximum performance切换至Maximum availability)
a.查看保护的模式
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
sqlplus查看:
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:异步传输))
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
DGMGRL> edit database atest1 set property logxptmode=sync;
Property "logxptmode" updated
d.修改完之后再次确认LogXptMode的值,如步骤b
e.切换模式(如果切换失败,则再次去确认备库LogXptMode的值)
DGMGRL> edit configuration set protection mode as maxavailability;
Succeeded.
f. 确认数据库的的保护模式,如步骤a
g.需要注意的是,步骤c中修改的sync是备库的值,切记!
3.个人小结:
a.三种模式在可以在DGbroker中自由切换(使用步骤2的方式)(在测试库中),正常情况下,数据库能迅速反应过来(查看保护模式的时候)。
b.使用Maximum performance的时候,参数(备库)LogXptMode设置为async就好/
c.使用Maximum protection或者Maximum availability的时候,参数(备库)LogXptMode要设置为sync。
d.(经测试)使用Maximum protection时,当备库出现异常(如网络问题,数据库宕机),主库会挂起(告警日志会报如下错误),当备库恢复正常之后,主库也会恢复。
LGWR: Error 1034 attaching to RFS for reconnect
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"
以上内容是小编给大家分享的Oracle数据库 DGbroker三种保护模式的切换的相关内容,希望大家喜欢,同时也感谢大家一直以来对我们网站的支持与厚爱。
本文标题: Oracle数据库 DGbroker三种保护模式的切换
本文地址: http://www.cppcns.com/shujuku/oracle/137763.html