Wednesday, April 17, 2013

How to change db_name in oracle database using dbnewid utility ?

change db_name in oracle database using dbnewid



SQL> startup nomount
ORACLE instance started.

Total System Global Area  608174080 bytes
Fixed Size                  1220844 bytes
Variable Size             180358932 bytes
Database Buffers          423624704 bytes
Redo Buffers                2969600 bytes
SQL> alter database mount;

Database altered.

SQL> show parameter db_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      orcl
SQL>

[oracle@localhost ~]$ nid target=sys/orcl dbname=anurag setname=yes

DBNEWID: Release 10.2.0.1.0 - Production on Wed Apr 17 17:36:59 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to database ORCL (DBID=1334973392)

Connected to server version 10.2.0

Control Files in database:
    /oracle/product/10.2.0/oradata/orcl/control01.ctl
    /oracle/product/10.2.0/oradata/orcl/control02.ctl
    /oracle/product/10.2.0/oradata/orcl/control03.ctl

Change database name of database ORCL to ANURAG? (Y/[N]) => Y

Proceeding with operation
Changing database name from ORCL to ANURAG
    Control File /oracle/product/10.2.0/oradata/orcl/control01.ctl - modified
    Control File /oracle/product/10.2.0/oradata/orcl/control02.ctl - modified
    Control File /oracle/product/10.2.0/oradata/orcl/control03.ctl - modified
    Datafile /oracle/product/10.2.0/oradata/orcl/system01.dbf - wrote new name
    Datafile /oracle/product/10.2.0/oradata/orcl/undotbs01.dbf - wrote new name
    Datafile /oracle/product/10.2.0/oradata/orcl/sysaux01.dbf - wrote new name
    Datafile /oracle/product/10.2.0/oradata/orcl/users01.dbf - wrote new name
    Datafile /oracle/product/10.2.0/oradata/orcl/example01.dbf - wrote new name
    Datafile /oracle/product/10.2.0/oradata/orcl/temp01.dbf - wrote new name
    Control File /oracle/product/10.2.0/oradata/orcl/control01.ctl - wrote new name
    Control File /oracle/product/10.2.0/oradata/orcl/control02.ctl - wrote new name
    Control File /oracle/product/10.2.0/oradata/orcl/control03.ctl - wrote new name
    Instance shut down

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


AFTER THIS

STEP1 - CHANGE PFILE IN DB_NAME=ANURAG

SQL> startup pfile='/oracle/product/10.2.0/admin/orcl/pfile/init.ora.1122013121215';
ORACLE instance started.

Total System Global Area  608174080 bytes
Fixed Size                  1220844 bytes
Variable Size             167776020 bytes
Database Buffers          436207616 bytes
Redo Buffers                2969600 bytes
Database mounted.
Database opened.
SQL>

SQL> select name from v$database;

NAME
---------
ANURAG


Important Notes

  • If the DBID is changed, all previous RMAN backups become unusable unless they are cataloged appropriately.
  • Changing only the DBNAME is less disruptive than changing both DBNAME and DBID.
  • Always perform the activity during a maintenance window.
  • Test the procedure in a non-production environment before executing it in production.
  • Ensure Oracle Net configuration files (tnsnames.ora, listener.ora) and monitoring tools are updated with the new database name.





1 comment:

  1. 25% OFF on Oracle Apps R12 Financials Self Paced Course along with 11 Additional Add On Courses (321 Session Videos of 120 Hours Recordings). Our Top Trending Course with 1700 Enrolled Udemy Students

    Please Check https://www.oracleappstechnical.com for details

    ReplyDelete

what is catcon.pl (Catalog Container Script) and why very useful for Oracle Multitenant Database ?

  catcon.pl (Catalog Container Script) is an Oracle utility introduced with the Multitenant Architecture (CDB/PDB) to execute SQL scripts ...