Database Reference
In-Depth Information
Now, you can update the control file to be aware of the new file name:
alter database rename file
'/u01/dbfile/O12C/system01.dbf',
'/u01/dbfile/O12C/sysaux01.dbf',
'/u01/dbfile/O12C/undotbs01.dbf'
to
'/u02/dbfile/O12C/system01.dbf',
'/u02/dbfile/O12C/sysaux01.dbf',
'/u02/dbfile/O12C/undotbs01.dbf';
You should be able to open your database:
SQL> alter database open;
Re-Creating the Control File and OS Commands
Another way you can relocate all data files in a database is to use a combination of a re-created control file and OS
commands. The steps for this operation are as follows:
1.
Create a trace file that contains a
CREATE CONTROLFILE
statement.
2.
Modify the trace file to display the new location of the data files.
3.
Shut down the database.
4.
Physically move the data files, using an OS command.
5.
Start the database in nomount mode.
6.
Run the
CREATE CONTROLFILE
command.
■
When you re-create a control file, be aware that any rMan information that was contained in the file will be
lost. if you're not using a recovery catalog, you can repopulate the control file with rMan backup information, using the
rMan
CATALOG
command.
Note
The following example walks through the previous steps. First, you write a
CREATE CONTROLFILE
statement to a
trace file via an
ALTER DATABASE BACKUP CONTROLFILE TO TRACE
statement:
SQL> alter database backup controlfile to trace as '/tmp/mv.sql' noresetlogs;
There are a couple of items to note about the prior statement. First, a file named
mv.sql
is created in the
/tmp
directory; this file contains a
CREATE CONTROLFILE
statement. Second, the prior statement uses the
NORESETLOGS
clause; this instructs Oracle to write only one SQL statement to the trace file. If you don't specify
NORESETLOGS
, Oracle
writes two SQL statements to the trace file: one to re-create the control file with the
NORESETLOGS
option and one to
re-create the control file with
RESETLOGS
. Normally, you know whether you want to reset the online redo logs as
part of re-creating the control file. In this case, you know that you don't need to reset the online redo logs when you
re-create the control file (because the online redo logs haven't been damaged and are still in the normal location for
the database).