If the real-time apply feature is enabled, apply services can apply redo data as it is received, without waiting for the current standby redo log file to be archived. This results in faster switchover and failover times because the standby redo log files have been applied already to the standby database by the time the failover or switchover begins.
Use the ALTER DATABASE statement to enable the real-time apply feature, as follows:
For physical standby databases, issue the ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE statement.
For logical standby databases, issue the ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE statement.
Real-time apply requires a standby database that is configured with a standby redo log and that is in ARCHIVELOG mode.
Figure 7-1 shows a Data Guard configuration with a local destination and a standby destination. As the remote file server (RFS) process writes the redo data to standby redo log files on the standby database, apply services can recover redo from standby redo log files as they are being filled.
select sequence#,group#,bytes/1024/1024 MB from v$log; select member from v$logfile;
要添加4个 standby 日志组 ,比普通日志组多一个 alter database add standby logfile group 4'/u02/oradata/sh/redo04.std'> alter database add standby logfile group 5'/u02/oradata/sh/redo05.std'> alter database add standby logfile group 6 '/u02/oradata/sh/redo06.std'size 50m; alter database add standby logfile group 7'/u02/oradata/sh/redo07.std'>
3、备库Real-Time Apply应用日志
alter database recover managed standby database using current logfile disconnect; select database_role,open_mode fromv$database;
【实验结论】
通过在物理备库添加standby日志组,设置主库远端归档传输方式为LGWR、SYNC、AFFIRM并在备库上使用Real-Time Apply 应用日志,实现备库Read Only With Apply状态开库。即在日志应用过程中,同时只读方式开库来读取数据。
实现了DataGuard物理备库的日志应用和数据读取的同时进行。