Oracle 11g RDBMS - Renaming the Oracle Database (SID) without changing the DB ID using DBNEWID utility

DBNEWID is a Oracle Database utility to perform the following:
(i) Only the DBID of a database
(ii) Only the DBNAME of a database
(iii) Both the DBNAME and DBID of a database

What is a DBID?
The DBID is an internal, unique identifier for a database  that Oracle generates when a database is created. RMAN uses the DBID to identify databases.

When the DBID of a database is changed, all previous backups and archived logs of the database become unusable. This is similar to creating a database except that the data is already in the datafiles. You must open the database using RESETLOGS. If you only change DB_NAME then old backups are still USABLE and you NO NEED to open the database with RESETLOGS options.

I happen to perform  the option (ii)  for one of the databases -  renaming DBNAME.

Goal: Rename database from MISCTST to MISCDEV.

$ sqlplus / as sysdba
SQL> select dbid,open_mode from v$database;

      DBID OPEN_MODE
---------- --------------------
2725577770 READ WRITE

SQL> SELECT DECODE(value, NULL, 'PFILE', 'SPFILE') "Init File Type" FROM sys.v_$parameter WHERE name = 'spfile';

Init F
------
PFILE

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>startup mount;
ORACLE instance started.

Total System Global Area  217157632 bytes
Fixed Size                  2168376 bytes
Variable Size             159386056 bytes
Database Buffers           50331648 bytes
Redo Buffers                5271552 bytes
Database mounted.
SQL>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
$
$ nid TARGET=/ as sysdba DBNAME=MISCDEV SETNAME=YES

DBNEWID: Release 11.2.0.1.0 - Production on Tue Oct 7 15:34:36 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Password:
Connected to database MISCTST (DBID=2725577770)

Connected to server version 11.2.0

Control Files in database:
    /m03/oradata/control01.ctl
    /m04/oradata/control02.ctl
    /m05/oradata/control03.ctl

Change database name of database MISCTST to MISCDEV? (Y/[N]) => Y

Proceeding with operation
Changing database name from MISCTST to MISCDEV
    Control File /m03/oradata/control01.ctl - modified
    Control File /m04/oradata/control02.ctl - modified
    Control File /m05/oradata/control03.ctl - modified
    Datafile /m05/oradata/system01.db - wrote new name
    Datafile /m05/oradata/undotbs01.db - wrote new name
    Datafile /m05/oradata/sysaux01.db - wrote new name
    Datafile /m05/oradata/users01.db - wrote new name
    Datafile /m05/oradata/appdata01.db - wrote new name
    Datafile /m05/oradata/POMSDATA.db - wrote new name
    Datafile /m05/oradata/temp01.db - wrote new name
    Control File /m03/oradata/control01.ctl - wrote new name
    Control File /m04/oradata/control02.ctl - wrote new name
    Control File /m05/oradata/control03.ctl - wrote new name
    Instance shut down

Database name changed to MISCDEV.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID - Completed succesfully.

$

Now  change the init parameter DB_NAME from MISCTST to MISCDEV

cp -p initMISCTST.ora initMISCDEV.ora
db_name='MISCDEV'

Recreate the oracle password file :

orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password='abc!xyz' entries=10 force=y

Change the SID in $ORACLE_HOME/network/admin/tnsnames.ora and $ORACLE_HOME/network/admin/listener.ora
$ lsnrctl start

$ export ORACLE_SID=MISCDEV
$ sqlplus / as sysdba
SQL>startup
ORACLE instance started.

Total System Global Area  263049216 bytes
Fixed Size                  2168896 bytes
Variable Size             104859584 bytes
Database Buffers          150994944 bytes
Redo Buffers                5025792 bytes
Database mounted.
Database opened.
SQL>select dbid,open_mode from v$database;

      DBID OPEN_MODE
---------- --------------------
2725577770 READ WRITE

SQL>

1 comment:

  1. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Oracle 11g, kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on Oracle 11g. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us:
    Name : Arunkumar U
    Email : arun@maxmunus.com
    Skype id: training_maxmunus
    Contact No.-+91-9738507310
    Company Website –http://www.maxmunus.com


    ReplyDelete