About Me

Sunday 30 October 2011

How to recover a datafile which is not backed up

Suppose a situation in which you loose a datafile for which you dont have prior backup.These are the steps how you can recover the datafile in this kind of situations....

Let me assume that i lost a datafile ts1.dbf from /disk1/oradata/dharam/ts1.dbf  location.


Please make sure that 

1.You are running your database in ARCHIVELOG mode and
2.You have all archive logs available.


SYS> startup
ORACLE instance started.

ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 6: '/disk1/oradata/dharam/ts1.dbf'


SYS> alter database datafile 6 offline;

Database altered.

SYS> alter database open;

Database altered.

SYS> select * from v$recover_file;

FILE# ERROR TIME
---------- ----------------------------------- ---------
  6 FILE NOT FOUND

SQL> select file#,status from v$datafile;

FILE# STATUS
---------- -------
1 SYSTEM
2 ONLINE
3 ONLINE
4 ONLINE
5 ONLINE
6 RECOVER

6 rows selected.


SQL> alter database create datafile 6 '/disk1/oradata/dharam/ts1.dbf';

Database altered.
 
Recover your datafile 6 without backup

]$rman target /

RMAN> recover datafile 6;

Bring datafile online

SYS> alter database datafile 6 online;

Database altered.

SQL> select file#, status from v$datafile;

FILE# STATUS
---------- -------
1 SYSTEM
2 ONLINE
3 ONLINE
4 ONLINE
5 ONLINE
6 ONLINE






No comments:

Post a Comment