HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

ORA-01113: file # needs media recovery ORA-01110

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
fileneedsrecovery01113ora01110media

Problem

I have mistakenly added datafile to the tablespace... And was trying to drop it. I run the following:

alter database datafile 'datafile_name'  OFFLINE;


now when I run

alter database datafile 'datafile_name'  ONLINE;


it shows

ORA-01113: file 30 needs media recovery
ORA-01110: data file 30: 'datafile_name'


also status of the file is RECOVER... What can I do? I cant restart database....

Solution

Found the answer:

SQL> recover datafile 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE02.DBF';

alter database datafile 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE02.DBF' online;

alter  TABLESPACE EXAMPLE  drop datafile  'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE02.DBF'


But for production DB it needs a lot of time to recover... Can't I drop that file without recovering it?

One more question...
Another datafile was available during adding that file.. is there any chance that newly created datafile was used for storing data? I think oracle uses datafile until it will not exceed its maximum size and then switching to another available file... is not it so?

I am asking this because I want to be sure that newly created file doesn't contain any necessary data...

Code Snippets

SQL> recover datafile 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE02.DBF';

alter database datafile 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE02.DBF' online;

alter  TABLESPACE EXAMPLE  drop datafile  'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE02.DBF'

Context

StackExchange Database Administrators Q#5570, answer score: 6

Revisions (0)

No revisions yet.