Database Reference
In-Depth Information
■
If you don't specify
SET DATABASE
in the top line of the prior script, when you run the script (as shown later in
this example), you'll receive an error such as this:
ORA-01161: database name ... in file header does not match
.
Note
Create an
init.ora
file that matches the new database name:
4.
$ cd $ORACLE_HOME/dbs
$ cp init<old_sid>.ora init<new_sid>.ora
$ cp inito12c.ora initDEVDB.ora
Modify the
DB_NAME
variable within the new
init.ora
file (in this example, it's set to
DEVDB
):
5.
db_name='DEVDB'
Set the
ORACLE_SID
OS variable to reflect the new
SID
name (in this example, it's set to
DEVDB
):
6.
$ echo $ORACLE_SID
DEVDB
7.
Start up the instance in nomount mode:
SQL> startup nomount;
8.
Run the trace file (from step 2) to re-create the control file:
SQL> @/tmp/cf.sql
■
In this example the control files already exist in the location specified by the
CONTROL_FILES
initialization
parameter; therefore, the
REUSE
parameter is used in the
CREATE CONTROL FILE
statement.
Note
Open the database with
OPEN RESETLOGS
:
9.
SQL> alter database open resetlogs;
If successful, you should have a database that is a copy of the original database. All the data files, control files,
archive redo logs, and online redo logs are in the new locations, and the database has a new name.
10.
As a last step, ensure that your temporary tablespace exists:
ALTER TABLESPACE TEMP ADD TEMPFILE '/ora01/dbfile/DEVDB/temp01.dbf'
SIZE 104857600 REUSE AUTOEXTEND OFF;