Sunday, May 25, 2025

How to recover oracle database from loss of critical data files (system.dbf) ?

Recover database from loss of critical data files 



*Should we have good backup 


SQL> show pdbs


    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                       READ ONLY  NO

         3 PDB                            MOUNTED

         4 DEMO1                          MOUNTED

SQL> alter pluggable database all open ;

alter pluggable database all open

*

ERROR at line 1:

ORA-01116: error in opening database file 1

ORA-01110: data file 1: '/u01/app/oracle/oradata/DB1/system01.dbf'

ORA-27041: unable to open file

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3



SQL>



SQL> shut abort ;

ORACLE instance shut down.

SQL> exit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

[oracle@orcl DB1]$

[oracle@orcl DB1]$ rman target /


Recovery Manager: Release 19.0.0.0.0 - Production on Sun May 25 08:56:06 2025

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.


connected to target database (not started)


RMAN> startup mount ;


Oracle instance started

database mounted


Total System Global Area    2432695832 bytes


Fixed Size                     9137688 bytes

Variable Size                553648128 bytes

Database Buffers            1862270976 bytes

Redo Buffers                   7639040 bytes


RMAN> restore datafile 1;


Starting restore at 25-MAY-25

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=257 device type=DISK


channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/DB1/system01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DB1/backupset/2025_05_25/o1_mf_nnndf_TAG20250525T081440_n35ncno8_.bkp

channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DB1/backupset/2025_05_25/o1_mf_nnndf_TAG20250525T081440_n35ncno8_.bkp tag=TAG20250525T081440

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:25

Finished restore at 25-MAY-25


RMAN> recover datafile 1;


Starting recover at 25-MAY-25

using channel ORA_DISK_1


starting media recovery

media recovery complete, elapsed time: 00:00:03


Finished recover at 25-MAY-25


RMAN> alter database open ;


Statement processed


RMAN> alter pluggable database all open ;


Statement processed


RMAN> exit



Recovery Manager complete.

[oracle@orcl DB1]$ sqlplus "/as sysdba"


SQL*Plus: Release 19.0.0.0.0 - Production on Sun May 25 08:58:08 2025

Version 19.3.0.0.0


Copyright (c) 1982, 2019, Oracle.  All rights reserved.



Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0


SQL> show pdbs


    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                       READ ONLY  NO

         3 PDB                            READ WRITE NO

         4 DEMO1                          READ WRITE NO

SQL>

No comments:

Post a Comment