Skip to Content

( contributed by Indradeb Chatterjee – IBM Global service ) 

1 Summary
There is no comprehensive document for changing SAP SID in Windows/Oracle based systems in SAP or IBM resource centres. We found no resources in web either. The following methodology was developed completely in-house and was tested on R/3 4.7 Enterprise edition as well as BW 3.5 ( both systems were based on Windows 2003/ Oracle 9.2.0.6.0) . It can be followed for other ABAP systems based on BASIS 6.20 or 6.40.
This document gives a step by step procedure for changing SID without the need of re-installing the central instance and /or database. The SID change is done in-situ.

It is advisable to upgrade your system to latest SAP kernel and DB tools before running the procedure. We also advise strongly to keep an offline backup of the database and Oracle controlfile creation scripts before starting the process.
The document assumes that the system was installed with Oracle Schema id: SAPDAT (which is always useful if you need to create systems copied from this). In case the schema id is default (SAP), change the value in step 2.3.1 and 2.6.3 from SAPDAT to SAP. The source Schema id would not change in the system renaming.

2 SAP System renaming procedure for Windows/ Oracle

Create Users

Login as adm. Login to database using SQLPLUS ( / as sysdba) . Run command:
Alter database backup controlfile to trace;
A file named _ora_.trc will be created in :\Oracle\\saptrace\usertrace. Rename the file to crcontrolfile.sql and save in a separate folder (e.g. Y:\)
Login as adm and stop SAP server. Shutdown Oracle. Stop Windows Services SAP_nn, SAPOSCOL and OracleService. Disable service SAP_nn.
Stop all scheduled database jobs for . If any job is running kill it from Windows Task Manager
Login as adm and create following user groups from Computer management:
• ORA__DBA
• ORA__OPER
• SAP_LocalAdmin
• SAPGlobalAdmin
Create users adm and SAPService and assign them to following groups:

• ORA__DBA
• ORA__OPER
• SAP__LocalAdmin
• SAP__GlobalAdmin
• SAPLocalAdmin
• Administrator
Create Directory Structure and adapt SAP and Oracle profiles:

Login to server as adm
Copy :\Oracle\ to :\Oracle\. Empty the contents of
the folders
Copy :\usr\sap\ to :\usr\sap\ ( Copy might fail for SAPSYS.pse in DVEBMGS\sec. Skip the file and copy the rest)
In Folder :\oracle\ora92\database, create init.dba, init.ora and init.sap copied from init* files. Replace by in each of these files.
In Folder :\oracle\ora92\Network\Admin, modify tnsnames.ora and listener.ora. Replace by in both the files
In :\usr\sap\\SYS\profile, modify default, start and instance profiles to replace by . Rename _DVEBMGS_ to _DVEBMGS_

Create environment variables and modify registry:

Create following variables in user environment of adm
• DBMS_TYPE = ORA
• DBS_ORA_SCHEMA = SAPDAT
• dbs_ora_tnsname =
• NLS_LANG = AMERICAN_AMERICA.UTF8
• ORACLE_HOME = :\Oracle\ora92
• ORACLE_SID =
• PATH = :\usr\sap\\SYS\EXE\run
• SAPDATA_HOME = :\Oracle\
• SAPEXE = :\usr\sap\\SYS\EXE\run
• SAPLOCALHOST =
• TMP = C:\Windows\Temp
• TEMP = C:\Windows\Temp

 

 

Run Regedit and create a node for under
HKEY_LOCAL_MACHINE/Software/SAP.
Create a new String Value AdmUsr under this node with value = /adm

Create a sub-node called Environment under the node created above. This node should have same strings as adm environment variables (3.1).

(Note that some strings are of type REG_SZ and some are of type REG_EXPAND_SZ)

Modify node SAPOSCOL under HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services. Change ImagePath value; replace by . Change Objectname value from ./SAPService to ./SAPService.

Put SapService password in SAPOSCOL service properties ( Windows
services)
Re-login as adm to activate the environment

Create/Start SAP and Oracle Services

Replace entry sapms by sapms in Windows services file
( C:\windows\system32\drivers\etc\services)
Run sapstartsrv.exe from :\usr\sap\SYS\EXE\run

 

 

 

 

 

 

 

 

 

 

Operation: Install service + Register COM Interface + Start Service
SID: TGT
NR: Sys Nr. (same as )
Startprofil: :\usr\sap\\SYS\profile\START_ DVEBMGS_
User: .\SAPService
Password: sapservice password

The Output would be error messag: ‘failed to start service’
Open Windows Services console, double-click on SAP_nn. Re-enter SAPService password in Log On Tab. Start the service again. (./SAPService should now have the access to logon as service). This time service should start without error.
(You can uninstall services using the same program)

Start SAPOSCOL service
From command prompt run:
Oradim -NEW -SID : This creates OracleService
Oradim -Delete -SID : This deletes OracleService
Logout and re-login as adm
Check OracleService in Windows services. If not running, start it.
Make sure you have SAPMMC.DLL in c:\windows\system32
Run command ‘REGSVR32.EXE SAPMMC.DLL’ to register the snap-in
Run SAPSTARTSRV.EXE -t to register the existing DCOM library in the executable.
Confirm this without any changes.
Start SAP Management Console from desktop. It should now have the new entry for
.
Start TGT server. Wait till all the process turns Green and stays Green. Save
SAPMMC.SRC while coming out

(refer to OSS note 373963 for SAP MMC set up)

 

2.5 Create Database

2.5.1 Stop SAP system. Stop Services: OracleService and SAP__
2.5.2 Rename all folders named \Oracle\ in all drives to \Oracle\
2.5.3 Delete control files of database. ( Locations can be found from :\Oracle\ora92\database\init.ora)
2.5.4 Delete archived logs of from F:\Oracle\\Oraarch
2.5.5 Delete online redologs of database from :\Oracle\\OriglogA, :\Oracle\\OriglogB, :\Oracle\\MirrLogA, :\Oracle\\MirrlogB
2.5.6 If you want to change controlfile locations, change it in the file :\Oracle\ora92\database\init.ora. Make sure the controlfile folders are created.
2.5.7 Copy crcontrolfile.sql (created in step 1.1) to crcontrolfile.sql. Find the line that contains ‘startup nomount’. Delete all lines including this one, till the beginning of the file. Now look for the first semi-colon (;). Delete all lines starting with the line next to semi-colon till the end of the file.
Now change all occurrences of to .
Change first line of the file from
CREATE CONTROLFILE REUSE DATABASE “” NORESETLOGS ARCHIVELOG
To
CREATE CONTROLFILE SET DATABASE “” RESETLOGS ARCHIVELOG
Change Online redo-log sizes if you want to.

2.5.8 Copy crcontrolfile.sql (created in step 1.1) to crtempts.sql. Find the line that contains alter temporary tablespace statement. (alter tablespace PSAPTEMP…). Keep this statement and delete everything else. Replace by .
2.5.9 Start OracleService ( Listener should be running)
2.5.10 From command prompt :
Y:
cd
sqlplus “/ as sysdba”
startup nomount
@crcntrlfile.sql (output should be ‘control files created’)
alter database open resetlogs; (Output should be ‘database altered’)
@crtempts.sql (Output should be ‘tablespace altered’)

2.6 Start SAP

2.6.1 Copy sapdba_role.sql from :\usr\sap\\SYS\exe\run to Y:\
2.6.2 Copy oradbusr.sql from DB instance Installation folder to Y:\TGT
2.6.3 From Y:\ run following commands
sqlplus /nolog @oradbusr.sql SAPDAT NT

Output from above command should be similar to below
.
. Oracle Version: 9.2.0.6.0
. Parametervalue os_authent_prefix: OPS$
. Schema Id: DAT
. Database User (Schema): SAPDAT
. SAP R/3 Administrator: OPS$\ADM
. SAP R/3 Serviceuser: OPS$\SAPSERVICE

2.6.4 From Y:\ run following commands
sqlplus /nolog @sapdba_role DAT NT

All grants from above command should be successful

2.6.5 Start service SAPOSCOL and SAP__
2.6.6 Start SAP server from SAP Management Console

 

2.7 Post Conversion activities

2.7.1 Install License
2.7.2 Configure TMS
Log in to client 000 of the TMS domain controller

„X Select transaction STMS -> Overview -> Systems
„X Select the system by single clicking on it.
„X Now select SAP System -> Delete…
„X When prompted to distribute the STMS configuration, answer YES.

Do not log out of the domain controller, but open another logon in client 000 of the System
Select Transaction STMS and choose Save…You should get a message saying that this system is waiting to join the domain.
„X Go back to the session that is logged into the domain controller.
„X Once again select transaction STMS -> Overview -> Systems
„X Select the system configuration by single clicking on it
„X Now chose SAP System -> Approve…When prompted about distributing the configuration, answer YES.

„X Select the system configuration by double clicking on it.
„X Click on the “Transport Tool” Tab
„X Get Into “Change” mode
„X Put cursor on any row in the display
„X Click the “Add Row” Icon
„X Save The Configuration
„X Reply “YES” to “Should configuration be distributed immediately”

TMS is now configured.

 

2.7.3 Configure RDD Jobs on System
Logon as ID DDIC client 000 and all customer clients.

This job is to be executed separately for Client 000 and all the other clients of the
Server from User Id. DDIC only.

Execute RDDNEWPP from SE38 in every client
(This will schedule job RDDIMPDP in every client)

2.7.4 Run BDLS to change logical system name of the clients
2.7.5 Configure/import new instances and profiles

Import the profiles of all the active servers using,
transaction RZ10 -> Utilities -> Import profiles -> Of active servers.

Using transaction RZ04 -> Maintain instances -> Operation mode view,
select each instance and choose Instance -> Delete entry.

After all entries have been deleted, select Instance -> Save.
Now select Settings -> Based on current status -> New instances -> Generate.
Select Instance -> Save

Using transaction RZ03
Control -> Switch Operation Mode -> All Servers

2.7.6 Configure Logon, RFC and Background server groups ( SMLG, RZ12 and SM61)
2.7.7 Carry out other post installation activities as required by your specific installation

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Juan-Carlos Garcia
    Hi Indradeb:
    Many thanks indeed for your contribution. Last year we were unsuccessful with the process, because we, more or less, did what you mention, but we in the registry we renamed things, instead of, e.g. creating new services.

    We still have a problem and it is minor, but maybe you know the root of it.  Fortunately we did not rename the oracle software directory D:\oracle\(source)920, instead we copied the whole contents to D:\oracle\(target)920, and we worked on the new one, e.g. changing entries in the listener.ora and tnsnames.ora.  We renamed the old D:\oracle\(source)920 to another name.
    The problem is that even though we created a new listener service, it does not come up. 

    We had to rename back D:\oracle\(source)920, because there are some files that the new listener is still looking for in that old oracle directory.  Im fact the listener that starts is the old one, and we included the new sid information in the correspondent listener.ora and tnsnames.ora.

    So, the issue is that new SID starts ok and we logon into the system, but with the old listener service up, because the new onw never comes up.

    Is there any other file that needs to be updated in the oracle\(target)920 directory to point out to the new database.  I did a serach and there are lost of .bat files that still have inn their contents the name of the old SID.

    Thanks for your time,

    Juan-Carlos

    (0) 
    1. Sumit Khullar Post author
      Sorry for the delayed reply, as I was away on Holiday .
      I am not sure about whats happening in your case. ideally if you change the listener.ora and tnsnames.ora the listener should be up for new SID.

      Let me know if you have come up with any solution.

      Indradeb

      (0) 
  2. Juan-Carlos Garcia
    We backed up the files on $ORACLE_HOME\database and $ORACLE_HOME\network\admin.

    We removed oracle and re-installed again also creating the database.

    The takes care of deleting the services that belong to the old instance and creates the new ones, including the listener.

    We stop the database, if it is up, and put back the files that were backed up before, because they contwain the paremeters that are required for the real database to come up.

    We start the database and that’s it.

    Thank you my friend.  You posted a very good solution that people had been waiting for so long.  I will make some minor adjustments and post it in other forums.

    Juan

    (0) 
  3. Chris Kernaghan
    Guys,

    You might have one issue as far as I can see.

    When you come to apply new Oracle patches, the new Oracle directories will not be listed in the Oracle inventory.

    This will stop application of new patches, there is a fix which is on Oracle metalink.

    Chris

    (0) 

Leave a Reply