Document ID:        40760.1
Subject:            Renaming an existing NT Database
Last Modified:      08 May 97
Author:		    Unknown


These instructions assume the following:
      Your database is started.
      You are on the Server.
      The existing database SID is ORCL and DB_NAME is ORACLE and the new
      database
                SID and DB_NAME will be TEST

      When referring to ...7x, "x" stands for 2 or 3, depending on the
      version of the database.

1.  Using SQLDBA72 or SVRMGR23, connect internal/internal_password@2:ORCL
    and enter the following SQL command:

         ALTER DATABASE BACKUP CONTROLFILE TO TRACE;

    This will create a dump file, ORA*.TRC, in %ORACLE_HOME%\RDBMS7x\TRACE\

2.  SHUTDOWN the database and EXIT.

3.  Stop the services:
     Using Control Panel/Services - scroll down to OracleServiceORCL and
     click on the STOP button.

4.  Using File Manager or DOS, rename *ORCL.ORA  to *TEST.ORA in
    ORACLE_HOME%\DATABASE.

5.  Edit INITTEST.ORA:
     a.  Replace all occurrences of the string ORCL with TEST.
     b.  Modify DB_NAME = ORACLE to read DB_NAME = TEST
     c.  Save the file.

6.  Edit the dump file created in step 1:
     a.  Change all occurrences of the string ORCL with TEST.
     b.  Remove the header (delete all lines above the STARTUP NOMOUNT)
     c.  Modify the Startup line to read:
             STARTUP NOMOUNT PFILE=%ORACLE_HOME%\DATABASE\INITTEST.ORA
     d.  Change the NAME of the database.  Modify the CREATE CONTROLFILE:
          replace REUSE DATABASE "Oracle" with SET DATABASE "Test"
          replace RESETLOGS with NORESETLOGS
     e.  Remove the line RECOVER DATABASE
     f.  Save the file to CHNAME.SQL

7.  Use ORADIM7x to create the new instance with the new SID.  From a DOS
    Command Prompt type:

        ORADIM7x -new -sid TEST -intpwd password -startmode auto
           -pfile %ORACLE_HOME%\DATABASE\INITTEST.ORA

8.  Verify that the new service is started:
     a.  From in Control Panel/Services, scroll down to OracleServiceTEST.
     b.  If not started, click on the START button.

9.  Using SQLDBA72 or SVRMGR23, connect internal/password@2:TEST and
    enter the following SQL command:

        @%ORACLE_HOME%\RDBMS7x\TRACE\CHNAME.SQL

    This will recreate the controlfile with the new datafiles....

10.  Shut down the database.

11.  Stop the ORCL service.
      a.  From in Control Panel/Services, scroll down to OracleServiceORCL.
      b.  Click on the STOP button.

12.  If you want this instance to be your primary instance, edit the
      Registry and modify ORACLE_SID to contain TEST
      a.  In Program Manager, click on FILE/RUN, type REGEDT32
      b.  In HKEY LOCAL MACHINE on Local Machine, double click on Software,
          click on Oracle
      c.  Double click on the value ORACLE_SID
      d.  Change the "String" to TEST, click "OK"
      e.  Exit the Registry

13.  If you don't want TEST to be your primary instance, set the
     environment variable before invoking SQLDBA or SVRMGR.   From a DOS
     command prompt type:

        SET ORACLE_SID=TEST

14.  Startup the TEST database:
      a.  In the Main program group, double click on the Command Prompt
          icon.
      b.  Type: SQLDBA72 or SVRMGR23
      c.  Type:  CONNECT INTERNAL/internal_password@2:TEST
      d.  Type:  STARTUP PFILE=%ORACLE_HOME%\DATABASE\INITTEST.ORA
      e.  Exit

15.  Use ORADIM7x to delete the original ORCL service.  From a DOS Command
     Prompt type:

         ORADIM7x -delete -sid ORCL

** Note: 
     Make sure to check your SQLNET setup for references to ORCL -
     changing them to TEST,
     
       ie. TNSNAMES.ORA, LISTENER.ORA...