Tuesday, September 8, 2020

NID Utility in Oracle Database to Change DBID or DBNAME or Both

 

NID Utility in Oracle Database to Change DBID or DBNAME or Both


Introduction


In this Blog i am going to explain NID Utility in Oracle Database to Change DBID or DBNAME or Both The DBNEWID(NID) utility is introduced in oracle database this NID commands is the oracle program  that changes the SID of the database to use this utility we need SYS Account Password and the new SID for the Database


The NID utility in oracle always  you to change only the DBNAME or DBID or both DBNAME and DBID in the same command


Let us Start the Process NID Utility in Oracle Database to Change DBID or DBNAME or Both


CHANGE ONLY THE DBID USING NID UTILITY


Here we will only changing the DBID of the oracle database


Step 1: Backup Database

 rman target /

 backup database;

 exit



Step2:  Shutdown Immediate

sqlplus / as sysdba

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>exit



Step 3: Startup mount

sqlplus / as sysdba


SQL> startup mount;

ORACLE instance started.

 

Total System Global Area 3764747643 bytes

Fixed Size                  1253583 bytes

Variable Size             357873300 bytes

Database Buffers          243860700 bytes

Redo Buffers                6471103 bytes

Database mounted.

SQL> exit


Step 4: Open in one session and run NID utility(DBNEWID) with sysdba privileges to change the DBID


nid TARGET=SYS/password@proddb


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

 

Password:

Connected to database  PRODDB(DBID=466474)

 

Connected to server version 11.2.0

 

Control Files in database:

    +DATA/PRODDB/control01.ctl

    +FLASH/PRODDB/control02.ctl

   

 

Change database ID ? (Y/[N]) => Y

 

Proceeding with operation

Changing database ID from 466474 to 466474424

 


Database ID for database PRODB changed to 466474424

All previous backups and archived redo logs for this database are unusable.

Database has been shutdown, open database with RESETLOGS option.

Successfully changed database  ID.

DBNEWID - Completed successfully.



Step 5: Start up the database with open resetlogs

sqlplus / as sysdba


SQL> startup mount;

ORACLE instance started.

 

Total System Global Area 3764747643 bytes

Fixed Size                  1253583 bytes

Variable Size             357873300 bytes

Database Buffers          243860700 bytes

Redo Buffers                6471103 bytes

Database mounted.


SQL> alter database open resetlogs;




CHANGE ONLY THE DBNAME


Here we will changing  only the DBNAME in oracle database

 

Step1: Backup Database


rman target /

backup database;

exit


Step 2 : shutdown Immediate


sqlplus / as sysdba


SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>exit


Step 3: Startup mount


sqlplus / as sysdba


SQL> startup mount;

ORACLE instance started.

 

Total System Global Area 3764747643 bytes

Fixed Size                  1253583 bytes

Variable Size             357873300 bytes

Database Buffers          243860700 bytes

Redo Buffers                6471103 bytes

Database mounted.

SQL> exit


Step 4: Open one session and run NID with sysdba privilege


nid TARGET=SYS/password@chaitu_123 DBNAME=proddb2 SETNAME=Y

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

 

Password:

Connected to database PRODDB (DBID=466474)

 

Connected to server version 11.2.0

 

Control Files in database:

    +DATA/PRODDB/control01.ctl

    +FLASH/PRODDB/control02.ctl

   

 

Change database name ? (Y/[N]) => Y

 

Proceeding with operation

Database name changed to PRODDB2

 

All previous backups and archived redo logs for this database are unusable.

Database has been shutdown, open database with RESETLOGS option.

Succesfully changed database name.

DBNEWID - Completed succesfully.


The value of the DBNAME is the new db_name of the database


SETNAME must be set to Y .the default is N and causes the DBID to be changed also



Step 5: Set the DB_NAME initialization paramater in the initialization parameter file to the new database name


Step 6: Create a new password file using orapwd


Step 7: Startup the database (with resetlogs)


sqlplus / as sysdba


SQL> startup mount;

ORACLE instance started.

 

Total System Global Area 3764747643 bytes

Fixed Size                  1253583 bytes

Variable Size             357873300 bytes

Database Buffers          243860700 bytes

Redo Buffers                6471103 bytes

Database mounted.



CHANGE BOTH DBID AND DBNAME


Here we will change the both DBID and DBNAME in oracle database


Step 1: Backup Database


rman target /

backup database;

exit


Step 2: shutdown immediate


sqlplus / as sysdba


SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>exit


Step 3: startup mount


sqlplus / as sysdba


SQL> startup mount;

ORACLE instance started.

 

Total System Global Area 3764747643 bytes

Fixed Size                  1253583 bytes

Variable Size             357873300 bytes

Database Buffers          243860700 bytes

Redo Buffers                6471103 bytes

Database mounted.

SQL> exit


Step 4: Open one session and run NID with sysdba privilige


nid TARGET=SYS/password@chaitu_123 DBNAME=proddb2


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


Password:

Connected to database PRODDB (DBID=466474)


Connected to server version 11.2.0


Control Files in database:

+DATA/PRODDB/control01.ctl

+FLASH/PRODDB/control02.ctl



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


Proceeding with operation

Database name changed to PRODDB2

Modify parameter file and generate a new password file before restarting.

Database ID for database EXPTEST_DB2 changed to 466474424

All previous backups and archived redo logs for this database are unusable.

Database has been shutdown, open database with RESETLOGS option.

Successfully changed database name and ID.

DBNEWID - Completed successfully.


the value of the DBNAME is the new dbname of the database


Step 5: After DBNEWID sucessfully changes the DBID ,shutdown immediate


Step 6: Set the DB_NAME initilation parameter in the initilization parameter file to the new database name


Step 7: Create the new password file with orapwd


Step 8: Startup the database with open resetlogs


sqlplus / as sysdba


SQL> startup mount;

ORACLE instance started.

 

Total System Global Area 3764747643 bytes

Fixed Size                  1253583 bytes

Variable Size             357873300 bytes

Database Buffers          243860700 bytes

Redo Buffers                6471103 bytes

Database mounted.


SQL> alter database open resetlogs;


Note: Info on NID Utility in Oracle Database to Change DBID or DBNAME or Both it may be differ in your environment like production,testing,development etc and naming conventions 


THANKS FOR VIEWING MY BLOG FOR MORE UPDATES FOLLOWMEOR SUBSCRIBE ME

ITIL Process

ITIL Process Introduction In this Blog i am going to explain  ITIL Process, ITIL stands for Information Technology Infrastructure Library ...