概述
检查一下logfile是否一致
SQL> select group#,bytes/1024/1024 from v$log;
GROUP# BYTES/1024/1024
---------- ---------------
1 100
2 100
3 100
SQL> select group#,bytes/1024/1024 from v$standby_log;
GROUP# BYTES/1024/1024
---------- ---------------
4 50
5 50
6 50
7 50
SQL>
发现standbylog日志大小和logfile大小不一致
立即将备库的standbylog修正
备库操作:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
SQL> alter system set standby_file_management=manual;
System altered.
SQL> alter database drop standby logfile group 4;
Database altered.
SQL> alter database drop standby logfile group 5;
Database altered.
SQL> alter database drop standby logfile group 6;
Database altered.
SQL> alter database drop standby logfile group 7;
atabase altered.
SQL> alter database add standby logfile group 4 ('/u02/oradata/netdata/stdredo01.log') size 100M;
Database altered.
SQL> alter database add standby logfile group 5 ('/u02/oradata/netdata/stdredo02.log') size 100M;
Database altered.
SQL> alter database add standby logfile group 6 ('/u02/oradata/netdata/stdredo03.log') size 100M;
Database altered.
SQL> alter database add standby logfile group 7 ('/u02/oradata/netdata/stdredo04.log') size 100M;
Database altered.
SQL> alter system set standby_file_management=auto;
System altered.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
Database altered.
主库操作:
SQL> alter system set log_archive_dest_state_2=defer;
系统已更改。
SQL> alter system set log_archive_dest_state_2=enable;
系统已更改。
SQL> insert into netdata.hr values(5555,'sss');
已创建 1 行。
SQL> commit;
提交完成。
备库查看
SQL> select * from netdata.hr;
ID NAME
---------- --------------------
33 fdsjk
1111 mmmfd
5555 sss
1 dfs
999 sss
88888 mmmm
1111 mmmfd
7 rows selected.
SQL> select thread#,group#, status from v$standby_log;
THREAD# GROUP# STATUS
---------- ---------- ----------
1 4 ACTIVE
0 5 UNASSIGNED
0 6 UNASSIGNED
0 7 UNASSIGNED
SQL>
创建的原则:
Standby Redo Log 的文件大小与主库 online redo log 文件大小必须相同
Standby Redo Log 日志文件组的个数依照下面的原则进行计算:
Standby redo log组数公式 >= (每个instance日志组个数+1)*instance个数
例如在我的环境中,只有一个节点,这个节点有三组redo,所以
Standby redo log组数公式>=(3+1)*1 == 4
所以需要创建4组Standby redo log
每一日志组为了安全起见,可以做多路镜像;
官方文档关于创建standby log说明
The synchronous and asynchronous redo transport modes require that a redo
transport destination have a standby redo log. A standby redo log is used to store redo
received from another Oracle database. Standby redo logs are structurally identical to
redo logs, and are created and managed using the same SQL statements used to create
and manage redo logs.
Redo received from another Oracle database via redo transport is written to the
current standby redo log group by an RFS foreground process. When a log switch
occurs on the redo source database, incoming redo is then written to the next standby
redo log group, and the previously used standby redo log group is archived by an
ARCn foreground process.
The process of sequentially filling and then archiving redo log file groups at a redo
source database is mirrored at each redo transport destination by the sequential filling
and archiving of standby redo log groups.
Each standby redo log file must be at least as large as the largest redo log file in the
redo log of the redo source database. For administrative ease, Oracle recommends that
all redo log files in the redo log at the redo source database and the standby redo log at
a redo transport destination be of the same size.
The standby redo log must have at least one more redo log group than the redo log at
the redo source database, for each redo thread at the redo source database. At the redo
source database, query the V$LOG view to determine how many redo log groups are in
the redo log at the redo source database and query the V$THREAD view to determine
how many redo threads exist at the redo source database.
最后
以上就是知性百合为你收集整理的关于DG配置备库无法Real-Time Apply,无法实时查询的一个案例的全部内容,希望文章能够帮你解决关于DG配置备库无法Real-Time Apply,无法实时查询的一个案例所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复