[Recovery, 1] redo log recovery situations, redo logs

Source: Internet
Author: User

[Recovery, 1] redo log recovery situations, redo logs
Recovering After the Loss of Online Redo Log Files

If a media failure has affected the online redo logs of a database, then the appropriate recovery procedure depends on the following considerations:

  • The configuration of the online redo log: mirrored or non-mirrored

  • The type of media failure: temporary or permanent

  • The types of online redo log files affected by the media failure: current, active, unarchived, or inactive

Table 30-3 displaysV$LOGStatus information that can be crucial in a recovery situation involving online redo logs.

Table 30-3 STATUS Column of V $ LOG

Status Description

UNUSED

The online redo log has never been written.

CURRENT

The online redo log is active, that is, needed for instance recovery, and it is the log to which the database is currently writing. The redo log can be open or closed.

ACTIVE

The online redo log is active, that is, needed for instance recovery, but is not the log to which the database is currently writing. it may be in use for block recovery, and may or may not be archived.

CLEARING

The log is being re-created as an empty log afterALTER DATABASE CLEAR LOGFILEStatement. After the log is cleared, then the status changesUNUSED.

CLEARING_CURRENT

The current log is being cleared of a closed thread. The log can stay in this status if there is some failure in the switch such as an I/O error writing the new log header.

INACTIVE

The log is no longer needed for instance recovery. It may be in use for media recovery, and may or may not be archived.


Recovering After Losing a Member of a Multiplexed Online Redo Log Group

You can recover after losing a member of a multiplexed online redo log group. The database continues to function as usual during the following conditions:

If the online redo log of a database is multiplexed, and if at least one member of each online redo log group is not affected by the media failure, then the database continues functioning as usual, but error messages are written to the log writer trace file andalert_SID.logOf the database.

You can resolve the problem of a missing member of a multiplexed online redo log group by taking one of the following actions:

  • If the hardware problem is temporary, then correct it. The log writer process accesses the previusly unavailable online redo log files as if the problem never existed.

  • If the hardware problem is permanent, then drop the damaged member and add a new member by using the following procedure.

    Note:

    The newly added member provides no redundancy until the log group is reused.
Recovering After Losing All Members of an Online Redo Log Group

Restore an online redo log group after all its members are lost.

If a media failure damages all members of an online redo log group, then different scenarios can occur depending on the type of online redo log group affected by the failure and the archiving mode of the database.

If a media fault damages all log group members, failure in different scenarios depends on the log group type and database archiving mode.

If the damaged online redo log group is current and active, then it is needed for crash recovery; otherwise, it is not. Table 30-4 outlines the varous recovery scenarios.

If the current and active log groups are damaged, fault recovery is required.

Table 30-4 Recovering After the Loss of an Online Redo Log Group

If the Group Is... Then... And You shoshould...

Inactive

It is not needed for crash recovery

Clear the archived or unarchived group.

Active

It is needed for crash recovery

Attempt to issue a checkpoint and clear the log; if impossible, then you must either use Flashback Database or restore a backup and perform incomplete recovery up to the most recent available redo log.


Try to execute the checkpoint and clear logs. If not, you must either flash back to the database or use the dump backup to execute Incomplete recovery to the latest available redo logs.


Current

It is the redo log that the database is currently writing

Attempt to clear the log; if impossible, then you must either use Flashback Database or restore a backup and perform incomplete recovery up to the most recent available redo log.


To determine whether the damaged group is active or inactive.

Determine whether the damaged group is acitve or inactive

  1. Locate the file name of the lost redo log inV$LOGFILEAnd then look for the group number corresponding to it. For example, enter:

    SELECT GROUP#, STATUS, MEMBER FROM V$LOGFILE;GROUP#    STATUS       MEMBER-------   -----------  ---------------------0001                    /oracle/dbs/log1a.f0001                    /oracle/dbs/log1b.f0002      INVALID       /oracle/dbs/log2a.f0002      INVALID       /oracle/dbs/log2b.f0003                    /oracle/dbs/log3a.f0003                    /oracle/dbs/log3b.f
  2. Determine which groups are active.

    For example, execute the following SQL query (sample output sorted DED ):

    SELECT GROUP#, MEMBERS, STATUS, ARCHIVED FROM V$LOG;GROUP#  MEMBERS           STATUS     ARCHIVED------  -------           ---------  ----------- 0001   2                 INACTIVE   YES 0002   2                 ACTIVE     NO 0003   2                 CURRENT    NO
  3. Perform one of the following actions:

    • If the affected group is inactive, then follow the procedure in "Losing an Inactive Online Redo Log Group ".

    • If the affected group is active (as in the preceding example), then follow the procedure in "Losing an Active Online Redo Log Group ".



       
Losing an Inactive Online Redo Log Group

Lost inactive log Group

If all members of an online redo log groupINACTIVEStatus are damaged, then the procedure depends on whether you can fix the media problem that damaged the inactive redo log group. if the failure is temporary, then fix the problem. the log writer can reuse the redo log group when required. if the failure is permanent, then the damaged inactive online redo log group eventually halts normal database operation. reinitialize the damaged group manually by issuingALTER DATABASE CLEAR LOGFILEStatement as described in this section.

All inactive log group members are damaged. The program depends on whether you can locate the inactive log group's media problem (whether the log file is damaged). If the media fault is temporary, log writer can reuse the log group. If a media fault is permanent, the damaged inactive log Group stops normal database operations. Run the alter database clear logfile statement to manually reinitialize the damaged log group.

Clearing Inactive, Archived Redo

Clear inactive archived logs

You can clear an inactive redo log group when the database is open or closed. The procedure depends on whether the damaged group has been archived.

You can clear the inactive log group when the database is enabled or disabled. Depends on whether the corrupted log group is archived.

To clear an inactive, online redo log group that has been archived:

Clearing Inactive, Unarchived Redo

Clear inactive Unarchived logs

Clearing a not-yet-archived redo log allows it to be reused without archiving it. this action makes backups unusable if they were started before the last change in the log, unless the file was taken offline before the first change in the log. hence, if you need the cleared log file for recovery of a backup, then you cannot recover that backup. clearing a not-yet-archived-redo-log, prevents complete recovery from backups due to the missing log.

Logs that have not been archived can be reused. If the log is started before the last change, this operation will cause the backup to be unavailable, unless the log file is set to offline before the first change. After that, if you need to clear the logs for Backup recovery, you cannot back up and restore them.

To clear an inactive, online redo log group that has not been archived:

Clear an inactive log. The log is not archived:

Failure of clear logfile Operation Failed to clear log files

TheALTER DATABASE CLEAR LOGFILEStatement can fail with an I/O error due to media failure when it is not possible:

If the alter database clear logfile statement cannot perform the following operations, the I/O errors caused by media faults will fail,

  • Relocate the redo log file onto alternative media by re-creating it under the currently configured redo log file name

    Create a new log file using the name of the currently configured log file to migrate the log to another media

  • Reuse the currently configured log file name to re-create the redo log file because the name itself is invalid or unusable (for example, due to media failure)

    Re-use the name of the current configuration log file to re-create the log file because its own name is invalid or unavailable.

In these cases,ALTER DATABASE CLEAR LOGFILEStatement (before authentication ing the I/O error) wocould have successfully informed the control file that the log was being cleared and did not require archiving. the I/O error occurred at the step in whichCLEAR LOGFILEStatement attempted to create the new redo log file and write zeros to it. This fact is reflected inV$LOG.CLEARING_CURRENT.

In these cases, the alter database clear logfile statement

Losing an Active Online Redo Log Group

If the database is still running and the lost active redo log is not the current log, then issueALTER SYSTEM CHECKPOINTStatement. if the operation is successful, then the active redo log becomes inactive, and you can follow the procedure in "Losing an Inactive Online Redo Log Group ". if the operation is unsuccessful, or if your database has halted, then perform one of procedures in this section, depending on the archiving mode.

The current log is the oneLGWRIs currently writing to. IfLGWRI/O operation fails, then LGWR terminates and the instance fails. In this case, you must restore a backup, perform incomplete recovery, and open the database withRESETLOGSOption.

Recovering from the Loss of Active Logs in NOARCHIVELOG Mode

In this scenario, the database archiving mode isNOARCHIVELOG.

To recover from the loss of an active online log group in NOARCHIVELOG mode:

If the media failure is temporary, then correct the problem so that the database can reuse the group when required. If the media failure is not temporary, then use the following procedure.

Recovering from Loss of Active Logs in ARCHIVELOG Mode

In this scenario, the database archiving mode isARCHIVELOG.

To recover from loss of an active online redo log group in ARCHIVELOG mode:

Loss of Multiple Redo Log Groups

If you have lost multiple groups of the online redo log, then use the recovery method for the most difficult log to recover. the order of difficulty, from most difficult to least difficult, is as follows:






In oracle, if the redo log file is damaged, how should we restore it?

It's easy to go to rman
Redolog file loss:
Shutdown immediate;
Starup mount;
Alter database resetlogs; (this step may cause problems, add a sentence before this
Recover database until cancel;
And all the steps are repeat in sqlplus)

However, this method uses resetlogs, which may cause data loss.

The code of a flash database. Below I will explain in detail, kneel down to a log recovery code

Baidu search. If it doesn't work, you can change the search engine or keyword search more. google should have something in the academic field. You can find it by yourself.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.