Basic Oracle Concepts and Programming Question:

How Remove Data Files before opening a Database?

Tweet Share WhatsApp

Answers:

Answer #1Let's say you have a corrupted data file or lost a data file. Oracle can mount the database. But it will not open the database. What you can do is to set the bad data file as offline befor opening the database. The tutorial exercise shows you how to set two data files offline and open the database without them:

>sqlplus /nolog

SQL> connect SYSTEM/globalguideline AS SYSDBA

SQL> STARTUP MOUNT;
ORACLE instance started.
<pre>Total System Global Area 100663296 bytes
Fixed Size 1285956 bytes
Variable Size 58720444 bytes
Database Buffers 37748736 bytes
Redo Buffers 2908160 bytes
Database mounted.</pre>
SQL> ALTER DATABASE DATAFILE ' empmy_space.dbf'
2 OFFLINE DROP;
Database altered.

SQL> ALTER DATABASE DATAFILE ' empmy_space_2.dbf'
2 OFFLINE DROP;
Database altered.


Answer #2SQL> ALTER DATABASE OPEN;
Database altered.

SQL> col file_name format a36;
SQL> col tablespace_name format a16;
SQL> SELECT TABLESPACE_NAME, FILE_NAME, BYTES
2 FROM DBA_DATA_FILES;

<pre>TABLESPACE_NAME FILE_NAME BYTES
--------------- --------------------------------- ---------
USERS C:ORACLEXEORADATAXEUSERS.DBF 104857600
SYSAUX C:ORACLEXEORADATAXESYSAUX.DBF 503316480
UNDO C:ORACLEXEORADATAXEUNDO.DBF 94371840
SYSTEM C:ORACLEXEORADATAXESYSTEM.DBF 367001600
MY_SPACE C:TEMPMY_SPACE.DBF
MY_SPACE C:TEMPMY_SPACE_2.DBF</pre>

At this point, if you don't care about the data in MY_SPACE, you can drop it now with the database opened.

Download Oracle Database PDF Read All 430 Oracle Database Questions
Previous QuestionNext Question
What Happens If You Lost a Data File?How To Create an Oracle Database?