Menu Bar

Thursday, October 12, 2023

Dataguard - Primary DB Prerequisits

– enabling the archive log mode
– enabling force logging

Force logging
For a physical standby to be a mirror copy, it must receive redo for the changes made to the primary database. In the primary database, when a segment is defined with the NOLOGGING attribute and if a NOLOGGING operation updates the segment, the online redo logfile will be updated with minimal information. This is preferred to complete operations faster but it's not supported in a primary database with the Data Guard configuration. When the redo/ archived logfile containing the NOLOGGING operation is used to recover the datafiles on the standby database, Oracle invalidates such blocks and the error ORA-26040 along with error ORA-1578 are reported by SQL statements in the next block reads. You can see the following errors if operations are performed by NOLOGGING:

ORA-01578: ORACLE data block corrupted (file # 4, block # 84)
ORA-01110: data file 4: ' /u01/app/oracle/oradata/orcl/users01.dbf' 
ORA-26040: Data block was loaded using the NOLOGGING option

Perform the following steps on the primary database:
1. Check the force logging status as follows: 
SQL> select name, force_logging from v$database;
 NAME FOR --------- --- ORCL NO 

2. Enable the force logging mode as follows:
 Enabling Force Logging on Primary Database is mandatory.
 SQL> alter database force logging;
 Database altered.
 3. Check the force logging status again as follows: 
SQL> select name,force_logging from v$database; 
NAME FOR --------- --- ORCL YES 
In the alert log, you'll see following lines: 
alter database force logging 
ALTER DATABASE FORCE LOGGING command is waiting for existing direct writes to finish. 
This may take a long time.
 Completed: alter database force logging


No comments:

Post a Comment