Database Reference
In-Depth Information
although if anyone should try to use data that is in the missing data file they will get an error.
To perform this kind of recovery, you will need to first indicate to the database that the file is
in an offline state. You do this by using the ALTER DATABASE command, as shown here:
alter database datafile 4 offline;
alter database datafile 'C:\ORACLE\ORADATA\ORCL\USERS01.DBF' offline;
Now you will find that the STATUS column for this data file in V$DATAFILE will show that
the file has a RECOVER status, as shown here:
SQL> select file#, status from v$datafile;
FILE# STATUS
---------- -------
1 SYSTEM
2 ONLINE
3 ONLINE
4 RECOVER
You should also note that the status of the data file in the DBA_DATA_FILES view does not
change when you offline a file. It will still show as AVAILABLE . A row will also appear for the
data file you have taken offline in the V$RECOVER_FILE view.
Data File iDs
Did you notice in the ALTER DATABASE command where we used a number instead of the
location of the data file? This is the data file ID, and you can use the data file ID in lieu of
the entire path many times. You can find the data file ID in the V$DATAFILE and DBA_DATA_
FILES views, as shown here:
SQL> select file_id, file_name from dba_data_files;
FILE_ID FILE_NAME
---------- ----------------------------------------
4 C:\ORACLE\ORADATA\ORCL\USERS01.DBF
3 C:\ORACLE\ORADATA\ORCL\UNDOTBS01.DBF
2 C:\ORACLE\ORADATA\ORCL\SYSAUX01.DBF
1 C:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF
Recovering the Database
If you restore the database files to different locations, you will need to modify the data-
base parameter file and/or the database control file with the new file locations using the
ALTER SYSTEM command as demonstrated in optional steps 3 and 4 of Exercise 2.1.
Search WWH ::




Custom Search