Change Oracle database 12cR2 Name with DBNEWID

This article explains how to change the Oracle database version 12cR1 (12.2.0.1) name from “wadhah” to “wadha7” using the DBNEWID tool

Table of Contents:

  1. Check current DB name
  2. Change Database Name using DBNEWID
  3. Verification of the new name.

 

1.Check current DB name:

To verifiy the database name, we can get the name from v$database:

SQL> select name,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
WADHAH READ WRITE
SQL>

 

2. Change Database Name using DBNEWID:

a. Step 1: Help of the tool DBNEWID:

[oracle@ol-7u4 ~]$ nid
DBNEWID: Release 12.2.0.1.0 - Production on Wed May 30 23:46:10 2018
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Keyword Description (Default)
----------------------------------------------------
TARGET Username/Password (NONE)
DBNAME New database name (NONE)
LOGFILE Output Log (NONE)
REVERT Revert failed change NO
SETNAME Set a new database name only NO
APPEND Append to output log NO
HELP Displays these messages NO
[oracle@ol-7u4 ~]$

b. Step 2: Change the name from wadhah to wadha7 and DBID

[oracle@ol-7u4 ~]$ nid TARGET=sys DBNAME=wadha7
DBNEWID: Release 12.2.0.1.0 - Production on Wed May 30 23:46:46 2018
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Password: *******
Connected to database WADHAH (DBID=152152954)
Connected to server version 12.2.0
Control Files in database:
/home/oracle/app/oracle/oradata/WADHAH/controlfile/o1_mf_fjsdh7bf_.ctl
/home/oracle/app/oracle/fast_recovery_area/WADHAH/controlfile/o1_mf_fjsdh7f9_.ctl

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

Proceeding with operation
Changing database ID from 152152954 to 2540019372
Changing database name from WADHAH to WADHA7
Control File /home/oracle/app/oracle/oradata/WADHAH/controlfile/o1_mf_fjsdh7bf_.ctl - modified
Control File /home/oracle/app/oracle/fast_recovery_area/WADHAH/controlfile/o1_mf_fjsdh7f9_.ctl - modified
Datafile /home/oracle/app/oracle/oradata/WADHAH/datafile/o1_mf_system_fjsd8gwo_.db -dbid changed, wrote new name
Datafile /home/oracle/app/oracle/oradata/WADHAH/datafile/o1_mf_sysaux_fjsd3wrb_.db -dbid changed, wrote new name
Datafile /home/oracle/app/oracle/oradata/WADHAH/datafile/o1_mf_undotbs1_fjsdg2w5_.db - dbid changed, wrote new name
Datafile /home/oracle/app/oracle/oradata/WADHAH/datafile/o1_mf_example_fjsdj7rq_.db - dbid changed, wrote new name
Datafile /home/oracle/app/oracle/oradata/WADHAH/datafile/o1_mf_users_fjsdfz2d_.db - dbid changed, wrote new name
Datafile /home/oracle/app/oracle/oradata/WADHAH/datafile/o1_mf_temp_fjsdhmsb_.tm - dbid changed, wrote new name
Control File /home/oracle/app/oracle/oradata/WADHAH/controlfile/o1_mf_fjsdh7bf_.ctl - dbid changed, wrote new name
Control File /home/oracle/app/oracle/fast_recovery_area/WADHAH/controlfile/o1_mf_fjsdh7f9_.ctl - dbid changed, wrote new name
Instance shut down

Database name changed to WADHA7.
Modify parameter file and generate a new password file before restarting.
Database ID for database WADHA7 changed to 2540019372.
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.

 

Note: After a succesfally database name change, the database has bean stoped

c. Step 3: Start the database:

$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Wed May 30 23:49:43 2018
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1543503872 bytes
Fixed Size 8621040 bytes
Variable Size 939525136 bytes
Database Buffers 587202560 bytes
Redo Buffers 8155136 bytes
ORA-01103: database name 'WADHA7' in control file is not 'WADHAH'

 

Note: Solution of the error: ORA-01103: Change the initialisation parameter db_name to the new name.

SQL> alter system set db_name ='WADHA7' scope=spfile;
System altered.
SQL> shut immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL>
SQL> startup mount
ORACLE instance started.
Total System Global Area 1543503872 bytes
Fixed Size 8621040 bytes
Variable Size 939525136 bytes
Database Buffers 587202560 bytes
Redo Buffers 8155136 bytes
Database mounted.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

Note: After the change name, open the databse with the resetlogs:

SQL> alter database open RESETLOGS;
Database altered.

3. Verification of the new name:

To verifiy the database name, we can get the name from v$database:

SQL> select name,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
WADHA7 READ WRITE
SQL>

 

Conslusion:

This article explains the steps to change Oracle database 12cR2 Name using the tool DBNEWID.

 

 

Bookmark the permalink.
Loading Facebook Comments ...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.