How to Change Oracle Database Name and DBID..


Prior to introduction of DBNEWID utility it was possible to change the name of the database by manually creating a new control file but it was not possible to give new dbid to the database.

The DBID is an internal, unique identifier for a database. RMAN distinguishes databases by DBID, so you could not register a seed database and a manually copied database together in the same RMAN repository.

DBNEWID solves this. With DBNEWID utility you can change either database name or database id or both.

However, changing DBID is a serious procedure. When you change DBID previous backups, archived redo logs become invalid.

Procedure of changing DBID and Database Name:


1)Take a recoverable full database backup.
2)Mount the database.
3)With sysdba privilege, invoke nid
i) To change only DBID just invoke nid target=username/pass
ii) To change both DBID and DBNAME invoke nid target=username/pass DBNAME=new_database_name
iii)To change only DBNAME invoke nid target=username/pass DBNAME=new_database_name SETNAME=y

i)Change only DBID:

To change only DBID just enter the following command,
SQL>host nid target=sonu/sonu
Where sonu is a user having sysdba system priviege. And password of sonu is sonu.

ii)Change both DBID and DBNAME:
To change the database name in addition to DBID enter the following command.
SQL>host nid target=sonu/sonu DBNAME=sonu1
which changes the DBID to a new DBID (You can't set DBID though as your wish) and change the database name to sonu1.
In this case the follow operations are performed is below.

1)The DBNEWID utility performs validations in the headers of the datafiles and
control files before attempting I/O to the files.

2)If validation is successful, then DBNEWID prompts you to confirm the operation (unless you specify a log file, in which case it does not prompt)

3)Then changes the DBID and the DBNAME for each datafile, including offline normal and read-only datafiles,

4)Shuts down the database, and then exits.

iii)Change only Database Name:
In the following example I will try to demonstrate to change the Database name.


1)SQL> select dbid, name from v$database;

DBID NAME
---------- ---------
246608360 sonu

2)SQL> shutdown imemdiate;
startup mount;
3)SQL> host nid target=sonu/sonu DBNAME=sonu1 setname=Y


DBNEWID: Release 10.2.0.1.0 - Production on Wed Apr 9 16:21:33 2008

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

Connected to database sonu (DBID=246608360)

Connected to server version 10.2.0

Control Files in database:
/oradata/sonu/sonu/control01.ctl
/oradata/sonu/sonu/control02.ctl
/oradata/sonu/sonu/control03.ctl

Change database name of database sonu to sonu1? (Y/[N]) => y
Instance shut down

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


4)SQL> !export ORACLE_SID=sonu1
5)SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.

Total System Global Area 167772160 bytes
Fixed Size 2019288 bytes
Variable Size 113246248 bytes
Database Buffers 46137344 bytes
Redo Buffers 6369280 bytes
6)SQL> show parameter db_name

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string sonu
SQL> alter system set db_name=sonu1 scope=spfile;

System altered.

7)SQL> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
8)SQL> startup
ORACLE instance started.

Total System Global Area 167772160 bytes
Fixed Size 2019288 bytes
Variable Size 113246248 bytes
Database Buffers 46137344 bytes
Redo Buffers 6369280 bytes
Database mounted.
Database opened.
9)SQL> select name,dbid from v$database;

NAME DBID
--------- ----------
sonu1 246608360

No comments:

SHRD0014: GLLEZL - process exiting with failure

  SYMPTOMS Journal Import completes with the following error: Error ------ ORA-01653 : unable to extend table GL.GL_IMPORT_REFERENCES ORA-01...