Linux – change the SID of an Oracle database

linuxoracleoracle-11g

The Server is Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 – 64bit

Is there an easy & quick way to change the SIDs of the test databases on the server?

Dropping & recreating of the database is an option for me. But I'm looking for something requiring less time.

The other option to assign names in the clients tnsnames.ora is prone to errors, because they are not administrated centrally.

Compared with the time to drop & create a database on SQL-Server, the amount of time required to create a new Oracle database is excessively greater.
Further on SQL-Server you can rename SQL-Server instances. [ Usually you rename the server where SQL-Server is running and have some problems until you rename the server too ].

Best Answer

Since 9i dbnewid utility (nid) can be used to change database name (and DBID if required). If database name being changed only then resetlogs is not required:

  • 1 startup database in mount mode

    shutdown immediate
    startup mount
    
  • 2 run nid to change database name:

    nid target=sys/syspassword@dbtns dbname=newname setname=YES
    
  • 3 shutdown and start database in mount mode:

    shutdown immediate
    startup mount
    
  • 4 change db_name in spfile (or in pfile editing the file):

    alter system set db_name=newname scope=spfile;
    
  • 5 recreate password file:

    orapwd file=orapwnewname password=syspassword
    
  • 6 startup the database

    startup
    
  • 7 post rename steps:

    change SID in listener.ora
    correct tnsnames.ora
    remove old trace directories
    change /etc/oratab (UNIX) or rename windows service using oradim