Home > Oracle, RDBMS > Recovery of non system datafile.

Recovery of non system datafile.

Assumptions:

  • the database is in archive log mode
  • a solid cold backup is available

1. Database is open.
Users which use tablespace data from missing datafile get the follownig ORA-01116, ORA-01110 and/or ORA-27041 erros:

ORA-01116: error in opening database file 4
ORA-01110: data file 4: 'D:\oracle\oradata\ORACLE_SID\users01.dbf'
ORA-27041: unable to open file

Since the missing datafile is a non-system, the recovery can be done online. Users that does not use this tablespace data will continue to work as normal.

– identify the datafile which needs recovery

select * from v$recover_file;

– connect datafile with tablespace

select t.name, f.name
from v$tablespace t, v$datafile f
where t.ts# = f.ts#
and f.file# = <file_number>;

– offline the tablespace with immediate option

ALTER TABLESPACE <tablespace_name> OFFLINE IMMEDIATE;

– restore the missing datafile from the latest backup
– recover the datafile

RECOVER DATAFILE <file_number>;

– online the tablespace

ALTER TABLESPACE <tablespace_name> ONLINE;

2. Database is close.
We will be greeted with the ORA-01157 and ORA-01110 messages by Oracle, if any of the datafiles are missing:

ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: 'D:\oracle\oradata\ORACLE_SID\users01.dbf'

– mount the database

STARTUP MOUNT;

– identify the datafile which needs recovery

select * from v$recover_file;

– offline the missing datafile

ALTER DATABASE DATAFILE <file_number> OFFLINE;

– open the database

ALTER DATABASE OPEN;

– restore the missing file from the backup
– recover the datafile

RECOVER DATAFILE <file_number>;

– online the datafile

ALTER DATABASE DATAFILE <file_number> ONLINE;

Hope, this helps.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: