How to change database name using nid in oracle

In this post we will discuss How to change database name using nid in oracle. The “nid” (New Database Identifier) utility in Oracle cannot be used to directly update the database name, also known as the global database name. The Global Database Name, which is normally defined during the database creation process, serves as the primary identity for your Oracle database. If you want to change db name in oracle, you will need to follow the below steps.

Changing database name using nid in oracle.

To change the database name in oracle we will follow the general steps.

=> Ensure that the target database is mounted but not open, and that it was shutdown consistently prior to mounting.

SQL>STARTUP NOMOUNT;

Run NID utility to change database name in oracle.

$nid TARGET=SYS/ DBNAME=new_db_name

[oracle@DBUATSRV]$ nid target=sys/***** dbname=DBUAT

DBNEWID: Release 11.2.0.3.0 - Production on Thu May 4 22:54:43 2023

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

Connected to database DB11G (DBID=54344432343)

Connected to server version 11.2.0

Control Files in database:
    /oracle/oradata/db11g/control001.ctl
   /oracle/fast_recovery_area/db11g/control002.ctl

Change database ID and database name DB11G to OCPTECH? (Y/[N]) => Y

Proceeding with operation
Changing database ID from 54344432343 to 543444323456
Changing database name from DB11G to DBUAT
    Control File /oracle/oradata/db11g/control01.ctl - modified
    Control File /oracle/fast_recovery_area/db11g/control02.ctl - modified
    Datafile /oracle/oradata/db11g/system01.db - dbid changed, wrote new name
    Datafile /oracle/oradata/db11g/sysaux01.db - dbid changed, wrote new name
    Datafile /oracle/oradata/db11g/undotbs01.db - dbid changed, wrote new name
    Datafile /oracle/oradata/db11g/users01.db - dbid changed, wrote new name
    Datafile /oracle/oradata/db11g/example01.db - dbid changed, wrote new name
    Datafile /oracle/oradata/db11g/temp01.db - dbid changed, wrote new name
    Control File /oracle/oradata/db11g/control01.ctl - dbid changed, wrote new name
    Control File /oracle/fast_recovery_area/db11g/control02.ctl - dbid changed, wrote new name
    Instance shut down

Database name changed to DBUAT.
Modify parameter file and generate a new password file before restarting.
Database ID for database DBUAT changed to 543444323456.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.

DBNEWID - Completed succesfully.

Modify db_name in spfile.

Once DB rename completed successfully, we will need to change the db_name in spfile.

SQL> STARTUP NOMOUNT;

SQL> alter system set db_name=DBUAT scope=spfile;

SQL> SHUTDOWN IMMEDIATE;

$ export ORACLE__SID=DBUAT

SQL>STARTUP NOMOUNT;

SQL> ALTER DATABASE MOUNT;

SQL>ALTER DATABASE OPEN RESETLOGS;

Verify database name.

$ SQL>select name form v$database;

Leave a Comment