Last week my application was abnormal due a datafile was offline suddenly. I checked that datafile need to be recovered. And there was the good point of oracle which could recover datafile in runtime. It meant we did not need to stop running application. Below are steps to recover datafile in oracle :
1. Login as sysdba
% sqlplus / as sysdba
2. Checking datafile that needs to recover
SQL> select * from v$recover_file;
or
SQL> select * from v$datafile where status in ('OFFLINE', 'RECOVER', 'SYSOFF');
This must give row/rows back as result.
3. Recover and bring online datafile
SQL> recover datafile '';
SQL> alter database datafile online;
4. Re-check by execute step no 2
And it must not give row/rows back as result
It's so simple but very usefull in daily maintenance. But you must investigate further the root cause which is caused that datafile offline and need to be recovered.
1. Login as sysdba
% sqlplus / as sysdba
2. Checking datafile that needs to recover
SQL> select * from v$recover_file;
or
SQL> select * from v$datafile where status in ('OFFLINE', 'RECOVER', 'SYSOFF');
This must give row/rows back as result.
3. Recover and bring online datafile
SQL> recover datafile '
SQL> alter database datafile
4. Re-check by execute step no 2
And it must not give row/rows back as result
It's so simple but very usefull in daily maintenance. But you must investigate further the root cause which is caused that datafile offline and need to be recovered.