概述
环境:Oracle linux 5.5+Oracle 11.2.0.2
发现一套1一主二从的Oracle 11.2.0.2主从库的一个active standby无法实时同步。
查看dgmgrl配置没有问题,日志同步状态为实时同步: LogXptMode = 'SYNC'
DGMGRL> show database verbose s2bzcge;
Database - s2bzcge
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Real Time Query: ON
Instance(s):
bzcge
Properties:
DGConnectIdentifier = '(description =(address_list =(address = (protocol = tcp)(host = *.*.*.* )(port = 1111)))(connect_data =(service_name = service)))'
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 = '1800'
LogArchiveMaxProcesses = '10'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = ''
LogFileNameConvert = ''
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
SidName = 'bzcge'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1111))(CONNECT_DATA=(SERVICE_NAME=s2bzcge_DGMGRL)(INSTANCE_NAME=bzcge)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/U02/oradata/bzcge/archive'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'
Database Status:
SUCCESS
Database - s2bzcge
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Real Time Query: ON
Instance(s):
bzcge
Properties:
DGConnectIdentifier = '(description =(address_list =(address = (protocol = tcp)(host = *.*.*.* )(port = 1111)))(connect_data =(service_name = service)))'
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 = '1800'
LogArchiveMaxProcesses = '10'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = ''
LogFileNameConvert = ''
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
SidName = 'bzcge'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1111))(CONNECT_DATA=(SERVICE_NAME=s2bzcge_DGMGRL)(INSTANCE_NAME=bzcge)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/U02/oradata/bzcge/archive'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'
Database Status:
SUCCESS
怀疑是配置问题,对比了另外一个从库,配置没问题,把库删除掉,重新加入dgmgrl。
remove database s2bzcge;
add database s2bzcge as connect identifier is "(description =(address_list =(address = (protocol = tcp)(host = 10.1.2.1 )(port = 1111)))(connect_data =(service_name = bzcge)))" maintained as physical;
enable database s2bzcge;
edit database s2bzcge set property LogXptMode = 'SYNC';
edit database s2bzcge set property LogXptMode = 'SYNC';
remove database s1bzcge;
add database s1bzcge as connect identifier is "(description =(address_list =(address = (protocol = tcp)(host = 10.1.2.2 )(port = 1111)))(connect_data =(service_name = bzcge)))" maintained as physical;
enable database s1bzcge;
edit database s2bzcge set property LogXptMode = 'SYNC';
但是这个问题依旧存在。
日志数是够的,主库日志组为9,从库的standby日志数为10。
查询异常库的v$standby_log,注意标黄的列。此处DBID是没有有价值的数据的。
select * from v$standby_log;
查询正常从库的v$standby_log,注意标黄的行。此处有一行数据是和其他的数据不同的。
select * from v$standby_log;
推测是之前建从库的同事加的standby redo log加的有问题,导致无法支持主从实时同步。因此考虑删除现有的standby redo log,重新增加。
首先要退出日志应用,否则无法删除:
recover managed standby database cancel;
删除所有日志组:
alter database drop logfile group 32;
alter database drop logfile group 33;
alter database drop logfile group 34;
alter database drop logfile group 35;
alter database drop logfile group 36;
alter database drop logfile group 37;
alter database drop logfile group 38;
alter database drop logfile group 39;
alter database drop logfile group 40;
alter database drop logfile group 31;
alter database drop logfile group 33;
alter database drop logfile group 34;
alter database drop logfile group 35;
alter database drop logfile group 36;
alter database drop logfile group 37;
alter database drop logfile group 38;
alter database drop logfile group 39;
alter database drop logfile group 40;
alter database drop logfile group 31;
重新添加日志组:
alter database add standby logfile group 30 '/U02/oradata/bzcge/sredo30.rdo' size 500m;
alter database add standby logfile group 31 '/U02/oradata/bzcge/sredo31.rdo' size 500m;
alter database add standby logfile group 32 '/U02/oradata/bzcge/sredo32.rdo' size 500m;
alter database add standby logfile group 33 '/U02/oradata/bzcge/sredo33.rdo' size 500m;
alter database add standby logfile group 34 '/U02/oradata/bzcge/sredo34.rdo' size 500m;
alter database add standby logfile group 35 '/U02/oradata/bzcge/sredo35.rdo' size 500m;
alter database add standby logfile group 36 '/U02/oradata/bzcge/sredo36.rdo' size 500m;
alter database add standby logfile group 37 '/U02/oradata/bzcge/sredo37.rdo' size 500m;
alter database add standby logfile group 38 '/U02/oradata/bzcge/sredo38.rdo' size 500m;
alter database add standby logfile group 39 '/U02/oradata/bzcge/sredo39.rdo' size 500m;
alter database add standby logfile group 40 '/U02/oradata/bzcge/sredo40.rdo' size 500m;
alter database add standby logfile group 41 '/U02/oradata/bzcge/sredo41.rdo' size 500m;
alter database add standby logfile group 31 '/U02/oradata/bzcge/sredo31.rdo' size 500m;
alter database add standby logfile group 32 '/U02/oradata/bzcge/sredo32.rdo' size 500m;
alter database add standby logfile group 33 '/U02/oradata/bzcge/sredo33.rdo' size 500m;
alter database add standby logfile group 34 '/U02/oradata/bzcge/sredo34.rdo' size 500m;
alter database add standby logfile group 35 '/U02/oradata/bzcge/sredo35.rdo' size 500m;
alter database add standby logfile group 36 '/U02/oradata/bzcge/sredo36.rdo' size 500m;
alter database add standby logfile group 37 '/U02/oradata/bzcge/sredo37.rdo' size 500m;
alter database add standby logfile group 38 '/U02/oradata/bzcge/sredo38.rdo' size 500m;
alter database add standby logfile group 39 '/U02/oradata/bzcge/sredo39.rdo' size 500m;
alter database add standby logfile group 40 '/U02/oradata/bzcge/sredo40.rdo' size 500m;
alter database add standby logfile group 41 '/U02/oradata/bzcge/sredo41.rdo' size 500m;
查询异常库的v$standby_log,注意标黄的列。此处DBID依然是没有有价值的数据的。
select * from v$standby_log;
恢复日志应用:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
在
主库做一下日志切换,看有什么结果
sqlplus "/as sysdba"
alter system switch logfile;
查询异常库的v$standby_log,注意标黄的行,这个时候,有数据产生了。
select * from v$standby_log;
再在主库做一下日志切换,看有什么结果
sqlplus "/as sysdba"
alter system switch logfile;
查询异常库的v$standby_log,注意标黄的行,这个时候,日志从30号切到31号了。
select * from v$standby_log;
这个时候再去测试,发现主从库可以正常实时同步了,至此该问题解决。
再次碰到该问题,发现是主库的redo log 比从库的standby redo log物理大小大引起的。将从库redo log改为和主库最大的redo log物理大小一样即可
最后
以上就是清爽板凳为你收集整理的Oracle 11g active standby不能实时同步解决的全部内容,希望文章能够帮你解决Oracle 11g active standby不能实时同步解决所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复