官术网_书友最值得收藏!

Time for action – enabling the archive log mode

Perform the following steps on the primary database:

  1. Check whether archiving has been enabled or disabled, as follows:
    SQL> archive log list
    Database log mode No Archive Mode
    Automatic archival Disabled
    Archive destination USE_DB_RECOVERY_FILE_DEST
    Oldest online log sequence 6
    Current log sequence 8
    
  2. Perform a clean shutdown, as follows:
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    
    Tip

    Ensure that you have performed a clean shutdown; if not, you may see this error: ORA-00265: instance recovery required, cannot set ARCHIVELOG mode.

  3. Start the database in the mount state.
    SQL>startup mount
    ORACLE instance started.
    Total System Global Area 818401280 bytes
    Fixed Size 2217792 bytes
    Variable Size 515901632 bytes
    Database Buffers 297795584 bytes
    Redo Buffers 2486272 bytes
    Database mounted.
    
  4. Enable the archive log mode.
    SQL> alter database archivelog;
    Database altered.
    
  5. Open the database as follows:
    SQL> alter database open;
    Database altered.
    
  6. Check if archiving has been enabled or not.
    SQL> archive log list
    Database log mode Archive Mode
    Automatic archival Enabled
    Archive destination USE_DB_RECOVERY_FILE_DEST
    Oldest online log sequence 6
    Next log sequence to archive 8
    Current log sequence 8
    
    Tip

    After enabling the archive log mode, perform a log switch and check whether the archive log is created or not from the v$archived_log view, as follows:

    SQL> select * from v$archived_log;

What just happened?

After mentioning some considerations about Data Guard, we've completed the mandatory task of enabling the archive log mode on the primary database.

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
主站蜘蛛池模板: 南丹县| 颍上县| 云林县| 柏乡县| 泰来县| 柏乡县| 商南县| 新郑市| 九江县| 玛曲县| 湖口县| 宣汉县| 龙海市| 元氏县| 大足县| 稷山县| 尉氏县| 天柱县| 浑源县| 长泰县| 新乡县| 高雄市| 开江县| 靖江市| 嘉义市| 礼泉县| 玉溪市| 红河县| 陕西省| 饶平县| 昭通市| 迁安市| 新竹市| 棋牌| 兴国县| 奈曼旗| 青冈县| 敦化市| 许昌县| 大同县| 介休市|