Change SID

 

Home
Up

How can you change Oracle SID?

  1. Startup database .
  2. Running this command: alter database backup controlfile to trace.
  3. After this, find the trace file:
At UNIX : ORACLE_HOME/RDBMS/LOG/ora???.trc
At Windows NT: ORANT\RDBMS73\TRACE\ora????.trc
At SAP (in UNIX Level),sometimes,: ORACLE_HOME/RDBMS/SAPTRACE/USER*/ora???.trc
  1. Edit this trace file: (the location of control file, data file and log file must same with your environment) :

    * Check the bold character.
    STARTUP NOMOUNT
    CREATE CONTROLFILE SET DATABASE "<NEW_SID>" RESETLOGS NOARCHIVELOG
    MAXLOGFILES 32
    MAXLOGMEMBERS 2
    MAXDATAFILES 32
    MAXINSTANCES 16
    MAXLOGHISTORY 1600
    LOGFILE
    GROUP 1 'D:\ORANT\DATATEST\REDO11.LOG' SIZE 4M, 'D:\ORANT\DATATEST\REDO12.LOG' SIZE 4M,
    GROUP 2 'D:\ORANT\DATATEST\REDO21.LOG' SIZE 4M, 'D:\ORANT\DATATEST\REDO22.LOG' SIZE 4M,
    GROUP 3 'D:\ORANT\DATATEST\REDO31.LOG' SIZE 4M, 'D:\ORANT\DATATEST\REDO32.LOG' SIZE 4M
    DATAFILE
    'D:\ORANT\DATATEST\SYS1ORCL.ORA',
    'D:\ORANT\DATATEST\ROLLBACK.ORA',
    'D:\ORANT\DATATEST\ROLLBA1.ORA',
    'D:\ORANT\DATATEST\TEMP.ORA',
    'D:\ORANT\DATATEST\USERS.ORA',
    'D:\ORANT\DATATEST\IFSAPP_DATA.ORA',
    'D:\ORANT\DATATEST\IFSAPP_DATA1.ORA',
    'D:\ORANT\DATATEST\IFSAPP_INDEX.ORA',
    'D:\ORANT\DATATEST\IFSAPP_INDEX1.ORA',
    'D:\ORANT\DATATEST\IFSAPP_REPORT.ORA'
    ;
    ALTER DATABASE OPEN RESETLOGS;

  1. Shutdown database.
  2. Copy file init<SID>.ora to init<NEW_SID>.ora à cp init<SID>.ora init< NEW_SID>.ora.
  3. Don’t forget to copy config<SID>.ora to config<NEW_SID>.ora if you have.
  4. If you have file config<NEW_SID>.ora, edit the ifile in that file:
  5. ifile = /opt/oracle/dbs/config<NEW_SID>.ora.

  6. Edit file listener.ora , edit the SID of ORACLE.
  7. LISTENER=
    (ADDRESS_LIST=
    (ADDRESS=
    (PROTOCOL=tcp)
    (HOST=aiopr4)
    (PORT=1521)
    )
    )

    SID_LIST_LISTENER=
    (SID_LIST=
    (SID_DESC=
    (SID_NAME=<NEW_SID>)
    (ORACLE_HOME=<ORACLE_HOME>)
    )
    )
    }

    CONNECT_TIMEOUT_LISTENER=10
    STOP_LISTENER=YES
    DBA_GROUP=dba

  8. Setting SID at the environment:
For UNIX: login as oracle user and check and edit "ORACLE_SID" at the .profile file :

ORACLE_SID=<NEW_SID>; export ORACLE_SID

For Windows NT: Running this command at the command com (DOS Prompt) like this:

SET ORACLE_SID = <NEW_SID>

  1. Running svrmgr or sqldba lmode=y.
  2. Running trace file that have been edited.
SVRMGR (or SQLDBA)>connect internal
@<directory that trace placed>/ora??.trc
  1. If no error, so you can get the new control file and database will be opened and can be used as usual.

 Note :

  1. Don’t forget to backup control files, data files and log files.
  2. Be careful when create controlfile, because if control file break, you can’t use this database again.
  3. After you edit listener.ora, you must stop the listener service and start again this service with the new listener.ora.

 

 

 

Oracle SAPChange Oracle SID Script

This page was last updated on 08/23/98.

iexplore.gif    iexplore.gif (14871 bytes)