Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

dbnewid (nid) tips 

Oracle Database Tips by Donald BurlesonFebruary 13, 2015

Question:  I want to rename my instance and I want to know hot to use the dbnewid procedure.

Answer:  Here is a sample session of using the dbnewid (nid) command utility:

The dbname of the Oracle instance can be changed using the nid utility. After the rename, the database will need to be bounced (shutdown and mounted again):

nid target=sys/change_on_install dbname=lappsdb setname=yes

The following output will appear. The command will prompt for input on the following question:

"Change database name of database <old dbname> to <new dbname>? (Y/[N]) => "
Type Y and press enter.

----------------Output of nid command---------------
DBNEWID: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

****************************************

For Oracle9i and beyond, Oracle author Dr. Tim Hall has this procedure to rename an Oracle database using the new dbnewid (also called nid, for new ID) utility:

  • STEP 1: Backup the database.
  • STEP 2: Mount the database after a clean shutdown:
    SHUTDOWN IMMEDIATE
    STARTUP MOUNT
  • STEP 3: Invoke the DBNEWID utility (nid) specifying the new DBNAME from the command line using a user with SYSDBA privilege:
    nid TARGET=sys/password@TSH1 DBNAME=TSH2
    Assuming the validation is successful the utility prompts for confirmation before performing the actions. Typical output may look something like:
    C:\oracle\920\bin>nid TARGET=sys/password@TSH1 DBNAME=TSH2
    DBNEWID: Release 9.2.0.3.0 - Production
    Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
    
    Connected to database TSH1 (DBID=1024166118)
    
    Control Files in database:
        C:\ORACLE\ORADATA\TSH1\CONTROL01.CTL
        C:\ORACLE\ORADATA\TSH1\CONTROL02.CTL
        C:\ORACLE\ORADATA\TSH1\CONTROL03.CTL
    
    Change database ID and database name TSH1 to TSH2? (Y/[N]) => Y
    
    Proceeding with operation
    Changing database ID from 1024166118 to 1317278975
    Changing database name from TSH1 to TSH2
        Control File C:\ORACLE\ORADATA\TSH1\CONTROL01.CTL - modified
        Control File C:\ORACLE\ORADATA\TSH1\CONTROL02.CTL - modified
        Control File C:\ORACLE\ORADATA\TSH1\CONTROL03.CTL - modified
        Datafile C:\ORACLE\ORADATA\TSH1\SYSTEM01.DBF - dbid changed, wrote new name
        Datafile C:\ORACLE\ORADATA\TSH1\UNDOTBS01.DBF - dbid changed, wrote new name
        Datafile C:\ORACLE\ORADATA\TSH1\CWMLITE01.DBF - dbid changed, wrote new name
        Control File C:\ORACLE\ORADATA\TSH1\CONTROL01.CTL - dbid changed, wrote new name
        Control File C:\ORACLE\ORADATA\TSH1\CONTROL02.CTL - dbid changed, wrote new name
        Control File C:\ORACLE\ORADATA\TSH1\CONTROL03.CTL - dbid changed, wrote new name
    
    Database name changed to TSH2.
    Modify parameter file and generate a new password file before restarting.
    Database ID for database TSH2 changed to 1317278975.
    All previous backups and archived redo logs for this database are unusable.
    Shut down database and open with RESETLOGS option.
    Succesfully changed database name and ID.
    DBNEWID - Completed succesfully.
  • STEP 4: Shutdown the database:
    SHUTDOWN IMMEDIATE
  • STEP 5: Modify the DB_NAME parameter in the initialization parameter file. The startup will result in an error but proceed anyway.
    STARTUP MOUNT
    ALTER SYSTEM SET DB_NAME=TSH2 SCOPE=SPFILE;
    SHUTDOWN IMMEDIATE
  • STEP 6: Create a new password file:
    orapwd file=c:\oracle\920\database\pwdTSH2.ora password=password entries=10
  • STEP 7: Rename the SPFILE to match the new DBNAME.
  • STEP 8: If you are using Windows you must recreate the service so the correct name and parameter file are used:
    oradim -delete -sid TSH1
    oradim -new -sid TSH2 -intpwd password -startmode a -pfile c:\oracle\920\database\spfileTSH2.ora
    If you are using UNIX/Linux simply reset the ORACLE_SID environment variable:
    ORACLE_SID=TSH2; export ORACLE_SID
  • STEP 9: Alter the listener.ora and tnsnames.ora setting to match the new database name and restart the listener:
    lsnrctl reload
  • STEP 10: Open the database with RESETLOGS:
    STARTUP MOUNT
    ALTER DATABASE OPEN RESETLOGS;
  • STEP 11: Backup the database.

   
Oracle Training from Don Burleson 

The best on site "Oracle training classes" are just a phone call away! You can get personalized Oracle training by Donald Burleson, right at your shop!

Oracle training
 
 


 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster