Skip to Main Content
  • Questions
  • Change SID on Oracle Express (XE) 10.2.0

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, david.

Asked: June 23, 2008 - 9:17 am UTC

Last updated: May 17, 2016 - 1:40 am UTC

Version: XE 10.2.0

Viewed 10K+ times! This question is

You Asked

I'm trying to change the SID for an Oracle Express XE 10.2.0 install on Windows.

I keep finding "Check Ask Tom" references, but all I've found on your site is a unix guide and an nt guide for version 8i. There have been a lot of changes since 8i and I'm having trouble using the guide, not all the programs mentioned in it seem to exist anymore.

What do I have to do?

Thanks

and Tom said...

Ok, here is a way, basically the same as it always was, just oradim is named oradim now, not oradim80. We do not need to rename the database, just want to change the sid from XE to SOMETHIN (8 characters max)

1) shutdown database cleanly

sqlplus / as sysdba
shutdown

2) stop the oracle services using control panel. (oracleserviceXE and the listener - or use lsnrctl stop from command line)

3) rename or copy C:\oraclexe\app\oracle\product\10.2.0\server\dbs\spfileXE.ora to C:\oraclexe\app\oracle\product\10.2.0\server\dbs\spfileSOMETHIN.ora

4) create C:\oraclexe\app\oracle\product\10.2.0\server\database\initSOMETHIN.ora by copying C:\oraclexe\app\oracle\product\10.2.0\server\database\initXE.ora and modify the spfile line to point to the new spfile

5) create the new service to start database and remove the old one

oradim -new -sid SOMETHIN -startmode auto -pfile C:\oraclexe\app\oracle\product\10.2.0\server\database\initSOMETHIN.ora

oradim -delete -sid XE

6) start listener

lsnrctl start

7) fix your environment

set ORACLE_SID=SOMETHIN

8) the database will eventually register with listener, but you can make it happen now:

sqlplus / as sysdba
alter system register;


if you query:

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
somethin


You'll see the new sid....

Rating

  (10 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

oracle xe db instance creation

Lokesh, November 16, 2010 - 4:13 am UTC

Hi tom,
I got lot of info with this help.

Perfect!

DirkF, May 27, 2011 - 6:57 am UTC

Thanks a lot! It met 100% my needs!

Very helpful

Ben Morgan, September 28, 2011 - 9:38 am UTC

Great article. Detailed step by step instructions for exactly what I wanted. Thanks.

Working for Linux and Oracle XE 11g R2 ?

Uno, January 25, 2012 - 4:24 pm UTC

Trying to apply this routine on a Oracle Linux 6.2 and Oracle XE 11g R2 and don't realy understand how to do it. For example there are no initXE.ora only a init.ora with no spfile line etc.

Is there a routine to get it to work on a Oracle XE 11g R2?

change instance name

A reader, May 13, 2012 - 7:36 am UTC


Working for Linux and Oracle XE 11g R2

Zafer, October 17, 2012 - 7:45 pm UTC

Tom, with your permission I would like to answer Uno's question.

Yes the steps works on Linux as well (oradim is not available on Linux). These are the steps (using RedHat 5.8 - 64bit and 11gXE) I followed to change the default SID value "XE" to new SID value "RAXE".

1. login to the oracle account on 11gXE machine. Search and copy the oracle_env.sh file to the /u01/app/oracle directory

2. source the oracle_env.sh file, invoke sqlplus to login as sysdba, generate a pfile from spfile (for backup)

3. cleanly shut down the database, also use /etc/init.d/oracle-xe stop to stop the listener and other related services

4. copy the /u01/app/oracle/product/11.2.0/xe/dbs/spfileXE.ora to /u01/app/oracle/product/11.2.0/xe/dbs/spfileRAXE.ora

5. create a new /u01/app/oracle/product/11.2.0/xe/dbs/initRAXE.ora file with a single line in it:
SPFILE='/u01/app/oracle/product/11.2.0/xe/dbs/spfileRAXE.ora'

6. change the environment variable ORACLE_SID to RAXE (export ORACLE_SID=RAXE) and start the sqlplus as sysdba:
(sqlplus / as sysdba) and execute the following:

SQL> startup nomount pfile=/u01/app/oracle/product/11.2.0/xe/dbs/initRAXE.ora;

SQL> select instance_name from v$thread;
(you should see RAXE returned)

SQL> create pfile from spfile;

7. open another xterm as oracle user, source the oracle_env.sh , setenv ORACLE_SID=RAXE and start the listener

8. in the previous xterm screen at SQL prompt type:
SQL> alter system register;

9. shutdown cleanly and execute /etc/init.d/oracle-xe stop

10. at the /u01/app/oracle as oracle user, search and replace the ORACLE_SID=XE with ORACLE_SID=RAXE:

find . -type f -not -iwholename '*.lck' | xargs sed -i 's/ORACLE_SID=XE/ORACLE_SID=RAXE/g'

11. edit the /etc/init.d/oracle-xe script as root and replace 3 out of 4 occurrences of XE with RAXE (line# 39,308,310)

12. edit the /etc/oratab as root from:
XE:/u01/app/oracle/product/11.2.0/xe:N to
RAXE:/u01/app/oracle/product/11.2.0/xe:N

13. reboot the machine

14. after the reboot completed, you can verify by executing /etc/init.d/oracle-xe status

Hope this proves helpful
r/ Zafer

Error while performing above mentioned steps

Amit, September 06, 2013 - 7:03 am UTC

I followed all the steps but when i connect SQL, it connected to idle instance. So I tried to up the database and it throwed below error.
SQL> startup
ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file 'C:\oraclexe\app\oracle\product\10.2.0\serv
er\dbs/spfileXE.ora'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.

So, is there any other configuration that needs to be done?

Tom Kyte
September 09, 2013 - 11:29 am UTC

do you have the spfileXE.ora there?

Amit, September 10, 2013 - 9:28 am UTC

Yes, XE Spfile was the issue.
Thanks for the help.

works perfect for windows 7 64-bit!!

Patrick, October 20, 2013 - 5:37 am UTC

followed the step by step process in detail!
it was a success! THANKS A MILLION@

gouthami, May 16, 2016 - 7:28 am UTC

Hi Tom,
After following the steps ,if i'm trying to import a dump using impdp i'm getting following error.

IMPDP admin/admin@new_sid SCHEMAS=abc DIRECTORY = DB_BKP_DIR DUMPFILE=abcd.DMP LOGFILE=IMP_abcd.LOG REMAP_SCHEMA=abc:abc


UDI-12154: operation generated ORACLE error 12154
ORA-12154: TNS:could not resolve the connect identifier specified
Do i need to change tnsnames.ora,listener.ora?If Yes how?
Connor McDonald
May 17, 2016 - 1:40 am UTC

Look at your tnsnames.ora, there is likely to be an entry for an existing database. Copy that, and edit accordingly

eg you might copy

SIDX =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = sidx)
    )
  )



and edit the "sidx" to become "new_sid" in each instance