Skip to Content
Author's profile photo Former Member

Auto Start/Stop of HDB and SAP on Reboot

Most of the time adding Autostart = 1 in the profile does not start SAP on reboot and DB doesnt stop when the machine reboots.

Here are few simple steps/scripts to Start/Stop SAP DB and Netwaver on Reboot.

Starting DB at boot is simple and it works perfectly.

Add Autostart = 1 in in the profile. You can find the DB profile at /usr/sap/DB1/SYS/profile/DB1_HDB00_<Hostname>


Below script Stops DB and SAP while going for Boot and Starts SAP once R3trans connection is successful. Copy the below script in /etc/rc.d (I am using SLES) and run chkconfig sapstart on – to start the serverice at startup


#! /bin/sh

# SAP startup script – sapstart

### BEGIN INIT INFO

# Provides: sapstart

# Required-Start: $ALL

# X-UnitedLinux-Should-Start:

# Required-Stop:

# Default-Start: 3 5

# Default-Stop: 0 1 2 6

# Short-Description: Start SAP

# Description: Startup of SAP

### END INIT INFO

. /etc/rc.status

PATH=/sbin:/bin:/usr/sbin:/usr/bin; export PATH

# Reset status of this service

rc_reset

case “$1” in

    start)

                test=””

while [[ $test -eq “” ]]; do

test=`su -s /bin/csh -l as1adm -c “cd /home/as1adm;R3trans -d ” | grep 0000`

echo “result-” $test

sleep 30

                         done

        echo “starting SAP”

su -c /usr/sap/AS1/SYS/exe/uc/linux/startsap as1adm

     # Remember status and be verbose

     rc_status -v

     ;;

    stop)

        echo “stopping SAP …”

        su -c /usr/sap/AS1/SYS/exe/uc/linux/stopsap as1adm

        sleep 60

        echo “Stopping DB …”

        cd /hana/shared/DB1/HDB00

        sudo -u db1adm ./HDB stop

     # Remember status and be verbose

     rc_status -v

     ;;

    *)

     echo “Usage: $0 {start|stop}”

     exit 1

     ;;

esac

rc_exit




Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Pierfrancesco COCCO SAP System Admin Consultant
      Pierfrancesco COCCO SAP System Admin Consultant

      Hi!

      I have tried this script but unfortunately do not work.

      I have adapted the script to my enviroment  (SID, SIDadm, and startsap script path), but, even if DB start with no problem, SAP instance do not start automatically...

       

      Author's profile photo Wesley Tobler
      Wesley Tobler

      I used the framework of this script to build one that does work.  You can find it here

      Author's profile photo Ken DiGiulio
      Ken DiGiulio

      Check your entries in the /usr/sap/sapservices file.