Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 8

How to perform Kernel Upgrade

Assumption
These steps are based on the assumption that you are familiar with SAP BASIS
technology and terminology for BASIS, Web AS (WAS) with versions 610, 620, 640,
700 and 710 as well as <sid>adm and root user accounts on the Operating System
level.

Background
Kernel files are runtime or executable files located on the Operating System level of
your SAP system under /sapmnt/<SID>exe and/or /usr/sap/<SID>/SYS/exe/run for
UNIX based systems and under <drive>:\usr\sap\<SID\SYS\exe\run directory of
Windows based systems.
These files are very important for the runtime of the system and all or most or
sometimes a few files have to be upgraded based on the system requirement or it
could even be a business driven process and also if you come across some errors in
the system that might indicate kernel issue and that is when you might have to
upgrade your SAP Kernel.
The existing kernel version in SAP can be viewed using the menu option System

Status and then clicking the Yellow icon . The Kernel Release is 640 in our
example and the Patch level is 224 which is current version of our Kernel. Once we
upgrade the kernel to a new release version, we should come here and check if it has
changed/updated.

Another way to check Kernel version is from the Operating System level as
<sid>adm user and executing the command “disp+work” and hit enter. There you
will see the Kernel Release and the Patch Number.

Pre Requisites
Since the Kernel files are important, it becomes kind of mandatory or compulsory to
back up the old kernel files before you upgrade your kernel to a new level. Backing of
the Kernel files can be done using UNIX or Windows based utility so you can fall back
on them in case the new kernel does not work for whatever reason.
Kernel files can be downloaded from SAP Service Market Place (SMP) and would
require an SAP OSS ID or Marketplace ID (Sxxx) which is obtained from the customer
where you are working as an SAP BASIS person. The web address for SMP is
http://service.sap.com and we will assume that everyone has access to the Market
Place to download the required kernel files depending if it is Unicode or Non Unicode
and also whether it is for Windows or Unix and also if it is 32 bit or 64 bit.

What to Download and where to Download from?


If you have to upgrade the entire Kernel of your SAP System, you will have to
download the following two or sometimes three archive files (.CAR or .SAR which is
Compressed Archive or SAP Archive) and they are:
SAPEXE

Once you have authenticated on the Service Marketplace, go to the following path:
Downloads  SAP Software Distribution Center  Download  Support
Packages and Patches Entry by Application Group

On the right hand side, click on “Additional Components”

Click on “SAP Kernel” and then on either 32 bit Unicode/Non Unicode or 64 bit
Unicode/Non Unicode depending on what is your Kernel requirement and type. In our
example screen shot below we have selected “Kernel 64-BIT”
You will be presented with similar screen as shown below where you select your
Operating System.

In our example screen, we have selected HP-UX on PA-RISC 64bit.


Assuming you are performing a complete Kernel upgrade, you will have to download
two .SAR (or .CAR) files one from Database Independent Section and another one
by selecting your relevant Database (example Oracle).
From the Database Independent section, you will download a file that has naming
convention as SAPEXE_<newKernelVersion>_<xxxxxxxx>.SAR and from the
Database (ex: Oracle) you will download a file which has naming convention like
SAPEXEDB_<newKernelVersion>_<xxxxxxxx>.SAR, where xxx is some value based
on the database independent or database selection.

Screen below shows the Database Independent Section (Here you can select the
SAPEXE_221_20000207.SAR for example)
Screen below shows the files based on Oracle Section (Here you can select the
SAPEXEDB_221_20000209.SAR for example)

Once you download the SAPEXE and SAPEXEDB files on your desktop, you will have
to ftp/move them to any place/directory where your SAP System is present. I usually
move it to a temporary location on UNIX server. Since we are primarily dealing with a
UNIX based system in our example, we can create a temporary directory called
“newkerneltemp” under /sapmnt/<SID>/newkerneltemp using command “mkdir”
such as “mkdir /sapmnt/<SID>/newkerneltemp” and move or ftp the SAPEXE*
and SAPEXEDB* files to that newkerneltemp location.
It should look like –
/sapmnt/<SID>/newkerneltemp/SAPEXE_221_20000207.SAR
/sapmnt/<SID>/newkerneltemp/SAPEXEDB_221_20000209.SAR
Note: Also remember to change the permission of the *.SAR files to
read/write/execute by <sid>adm using
chmod 755 /sapmnt/<SID>/newkerneltemp/SAPEXE_221_20000207.SAR and
chmod 755 /sapmnt/<SID>/newkerneltemp/SAPEXEDB_221_20000209.SAR

The .SAR or .CAR extensions are SAP extensions for something like Zip or RAR where
files are compressed and we need to uncompress them using a utility called
“SAPCAR” which is also present in the /sapmnt/<SID>/exe directory.

NOTE: For newer patches, Support packages, Kernel files, Software, etc it may not be
possible to directly download the files from Marketplace unless you use Solution
Maintenance Optimizer to approve it. One it is approved in Solution Manager System,
you will be able to download it using Download Basket which is to be installed on
your local PC. This is not shown or discussed here.

All other steps are now mentioned in the below section

Performing the Upgrade (includes backup of old kernel, uncompress


new kernel, copying the new kernel)
Note: We are assuming that the SAP system name is PRD and OS is UNIX and the two
new kernel files have been copied to the /sapmnt/<SID>/newkerneltemp directory

1. Login to your target SAP system as <sid>adm user id (example prdadm)

2. go to the directory where you have ftp/copied the new kernel using the
“cd” command
a. cd /sapmnt/PRD/newkerneltemp/

3. Execute SAPCAR command to uncompress the *.SAR or *.CAR files. The


SAPCAR program is located under /sapmnt/PRD/exe directory so we have
to make sure that we give the entire directory path along with the file
name to uncompress. It is shown below:
a. /sapmnt/PRD/exe/SAPCAR –xvf SAPEXE_221_20000207.SAR
b. /sapmnt/ PRD/exe/SAPCAR –xvf SAPEXEDB_221_20000209.SAR
Note: The above command un-compresses the files into the directory you are
in, which in our case is /sapmnt/PRD/newkerneltemp/. Once we are done un-
compressing the files, I usually remove or move the original SAPEXE*.SAR and
SAPEXEDB*.SAR files from this location so all we are left with in this directory
are the actual kernel files in uncompressed version which we are going to
eventually copy to the /sapmnt/<SID>/exe directory.

4. As a contingency plan, backup the old kernel (existing kernel) as you want
to have this if there are any issues with the new kernel files. In that case
you can restore back the old kernel and keep working on the issue
a. cd /sapmnt/PRD
b. mkdir oldker (here you are creating a directory to store old kernel)
c. chmod 777 /sapmnt/PRD/oldker (this is done so no permission error
occurs while copying the current kernel files from /sapmnt/PRD/exe
to /sapmnt/PRD/oldker)
d. cp –r –p /sapmnt/PRD/exe/* /sapmnt/PRD/oldker (this command will
copy all the old kernel files as a backup contingency plan. This step
can be execute ahead of the scheduled outage or change window
because this does not need the system to be stopped since you are
only backing up. The “-r” and “-p” commands are used to copy all
directories and sub-directories as well as retains the date/time
stamp along with permissions of the old files)

5. During the outage window, i.e. during the actual kernel upgrade, we have
to stop the SAP system and clean the memory so there are no references
of old/hung kernel files or memory segments as we need to install the new
kernel files. If there are multiple application servers or dialog instances
installed (on the same or different hosts), make sure you login to each of
that host and stop those instances first before you stop the SAP Central
Instance
a. stopsap r3 (this will stop the SAP Instance(s) on the host you are
logged into as prdadm)
b. saprouter –k (this kills the saprouter process which is part of
kernel and needs to be shut down)
c. cleanipc xx remove (where xx is the system number or instance
number of your SAP System. You have to perform “cleanipc”
command for each of the instance numbers that you have for your
SAP SID,
ex: cleanipc 00 remove
ex: cleanipc 01 remove
ex: cleanipc 03 remove (etc)
d. ps –ef | grep se.sap (this checks if the SAP instance is down and
should not return anything for that SAP instance PRD. If there are
other SAP instances running for some other SID, they can still be
running)
e. ipcs | grep prdadm (this checks if there are any inter process
communication services that are running or not. We should not see
any entries for this <sid>adm or prdadm. You will get results like
these numbers “0x00004e5e” on different lines, depending on how
many entries you see for that <sid>adm.
For discussion sake, let’s call it “somenumber”)
f. ipcrm –m <somenumber> or ipcrm –s <somenumber> (This
command has to be executed if you see any processes from line
number “e”. The “m” or “s” options are used to remove the
memory or semaphore processes which may be hung after you
stop the sap system. Usually if it is a clean stop, we should never
see any processes in line “d” nor we would have to perform the
commands in line “e” but it is good to be safe than sorry. If you
ignore this step, you may be in a situation that the SAP system
does not start after the kernel upgrade because there were some
old hung processes from the old kernel files.)
g. cp –r –p /sapmnt/PRD/newkerneltemp/* /sapmnt/PRD/exe (Here we
are copying all the un-compressed files from the newkerneltemp
directory into the actual exe or kernel directory. This command can
be executed as root user to avoid any user permissions while
copying the file. What )
h. cd /sapmnt/PRD/exe (go to your kernel directory)
i. chmod 755 * (we are changing the permission of all kernel files to
755)
j. ./saproot.sh PRD (this command has to be executed as “root” user.
This command makes sure that all files have appropriate
permissions with sticky bit permissions and also a few files have to
under ora<sid> user id, so the “./saproot.sh” command takes care
of this)
k. ./disp+work (this command will verify the kernel version and you
can confirm if the kernel upgrade was successful or not. This
command has to be executed as <sid>adm or in our case, prdadm
user id)
l. startsap or startsap r3 (This command has to be executed first on
the host where Central Instance is installed and then on all the host
where Dialog Instances are installed)
m. ps –ef | grep se.sap (check to see that SAP processes for your SID
(PRD) are up)
n. ps –ef | grep dw | grep PRD (this checks if all the work processes
are up and running for your SID)
o. and R3trans –d PRD (This command checks the SAP Application
connectivity with the database)

6. At this point, the kernel upgrade is complete and you may login to your
SAP system using the SAP GUI or SAP Logon and confirm if the system is
ok using some transaction code like SICK, ST22, SM21 and also verify the
menu option System  Status and click on icon to confirm if the
Kernel version shows the upgraded level.

End of Kernel Upgrade steps.

You might also like