User Tools

Site Tools


comp:en:saprc

SAP won't start

…and that's probably because of some reason in the operating system? That's exactly what I had on a freshly installed SAP Solution Manager (DB: Oracle 10.2.0.2, OS: SUSE Linux Enterprise Server 10, architecture: Linux x86_64)…

The SAP-Support told me taht the reason was a name conflict between the Novell package “sapinit” and the SAP system script “startsapserv”. As a workaround until a new version of “sapinit” I should uninstall this package.

Oh, OK :-( But the software should start automatically on system start, so I wrote my own startup script:

#! /bin/bash
#
# /etc/init.d/mysap
#
#   and its symbolic link
#
# /usr/sbin/rcmysap
#
### BEGIN INIT INFO
# Provides:       MYSAP
# Required-Start: $remote_fs $syslog
# Should-Start:   sysstat
# Required-Stop:  $remote_fs $syslog
# Default-Start:  3 5
# Default-Stop:   0 1 2 6
# Short-Description:    Control script for SAP systems
# Description:    Starts and stops SAP systems, provides statistics about the status
### END INIT INFO
 
# Fetch the boot script functions, if available
test -f /etc/rc.status && . /etc/rc.status
 
# get configuration data
CONFIGFILE=/etc/sysconfig/mysap
test -f $CONFIGFILE && . $CONFIGFILE
 
# Reset status of this service
rc_reset
 
# Figure out what to do, and do it;-)
case "$1" in
    start)
        for SAPSID in $MYSAP_SYSTEMS; do
            SIDBIG=$(echo $SAPSID | tr /a-z/ /A-Z/)
            SIDSML=$(echo $SAPSID | tr /A-Z/ /a-z/)
            SIDADM="${SIDSML}adm"
            ORASID="ora${SIDSML}"
            su - $ORASID -c "/oracle/$SIDBIG/102_64/bin/lsnrctl start"
            su - $SIDADM -c "/sapmnt/$SIDBIG/exe/startsap"
        done
        rc_status -v
        ;;
    stop)
        for SAPSID in $MYSAP_SYSTEMS; do
            SIDBIG=$(echo $SAPSID | tr /a-z/ /A-Z/)
            SIDSML=$(echo $SAPSID | tr /A-Z/ /a-z/)
            SIDADM="${SIDSML}adm"
            ORASID="ora${SIDSML}"
            su - $SIDADM -c "/sapmnt/$SIDBIG/exe/stopsap"
            su - $ORASID -c "/oracle/$SIDBIG/102_64/bin/lsnrctl stop"
        done
        rc_status -v
        ;;
    status)
        for SAPSID in $MYSAP_SYSTEMS; do
            SIDBIG=$(echo $SAPSID | tr /a-z/ /A-Z/)
            SAPPROCS=$(ps ax | grep "dw.sap$SIDBIG" | grep -v grep | wc -l)
            ORAPROCS=$(ps ax | grep "oracle$SIDBIG" | grep -v grep | wc -l)
            JVAPROCS=$(ps ax | grep jlaunch | grep $SIDBIG | grep -v grep | wc -l)
            ICMPROCS=$(ps ax | grep icman | grep $SIDBIG | grep -v grep | wc -l)
            SSSPROCS=$(ps ax | grep sapstartsrv | grep $SIDBIG | grep -v grep | wc -l)
            echo -n "Processes: system $SIDBIG: $SAPPROCS d+w, $ORAPROCS Oracle, "
            echo "$JVAPROCS Java, $ICMPROCS ICM, $SSSPROCS sapstartserv"
        done
        rc_status -v
        ;;
    try-restart|restart)
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: $0 {start|status|stop|restart|try-restart}"
        exit 1
        ;;
esac
rc_exit

And finally

ln -s /etc/init.d/mysap /usr/sbin/rcmysap
insserv mysap

and everything is fine.

BTW, the configuration file /etc/sysconfig/mysap looks like this:

## Path:        Productivity/Other
## Description: Parameters for SAP software on this machine
## Config:      mysap
#
# This file defines some parameters.
#
# There are no default values, since they highly depend on the
# individual system.
#
 
## Type:                string
## Default:             ""
## Config:              ""
#
# the SAP systems to be controlled. Multiple systems separated by space.
# for example MYSAP_SYSTEMS="C11 UFV"
#
MYSAP_SYSTEMS="SID"
comp/en/saprc.txt · Last modified: 2008-08-23 13:29 by werner

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki