Friday, January 30, 2009

Restore oracle on loosing datafiles

The solution to the missing datafiles is to drop the affected tablespace where has incomplete datafiles, and then recreate the tablespace and import the data into the tablespace from backup. However, the steps are not so straight forward.

1. Run SQL*Plus.
2. Connect to database as SYSDBA with this query:

CONNECT / AS SYSDBA
3. Mount the database instead of starting it up:

STARTUP MOUNT;
4. Issue the following command to bring the missing datafile offline so that Oracle won’t trying to connect and access the datafile anymore:

ALTER DATABASE DATAFILE ‘’ OFFLINE DROP;

Repeat the command for every datafiles that unaccounted for.
5. Now start the database proper:

ALTER DATABASE OPEN;
6. As the tablespace has damaged, drop it to recreate from fresh backup.

DROP TABLESPACE INCLUDING CONTENTS;

Thnx to Enx who thnx someone else....