ORA-00742: Log read detects lost write in thread 1 sequence xxxxx block xxxxx

Learn how to recover an Oracle database after a power failure on Windows Server. Fix ORA-00742 lost write error using incomplete recovery and RESETLOG

Introduction

Oracle databases running on Windows Server are highly sensitive to unexpected shutdowns. A sudden power failure can interrupt redo log writes and cause the database to fail during startup.

In this post, I explain a real-world Oracle recovery scenario where the database failed to open after a power outage and showed ORA-00742 lost write errors. I also cover why the error occurred, how it was fixed, and how to prevent it in the future.

Error Encountered While Opening Database

After the server reboot, the database failed to open using the normal command:
SQL> ALTER DATABASE OPEN;
Oracle returned the following errors:
ORA-00742: Log read detects lost write in thread 1
ORA-00312: online log 3 thread 1
D:\...\REDO03.LOG
An attempt to force open the database using RESETLOGS also failed initially:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery

Why ORA-00742 Lost Write Error Occurs After Power Failure

During the power failure:
  • Oracle was actively writing redo data
  • Windows Server did not flush disk cache
  • Redo log blocks were partially written
  • Oracle later detected inconsistency while reading redo logs
This condition is called a lost write.

To protect data integrity, Oracle blocks the database from opening when redo corruption is detected. This is expected behavior and not an Oracle bug.

Why ALTER DATABASE OPEN RESETLOGS Failed Initially

The RESETLOGS option cannot be used directly.
SQL> ALTER DATABASE OPEN RESETLOGS;
Only after an incomplete recovery.
Since recovery was not performed yet, Oracle correctly raised ORA-01139.

How to Fix ORA-00742 Using Incomplete Recovery and RESETLOGS

Because the redo log was corrupted, incomplete recovery was required.

Step 1: Start Database in Mount Mode
SQL> startup mount;
Step 2: Perform Incomplete Recovery
SQL> recover database until cancel;
Oracle prompted for redo logs:
Specify log: {<RET> | suggested | filename | AUTO | CANCEL}
Provide the full path of the affected redo log file when prompted:
D:\...\REDO03.LOG
The available redo was applied successfully:
Log applied.
Media recovery complete.
Step 3: Open Database with RESETLOGS
SQL> alter database open resetlogs;
Output:
Database altered.
The database opened successfully.

What RESETLOGS Does Internally

When RESETLOGS is executed, Oracle:
  • Discards old redo log history
  • Creates new redo log sequences
  • Starts a new database incarnation
  • Ignores corrupted redo logs
This allows the database to open in a consistent and safe state.

Root Cause Summary

  • Sudden power failure on Windows Server
  • Disk cache not flushed properly
  • Redo log corruption (lost write)
  • Oracle blocked database open to prevent corruption
This issue occurred at the OS/storage level, not due to Oracle software.

Conclusion: A power failure on Windows Server can corrupt Oracle redo logs and prevent the database from opening. Oracle detects this condition early to protect data integrity.

In this case, the database was successfully recovered using incomplete recovery followed by RESETLOGS. Understanding this recovery method is essential for handling unexpected crashes in production environments.

Post a Comment

© Ayaan Israr - All rights reserved. Premium By Ayaan Israr