Suppose you have one data file that is missing or corrupt, and you don’t have a backup of it, so you can’t restore and recover it. You can’t start your database in this situation:
SQL> startup;
ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 6: '/u01/dbfile/ O12C/reg_data01.dbf'
In this scenario, you’ll have to take the data file offline before you can start your database:
SQL> alter database datafile '/u01/dbfile/O12C/reg_data01.dbf' offline for drop;
Now, you can open your database:
SQL> alter database open;
Suppose you then attempt to run an RMAN backup:
RMAN> backup database;
The following error is thrown when RMAN encounters a data file that it can’t back up:
RMAN-03002: failure of backup command at ...
RMAN-06056: could not access datafile 6
In this situation, you’ll have to instruct RMAN to exclude the offline data file from the backup. The SKIP OFFLINE command instructs RMAN to ignore data files with an offline status:
RMAN> backup database skip offline;
If a file has gone completely missing, use SKIP INACCESSIBLE to instruct RMAN to ignore files that are not available on disk. This might happen if the data file was deleted using an OS command. Here is an example of excluding inaccessible data files from the RMAN backup:
RMAN> backup database skip inaccessible;
You can skip read-only, offline, and inaccessible data files with one command:
RMAN> backup database skip readonly skip offline skip inaccessible;
When dealing with offline and inaccessible files, you should figure out why the files are offline or inaccessible and try to resolve any issues.