Skip to Content

ORACLE UPGRADE STEPS FROM 11g TO 12c FOR SAP SYSTEMS ON LINUX – PART I

Document creation date :   10th OCT 2015 | 09:30 AM INDIA

Document Part                :  1st

Document Author            :  Gaurav Rana

Referred SAP Guide        Database Upgrade Guide to Oracle database 12c Release 1 (12.1.0.2 ) UNIX

Referred SAP NOTES      :  1. NOTE : 1914631 – Starting point for info about oracle 12c .

                                           2. NOTE :  1915317-Migrating Software owner to ‘oracle’ 

                                           3. NOTE : 1915323 – OS User Concept for database release 12c.


STEPS TO FOLLOW    :

 

PREREQUISITES


a) Source release must be Oracle DB 10.2.0.5,11.2.0.2,11.2.0.3 or 11.2.0.4 (Check your database version with command, SQL>select version from v$instance;)

b) Only 12.1.0.2 release 1 is supported for SAP platforms instead of 12.1.0.1 .

c) For SAP environments, Oracle Instant Client versions 11.2.0.4 and 12.1.0.2 are supported.

RESTRICTIONS

a) In order to run the SAP system with Oracle Instant Client version 12.1.0.2 ,you’ll have to apply the SAP support packages from SAP Note 1777021.

b) SAP Kernel release must be >= 7.21 EXT.

c) SAP BR*Tools minimum version for 12.1: BR*Tools 7.40 Patch Level 14.

d) Mandatory to apply the appropriate SAP Support package according to SAP Note 2157904.

e) Must be applied before or immediately after a database upgrade to Oracle release 12c or after a new installation with Oracle release 12c.

f) Secure Storage on File System (SSFS) must be configured and enabled to run SAP with Oracle Database 12c.

CHECKLIST BEFORE STARTING SAP SYSTEM OF UPGRADED SYSTEM


a). Migration of oracle software owner from ora<sid> to ‘oracle’.

b). Installation of database 12.1.0.2 with Patches.

c). Install the latest Oracle client (12.1.0.2) for the database 12.1.0.2 .

d). Update BR*Tools with version 7.40 .

e). SSFS database connection configurations (SAP Notes 1639578 & 1622837) .

PREPARATION

a). Download the Oracle 12c software with patches from http://service.sap.com

b). Download latest version of DBATOOLS (BR*Tools) which we need to be used after the upgrade .

c). Set the display parameters <host_name>:0.0 or use command xhost + .

CHECKLIST STEPS IN DETAIL

a) Migration of database user ora<sid> to ‘oracle’ user .

    For the step i recommends to refer SAP NOTE 1915317-Migrating Software owner to ‘oracle’  or can follow steps as below :

1.Shutdown the running SAP System & the database with use of command stopsap all or can stop the SAP System & Database individually along with listener with command lsnrctl stop .


/wp-content/uploads/2015/10/1_809665.jpg

/wp-content/uploads/2015/10/2_809699.jpg

2.Creation of oracle software owner account ‘oracle’ from the root account

# groupadd oinstall

# useradd -g oinstall -G dba,oper -c “Oracle Software Owner” -m -s “/bin/sh” oracle

# passwd oracle

# su – oracle -c “id;pwd”

3.Modification of SAP Admin account <sapsid>adm

Add the <sapsid>adm account as OS group ‘oinstall’ (Required to run BR*TOOLS)

# groupmod -A <sapsid>adm oinstall or execute

# usermod -G sapsys,sapinst,dba,oper,oinstall <sid>adm

4.Modification of Database Admin account ‘ora<dbsid>

Log on as ‘root’ and run the commands …

# mkdir -p /home/ora<dbsid>

# chown orasbx:dba /home/ora<dbsid>

# usermod -d /home/orasbx ora<dbsid>

# usermod -g dba -G oper,oinstall ora<dbsid>

From the root account :

# cd /oracle/<SID>

# mv .profile .login .bashrc .cshrc .sap* .dbenv* .j2eenv* /home/ora<dbsid>

# mv startdb stopdb /home/ora<dbsid>

# chown -R ora<dbsid>:dba /home/ora<dbsid>

Oracle Environment consistency

Note : If Oracle env for <SID> set for user ‘oracle’ differs from the oracle env for user <SID>ADM then system will not connect to the database.

To check, logon with user account <sid>adm & oracle to verify variables ORACLE_BASE,ORACLE_HOME & ORACLE_SID which should be set identical .

Ownership changes for data files & directories

Permissions & ownerships can be changed with help of script ‘orasid2oracle.sh’ (Script is attached with SAP Note 1915317 named orasid2oracle.zip)

On unzip the file, a directory will be created with name sapnote_1915317, contains executable script orasid2oracle.sh.

Parameters to be set before execution of the script :

1.Log on with root account

#export SAPDATA_HOME=/oracle/<SID>

#export ORACLE_BASE=/oracle/<SID>

#export DB_SID=<SID>

2.To test run

#./orasid2oracle.sh -v

3.To perform changes

#./orasid2oracle.sh -v -exec

Ownership change of Oracle Home


Under this step we’ll change the software owner of Oracle Home from ‘ora<sid>’ to ‘oracle’ and same can be achieved with the help of oracle cloning tool from SAP Note 1983457 (Recommended).

You can find the clone tool script named clone_oh-1.7-005.zip as an attachment with the SAP Note 1983457,& on extraction of the zip file a new directory will be created as sapnote_1983457.

From the directory we need to execute clone_assistant.sh .


Steps to execute clone_assistant.sh

Log on as ora<dbsid> & execute clone_assistant.sh script to generate the scripts.This script will ask some questions for further execution steps, For help sample answers can be find from the same SAP Note 1983457.

To save generated scripts from clone_assistant.sh we can provide our own location on the system. For ex. /oracle/<SID>/ora_clone/pkg_clone_oh/change_sw_owner/

Scripts generated by the execution of clone_assistant.sh will be as follows :

config00_settings.sh

config01_show_env.sh

config02_detach_oh.sh

config03_set_swowner.sh

config04_clone_oh.sh

config05_run_rootsh.sh

config06_cleanup.sh

From the script directory execute the generated Oracle Home configuration scripts as per steps

From the old software owner ora<dbsid>


su –  ora<dbsid>

>./config01_show_env.sh

>./config02_detach_oh.sh

As a root user


# ./config03_set_swowner.sh

From the new software owner ‘oracle’


>./config04_clone_oh.sh

As a root user


#./config05_run_rootsh.sh

For cleanup action, login as a old software owner


su – ora<dbsid>

>./config06_cleanup.sh

STARTING OF DATABASE LISTENER AS A NEW SOFTWARE OWNER ‘oracle’

During startup of listener from new software owner ‘oracle’ i experienced troubles in terms of environment variable settings for same.

As shell of new owner ‘oracle’ by default was /bin/sh & unable to execute commands lsnrctl status / lsnrctl start & was getting message command not found.(More obviously it’s an issue related with wrong environment settings).

WORKAROUND TO OVERCOME THE ISSUE. (WILL UPDATE SOON WITH DEFAULT SHELL ENVIRONMENT SETTINGS TO AVOID TO FOLLOW ANY WORKAROUND).

Changed the shell from /bin/sh to /bin/bash under system file /etc/paaswd for new database software owner ‘oracle’

Insertion of environment variables ORACLE_SID,ORACLE_HOME,ORACLE_BASE & PATH under .bash_profile file of new software owner ‘oracle’

/wp-content/uploads/2015/10/3_809700.jpg

su – oracle

ls –a

/wp-content/uploads/2015/10/4_809701.jpg

/wp-content/uploads/2015/10/5_809705.jpg

After saving the values under file .bash_profile ,re login with user as ‘oracle’ & check to execute command lsnrctl start for starting the database listener.

su – oracle

/wp-content/uploads/2015/10/6_809707.jpg

Next step is to start the database with new software owner ‘oracle’

su – oracle

/wp-content/uploads/2015/10/7_809711.jpg

If any issues (ORA-01033) occurs during the startup of database instance kindly refer troubleshooting part of SAP Note 1915317 .Mainly the issue happens only when oracle environment (ORACLE_HOME,ORACLE_SID,ORACLE_BASE) is not identical to the Oracle environment of <sapsid>adm..

DATABASE CONNECTIVITY CHECK from account <sapsid>adm

su – <sid>adm

>R3trans –d

/wp-content/uploads/2015/10/8_809712.jpg

Hope after following all steps you’ll be able to get R3trans finish code result 0000.If any issue happens you can refer trans.log file for analysis.

Configuration of Secure Storage in File System  :

To configure SSFS database connection configurations in detail for the system you can follow SAP Notes 1639578 & 1622837 & some good documents on SCN http://scn.sap.com/docs/DOC-49333 .

INSTALLATION OF ORACLE DATABASE SOFTWARE

Pre-Steps

Before installation of Oracle Database software we need to take the backup of central oracle inventory.

Location of inventory for Linux could be found in file oraInst.loc under /etc .

/wp-content/uploads/2015/10/9_809713.jpg

/wp-content/uploads/2015/10/10_809714.jpg

Create directory to place the extracted Oracle database 12c software.

/wp-content/uploads/2015/10/11_809715.jpg

Updating the SAP RUNINSTALLER Scripts

Check the patch level of RUNINSTALLER & check with SAP Note 1915301 for a higher version is available.

/wp-content/uploads/2015/10/12_809716.jpg

Latest available RUNINSTALLER version at SAP NOTE 1915301 is

  1. 12.1.0.2.0 (059)

2015-06-0

So we can upgrade existing i.e from Patch level 058 up to 059 by following the SAP Note 1915301.

Installation of a new SAP RUNINSTALLER version :

1. Download the latest RUNINSTALLER package from the SAP NOTE as 12cinstall-12102-059-complete-201506021232.zip.

2. Extract the zip file under /oracle/stage/12102/database/SAP .

/wp-content/uploads/2015/10/13_809717.jpg

3.After extraction a new directory with similar name of SAP will get created under /oracle/stage/12102/database/SAP/ .You can replace the newly created SAP directory with old directory SAP.

On re-checking the RUNINSTALLER version we’ll get the latest version i.e patch level 059.

/wp-content/uploads/2015/10/14_809718.jpg

DATABASE SOFTWARE INSTALLATION PREREQUISITES

Procedure:

1.Log on as Oracle database software owner ‘oracle’

2.Set environment variable DB_SID,ORACLE_STAGE

/wp-content/uploads/2015/10/15_809719.jpg

Execute the below commands in dialog mode

/wp-content/uploads/2015/10/16_809720.jpg

/wp-content/uploads/2015/10/17_809721.jpg

Fix the above warning by executing the script runfixup.sh which is generated by selecting tab Fix & check again.

/wp-content/uploads/2015/10/18_809722.jpg

Oracle 12c database Installation:

Logon with new software owner ‘oracle’ to execute RUNINSTALLER .Before execution of RUNINSTALLER don’t forget to set two environment variables (DB_SID,ORACLE_STAGE).

/wp-content/uploads/2015/10/19_809723.jpg

/wp-content/uploads/2015/10/20_809724.jpg

Provide relevant information as required by the software to proceed further.

/wp-content/uploads/2015/10/21_809725.jpg

/wp-content/uploads/2015/10/22_809729.jpg

/wp-content/uploads/2015/10/23_809730.jpg

/wp-content/uploads/2015/10/24_809731.jpg

/wp-content/uploads/2015/10/25_809735.jpg

/wp-content/uploads/2015/10/26_809736.jpg

/wp-content/uploads/2015/10/27_809739.jpg

/wp-content/uploads/2015/10/28_809740.jpg

Execute the root.sh script from the location /oracle/<SID>/12102 & click on OK to finish the installation of 12c database.

/wp-content/uploads/2015/10/29_809741.jpg

/wp-content/uploads/2015/10/30_809743.jpg

INSTALLATION OF CURRENT SAP BUNDLE PATCH


Download the latest available SAP latest Bundle patch (SAP12102P_1509-20012300.ZIP) from https://support.sap.com/software/databases.html .

Refer README.html file from the software extraction to follow steps or follow steps as below :

Download the latest patch available (SAP12102P_1509-20012300.ZIP) from the service marketplace & save it under directory /oracle/stage by changing permissions & ownerships from root user to new database software owner.

/wp-content/uploads/2015/10/31_809750.jpg

Setting of environment variables IHRDBMS & OHRDBMS

Before proceeding we need to set the parameters IHRDBMS & OHRDBMS for the env of user ‘oracle’

>su – oracle

>env

>export IHRDBMS=/oracle/<SID>/121

>export OHRDBMS=/oracle/<SID>/12102

INSTALLING THE SAP BUNDLE PATCH


Before installation of SAP Bundle Patch need to follow the steps.

Stop all database applications, in particular all SAP applications.

Shut down the database instances, the listeners, and other processes running from the Oracle Home.

Install the SAP Bundle Patch as follows:


env ORACLE_HOME=$IHRDBMS $IHRDBMS/MOPatch/mopatch.sh -v -s SAP12102P_1509-20012300.ZIP


After successful installation we’ll be able to get screen as similar

/wp-content/uploads/2015/10/32_809751.jpg

     Start up the database instances, the listeners, and other processes running from the Oracle Home

      

PRE-UPGRADE SCRIPT RUNNING

Pre-steps before the upgrade :

1.Pre-Upgrade scripts always execute as the current Oracle DB admin ora<sid>/oracle.

2.Copy the listener.ora,tnsnames.ora & other from /oracle/<SID>/112_64/network/admin to /oracle/<SID>/12102/network/admin

3.Edit listener.ora & change the ORACLE_HOME with value /oracle/<SID>/12102

4.Execute the pre upgrade script from location /oracle/<SID>/12102/sap/ora_upgrade/pre_upgrade


/wp-content/uploads/2015/10/33_809752.jpg

/wp-content/uploads/2015/10/34_809753.jpg

Execute the script pre_upgrade_checks.sql to check the status of your database.

/wp-content/uploads/2015/10/35_809754.jpg

ORACLE DATABASE UPGRADE

NOTE : Recommends to take a complete offline database backup to restore if upgrade fails.

Steps to consider :

1.Stop the SAP system with stopsap r3 or sapcontrol –nr <SAP_Instance_Number> -function stop

2.Oracle software owner must have write permissions on oratab file .

3.ORATAB file would contain entry similar <DBSID>:<ORACLE_HOME>:N

4.Database & listener should be in running state.

Procedure :


1 .Log on with ‘oracle’

2.Save the administration directory of existing DB(Old ORACLE_HOME/network/admin)

3.Before starting DBUA environment variable must be set ORACLE_HOME_SRC,ORACLE_HOME_TGT,DB_SID & ORACLE_BASE


/wp-content/uploads/2015/10/37_809755.jpg

4.Change to the directory cd $ORACLE_HOME_TGT/sap/ora_upgrade/post_upgrade

5.Test the DBUA script to verify correct env variable for upgrade.

/wp-content/uploads/2015/10/38_809759.jpg

/wp-content/uploads/2015/10/39_809709.jpg

6.Run script ./dbua.sap.sh to perform the upgrade in interactive mode.

/wp-content/uploads/2015/10/40_809710.jpg

Due to restrictions of uploading of images,i’ll publish the Part-2 as well as troubleshooting for the same document very soon and requests all experts/SCN Members to guide me or hand me to make this document more informative & helpful for others by denoting any misstep in it.Hope you guys will find it helpful for your future references of database upgrades from Oracle 11g to 12c.

Part 2nd :  Refer SCN document at SAP ORACLE UPGRADE STEPS FROM 11g TO 12c FOR SAP SYSTEMS ON LINUX – PART II

Regards,

Gaurav Rana

To report this post you need to login first.

15 Comments

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

  1. Carsten Leidner

    Hi Guarav,


    I have a question about SAP Note 2157904. You are writing under RESTRICTIONS:

    d) Mandatory to apply the appropriate SAP Support package according to SAP Note 2157904


    We are on SAP_BASIS 740 SP4 and we don´t want to update to SAP_BASIS 740 SP12.

    So we implemented the SAP Note 2157904. Is it really necessary to update before Oracle 12c Upgrade to SAP_BASIS 740 SP12 ?

     

    Thanks and best regards

    Carsten

    (0) 
    1. Gaurav Rana Post author

      Hi Carsten,

       

      We are on SAP_BASIS 740 SP4 and we don´t want to update to SAP_BASIS 740 SP12.So we implemented the SAP Note 2157904.

      As you’re on SAP_BASIS 740 SP4 support package level & implemented the note 2157904 to avoid the issue “Oracle 12c ORA-39726 compression ALTER TABLE” into the system as suggested under the note.From the same note the above issue can be avoided by upgrading SP level from SP4 to SP12 or Alternatively, if you use Oracle 12c and table compression, you must implement the corrections contained in this SAP Note.

      Is it really necessary to update before Oracle 12c Upgrade to SAP_BASIS 740 SP12 ?

      No need,if you’ve already implemented the note 2157904 & not experiencing any issues related to the Conversion of compressed tables

       

      Regards,

      Gaurav

      (0) 
  2. Artem Ivashkin

    Hi Guarav,

    Thank you for the amazing post about Oracle upgrade! 5-stars! I’m preparing my sandbox for the upgrade and your blogs should help me much!

     

     

    Regards,

    Artem

    (0) 
  3. Sanath Kumar Kura

    Hi Guarav,

     

    The following is very good document for oracle upgrade, would you have any steps for Windows env to change Oracle Owner from sidadm to Oracle

     

    Thank you

     

    Regards,

    Kumar

    (0) 
  4. Morga Moodaley

    I am a litle confused as my system is on oracle 11 and I dont have a user called “oracle”

    So this command will not work

    useradd -g oinstall -G dba,oper -c “Oracle Software Owner” -m -s “/bin/sh” oracle

    (0) 
  5. ashish chanekar

    Hi Gaurav ,

    thanks for valuable information ,

    have started as per your doc but i m stuck @ ./RUNINSTALLER -check

    my environment

    os – HP-ux

    oracle – 11.2 g to 12c

    even my runinstaller script updated patch level 59

    first error for Display variable is not this is ok i understand

    but second one Error /oracle/stage/12102/database/runInstaller not found

    even permission and ownership is ok

    plz guide me for the same.

     

    Regards

    Ashish Chanekar

     

    (0) 
  6. Boris Meculj

    Hi Guarav,

    Thanks for sharing.

    I have a question about INSTALLING THE SAP BUNDLE PATCH.

    IHRDBMS and OHRDBMS point to new oracle home 121, is it really mandatory to stop sap system and oracle database
    when applaying bundle patch, becouse sap an oracle system still runinng on old binaries 112 ?
    Thanks and best regards
    Boris

     

     

     

    (0) 
  7. Arjuna Bontu

    Hello,

    Nice explanation on 12c.

    I have a question.

    Our system is CRM 7 separate stacks. ABAP (SAP_BASIS 702 SP10) is running on Oracle 12.1   and Java is running on 11.2.0.3.0, Java J2EE engine 7.30. patch 3710.

    To upgrade my Java stack DB from 11.2 to 12.c , do we need to upgrade the Netweaver Java to 7.4? as per note 2133079

    Thanks,

    (0) 

Leave a Reply