一、需求,主库添加日志后,备库未操作主库日志比备库日志数量多,有什么影响?
正常来说,我们搭建Oracle DG之后,一般来说都会配置standby_file_management =>AUTO
但是只能同步数据文件的操作,对于日志文件来说并不会同步主库添加日志的行为!
我们都知道,DG搭建,oracle官方是建议dg配置比redo group +1的数量,以保证实时同步!
二、测试
Primary SYS>select group#,bytes/1024/1024 from v$log; GROUP# BYTES/1024/1024 ---------- ---------- 1 200 2 200 3 200 SQL> alter database add logfile '/picclife/app/oracle/oradata/orcl/redo04.log' size 200m; Database altered. SQL> alter database add logfile '/picclife/app/oracle/oradata/orcl/redo05.log' size 200m; Database altered. SQL> alter database add logfile '/picclife/app/oracle/oradata/orcl/redo06.log' size 200m; Database altered. standby SYS@c12>select group#,THREAD#,sequence#,bytes/1024/1024,status from v$log; GROUP# THREAD# SEQUENCE# BYTES/1024/1024 STATUS ---------- ---------- ---------- --------------- -------------------------------- 1 1 0 200 UNUSED 2 1 0 200 UNUSED 3 1 0 200 UNUSED
SYS@c12>select group#,thread#,sequence#,bytes/1024/1024 m,blocksize,status from v$standby_log;
GROUP# THREAD# SEQUENCE# M BLOCKSIZE STATUS
---------- ---------- ---------- ---------- ---------- --------------------
4 1 118 200 512 ACTIVE
5 1 0 200 512 UNASSIGNED
6 1 0 200 512 UNASSIGNED
7 1 0 200 512 UNASSIGNED
主库多次切换归档日志!
SQL> alter system switch logfile;
DG备库可以发现!
SQL>select group#,thread#,sequence#,bytes/1024/1024 m,blocksize,status from v$standby_log
GROUP# THREAD# SEQUENCE# M BLOCKSIZE STATUS
---------- ---------- ---------- ---------- ---------- -----
4 1 0 200 512 UNASSIGNED
5 1 117 200 512 ACTIVE
····
4 1 118 200 512 ACTIVE
5 1 0 200 512 UNASSIGNED
主库每切换一次归档,对应dg active standby log 会使用不同的group,但是基本上每次只使用4,5组! 其余6,7组并未使用!
本次测试只是在测试环境中进行,实际生产环境中归档日志的写入速度很快! 如果DG STANDBY REDO没有足够的空间可用,实时同步肯定受到影响!
因此可以得出结论,在主库日志量少的情况下可以忽略!
如果生产环境日志量过大,并且DG的要求实时性很高,尽量人工 在DG环境手工进行同步! 否则可以暂时忽略,关注下是实时应用就可以了。
--add standby
alter database recover managed standby database cancel;
ALTER DATABASE ADD STANDBY LOGFILE '/picclife/app/oracle/oradata/orcldg/redostandby08.log' SIZE 200M;
ALTER DATABASE ADD STANDBY LOGFILE '/picclife/app/oracle/oradata/orcldg/redostandby09.log' SIZE 200M;
ALTER DATABASE ADD STANDBY LOGFILE '/picclife/app/oracle/oradata/orcldg/redostandby10.log' SIZE 200M;
recover managed standby database using current logfile disconnect;
SYS@c12>select group#,thread#,bytes/1024/1024 from v$standby_log;
GROUP# THREAD# BYTES/1024/1024
---------- ---------- ---------------
4 1 200
5 1 200
6 1 200
7 1 200
8 0 200
9 0 200
10 0 200
7 rows selected.