Updating the Control File


In the following cases, you will have to update the control file before you restore data:

·        The saved data files are to be restored on another hard disk, in a new directory or under new names.

·        The status (ONLINE or OFFLINE) of one or several data files must be changed for the recovery to be continued.

The control file records the name or the path and the status of each data file in the database. You can update these specifications, which control the recovery process, with Oracle commands.

If a disk error has occurred, for example, it might be necessary to restore the tablespaces in question on another disk. After you have restored the tablespaces, you have to update the path of the affected files in the control file.


Changing the Path Specifications

SAP recommends using the first of the following methods to rename files.

·        Mount the database.  Enter the following SQLPLUS commands:

connect / as sysdba

startup mount

To update the path of data files in the control file, use the SQLPLUS command

alter database rename file '<file name>' to '<file name>';

The target file must exist; the name of the source file must agree with that in the control file.

You can also specify a list of file names, to rename all the files at once.  However, note that problems during renaming are easier to diagnose if you rename the files individually.

·        You can also change the paths of the data files of a tablespace when the database is running. Set the corresponding tablespace to OFFLINE before renaming. Use the following SQLPLUS commands:

alter tablespace <tablespace name> offline;

alter tablespace <tablespace name> rename datafile
'<file name1>' [, '<file name2>',...] to '<file name1>' [, '<file name2>',...];

You have to enter this command separately for each tablespace in which you have to change the file information.

The target file must exist; the name of the respective source files must agree with those in the control file.

Setting Files to ONLINE

If the data files of a tablespace are OFFLINE, when the database crashes or was stopped with shutdown abort and a recovery is necessary, you might have to reset the files that belong to this tablespace to ONLINE again.

To do this, use the following SQLPLUS commands:

connect / as sysdba
startup mount
alter database datafile '<complete file name>' online;