Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Renaming Database Considerations

1. Renaming of database can be done either by NID or creating a new Control file.
2. Assume we use NID utility to change the DB name. In this case the DB name & ID will be
changed. Since we are using ASM diskgroup, the datafiles which are created under the old
DB name will not be moved to new DB name. Same is true with re-creation of control file.
This can be understood by the below example
Example:
Existing DB Name : K2DEMCUS
New DB Name: K2TRNCUS
Current Datafile Location: '+DATA/k2demcus/datafile/system.xxxxxxx’
The highlighted location is not going to change after NID/create control file statement. But if we
start adding new datafiles under the existing tablespaces, the datafile will start getting created under
the below location
'+DATA/k2trncus/datafile/system.xxxxxxxx’

3. In the above case, there will be two different directories which will be created for the same
database. The DB will work absolutely fine & there is no issue with the DB functioning but
it’s just like old DB name still persists.
4. To overcome this, we have 2 options:
a. We are not going to add any datafiles, just resizing the existing files until we get the
opportunity to do refresh again & then that moment the new directory structure will
come into picture
b. We need extra space in ASM to copy the files from current directory location to new
directory location. So at the same time we will be having same datafiles at 2 different
location.
5. Illustrative steps to perform NID & changing the directory location for the datafiles

NID utility

i. Start the database in mount mode. Check the DB_NAME & INSTANCE_NAME parameter.
It should be K2DEMCUS
ii. fire the below command
 nid target=/ setname=yes dbname=K2TRNCUS
iii. Create a pfile from spfile & change the new database name related parameters including
control file location, DB_NAME etc.
 sql>create pfile from spfile;
iv. Start the database with pfile & create the spfile from that pfile. Shutdown the DB once again
& start the DB with spfile.
v. connect to RMAN & execute the below command
-> rman target /
-> RMAN> restore control file from ‘+DATA/k2demcus/controlfile/current.xxxxx’;
Repeat the same command if there is multiplexing of the control files.
vi. After successful restoration of control file, mount the database from sqlplus.
 SQL> alter database mount;
vii. Once the Database is mounted, proceed with RMAN prompt.
 RMAN> report schema;

The above command will show all the datafiles & tempfiles in the database.
 RMAN> backup as copy database;
This command will start copying the existing files to new DB location. For example
Current location is: '+DATA/k2demcus/datafile/system.xxxxxxx’
New location where file will be created is: '+DATA/k2trncus/datafile/system.xxxxxxxx’
So we will be having copies of the same file at 2 different locations. Once the copy database is
completed, fire the below command to see whether files are copied or not.
 RMAN> list copy of database;
Once we see all the files are copied to the new destination, make a switch for the datafiles using the
below command
 RMAN> switch database to copy;
viii. Open the database from sql prompt & add new tempfile
 sql> alter database open;
 sql> alter tablespace temp add tempfile ‘+DATA’;
ix. Do general health checkup for the database.

You might also like