1. Recreate the Datafile (No Backup Method)
This uses the control file to "re-initialize" the file.
Warning: This only works if you have all archive logs since the file was first added to the database.
ERROR at line 1:
ORA-01122: database file 27 failed verification check
ORA-01110: data file 27: '/pac/instance/data/cim_dat13.dbf'
ORA-01210: data file header is media corrupt
-- Step 1: Identify and offline the file
ALTER DATABASE DATAFILE 27 OFFLINE;
-- Step 2: Recreate the empty structure
ALTER DATABASE CREATE DATAFILE 27;
-- OR to a new path if the old disk is failing:
ALTER DATABASE CREATE DATAFILE 27 AS '/pac/instance/data/cim_dat13.dbf';
-- Step 3: Apply the transactions from logs
RECOVER DATAFILE 27;
-- Step 4: Bring it back to the database
ALTER DATABASE DATAFILE 27 ONLINE;
2.datafile using rman:
RMAN> RUN {
SET NEWNAME FOR DATAFILE 27 TO '/pac/instance/data/cim_dat13.dbf'; -- Optional: change path
RESTORE DATAFILE 27; -- RMAN creates the file if it doesn't exist
RECOVER DATAFILE 27;
}
3. Block Media Recovery (Repairing specific errors)
If the header is okay but specific data blocks are corrupted (e.g., ORA-01578),
you can repair just those blocks without taking the whole file offline.
RMAN will use the archivelogs to "re-build" the block.
-- Repair a specific block in a file
RMAN> RECOVER DATAFILE 27 BLOCK 1;
-- Repair all blocks listed in V$DATABASE_BLOCK_CORRUPTION
RMAN> RECOVER CORRUPTION LIST;
4. Point-in-Time Recovery (PITR)
While PITR usually requires a backup, if you are performing a RECOVER DATABASE and want to stop at
a specific point because you are missing later logs, you can use these variants:
-- Stop recovery at a specific time
SQL> RECOVER DATABASE UNTIL TIME '2023-10-27:14:00:00';
-- Stop recovery at a specific System Change Number (SCN)
SQL> RECOVER DATABASE UNTIL SCN 123456789;
-- Manually apply logs until you choose to stop
SQL> RECOVER DATABASE UNTIL CANCEL;
5. Tablespace-Level Recovery
If multiple files in a single tablespace are corrupted, you can recover them together.
SQL> ALTER TABLESPACE cim_data_ts OFFLINE;
SQL> RECOVER TABLESPACE cim_data_ts;
SQL> ALTER TABLESPACE cim_data_ts ONLINE;
6. Critical Constraints
The "SYSTEM" Restriction: You generally cannot recreate the SYSTEM tablespace (Datafile 1)
this way because the database needs it just to read the logs and control files.
Gap in Logs: If you are missing even one archivelog in the sequence, the RECOVER command
will fail with an ORA-00308 (archived log not found).
Saturday, April 11, 2026
Recovery option with only archivelogs in oracle db
Subscribe to:
Post Comments (Atom)
Enable OpenSSH on Windows 11
Step 1: Install OpenSSH Server You can do this via PowerShell (run as Administrator ): Check if it's already available: Get-WindowsCapab...
-
Action Full Command Description Update statistics for a specific table EXEC DBMS_STATS.GATHER_TABLE_STATS('HR', 'EMPLOYEES...
-
If the ALTER SYSTEM SUSPEND statement is entered on one system in an Oracle RAC configuration, then the internal locking mechanisms propagat...
No comments:
Post a Comment