DEV Community

umzzil nng
umzzil nng

Posted on Originally published at oraerror.com

Oracle ORA-16005 Error: Causes and Solutions Complete Guide

ORA-16005: database requires recovery — What You Need to Know

ORA-16005 is an Oracle error indicating that the database cannot be opened because it requires recovery before transitioning to a normal operational state. This error most commonly appears in Oracle Data Guard (Standby) environments or after an abnormal database shutdown where uncommitted transactions remain unresolved. Left unaddressed, it poses a serious risk to data integrity and database availability.


Top 3 Causes

1. MRP Process Stopped on Standby Database

In a Data Guard environment, the Managed Recovery Process (MRP) must continuously apply Redo Logs received from the Primary. If MRP stops unexpectedly and you attempt to open the Standby database, ORA-16005 is triggered.

-- Check MRP status on Standby
SELECT PROCESS, STATUS, SEQUENCE#
FROM V$MANAGED_STANDBY
WHERE PROCESS LIKE 'MRP%';

-- Restart MRP with Real-Time Apply
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
    USING CURRENT LOGFILE DISCONNECT FROM SESSION;

-- Verify Archive Log Gap
SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE#
FROM V$ARCHIVE_GAP;
Enter fullscreen mode Exit fullscreen mode

2. Abnormal Shutdown Leaving Incomplete Transactions

When a database is shut down via SHUTDOWN ABORT or crashes due to a system failure, incomplete transactions remain in the Online Redo Logs. Oracle detects this and requires Instance Recovery before allowing the database to open.

-- Mount the database and perform recovery
STARTUP MOUNT;

-- Perform automatic recovery
RECOVER AUTOMATIC DATABASE;

-- Open without RESETLOGS (complete recovery)
ALTER DATABASE OPEN;

-- If incomplete recovery, use RESETLOGS
ALTER DATABASE OPEN RESETLOGS;
Enter fullscreen mode Exit fullscreen mode

3. SCN Mismatch After RESETLOGS on Primary

If the Primary database was opened with RESETLOGS after incomplete recovery, the Standby's SCN no longer aligns with the Primary. Attempting to open the Standby without resynchronization causes ORA-16005.

-- Check RESETLOGS SCN on Primary
SELECT RESETLOGS_CHANGE#, RESETLOGS_TIME
FROM V$DATABASE;

-- On Standby: flashback to just before the RESETLOGS SCN
STARTUP MOUNT;
FLASHBACK DATABASE TO SCN <resetlogs_scn - 1>;

-- Restart Managed Recovery
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
    USING CURRENT LOGFILE DISCONNECT FROM SESSION;

-- Confirm synchronization
SELECT DB_UNIQUE_NAME, DATABASE_ROLE,
       OPEN_MODE, PROTECTION_MODE
FROM V$DATABASE;
Enter fullscreen mode Exit fullscreen mode

Quick Fix Solutions

  1. Restart MRP on Standby — Cancel and re-enable Managed Recovery to resume Redo Log application.
  2. Perform Instance Recovery — STARTUP MOUNT followed by RECOVER AUTOMATIC DATABASE handles most abnormal shutdown cases automatically.
  3. Use Flashback Database — If SCN mismatch occurred after a RESETLOGS event, Flashback Database is the fastest non-rebuild fix.
  4. Rebuild Standby — When Flashback is unavailable and SCN is too far out of sync, a full Standby rebuild from Primary RMAN backup is the safest option.

Prevention Tips

Monitor Data Guard Continuously

Set up automated monitoring for MRP status and Archive Log Gaps. Use Oracle Enterprise Manager or a custom script scheduled via DBMS_SCHEDULER to alert your team immediately when MRP stops or a log gap is detected.

-- Quick health check query (run on Standby)
SELECT PROCESS, STATUS, SEQUENCE#,
       TO_CHAR(SYSDATE,'YYYY-MM-DD HH24:MI:SS') AS CHECKED_AT
FROM V$MANAGED_STANDBY
WHERE PROCESS IN ('MRP0','RFS');
Enter fullscreen mode Exit fullscreen mode

Enable Flashback Database and Run Regular DR Drills

Always keep Flashback Database enabled on both Primary and Standby. Set an adequate retention target and conduct quarterly Switchover/Failover drills so your team can confidently resolve ORA-16005 scenarios under pressure.

-- Enable Flashback Database (MOUNT state required)
ALTER DATABASE FLASHBACK ON;

-- Set 2-day retention
ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET = 2880;

-- Verify Flashback status
SELECT FLASHBACK_ON FROM V$DATABASE;
Enter fullscreen mode Exit fullscreen mode

Related Errors

Error Code Description
ORA-01113 File needs media recovery — often appears alongside ORA-16005
ORA-01194 File needs more recovery — common after incomplete recovery
ORA-10458 Standby database requires recovery — a precursor warning
ORA-00283 Recovery session cancelled due to errors

📖 Want a more detailed guide?
Check out the full in-depth version (Korean) on oraerror.com — includes detailed analysis, additional SQL examples, and prevention tips.

Top comments (0)