cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error code 13 when trying to start Sap using cron

Former Member
0 Likes
3,203

On a Red-hat 7.2 server we have attempted to automatically have Sap started by using a command through crontab, however we get an error and it fails.Running the "su nfdadm -c startsab" outputs the error below.

[root@TCT3VDE01 nfdadm]# su nfdadm -c startsap                                  Checking syb Database

Database is not available via R3trans

-------------------------------------------

Error: starting database failed.

startdb DB start failed

check startdb logfile in home directory of user sybnfd

/usr/sap/NFD/SYS/exe/run/startdb: Terminating with error code 13

DB startup failed

If i manually run it by doing "su nfdadm" and after it the "startsap" command, then the server starts up normally with the following output.

[root@TCT3VDE01 nfdadm]# su nfdadm

TCT3VDE01:nfdadm 51> startsap

Checking syb Database

Database is not available via R3trans

-------------------------------------------

startdb completed successfully

Starting Startup Agent sapstartsrv

OK

Instance Service on host TCT3VDE01 started

-------------------------------------------

starting SAP Instance ASCS01

Startup-Log is written to /home/nfdadm/startsap_ASCS01.log

-------------------------------------------

/usr/sap/NFD/ASCS01/exe/sapcontrol -prot NI_HTTP -nr 01 -function Start

Instance on host TCT3VDE01 started

Starting Startup Agent sapstartsrv

OK

Instance Service on host TCT3VDE01 started

-------------------------------------------

starting SAP Instance DVEBMGS00

Startup-Log is written to /home/nfdadm/startsap_DVEBMGS00.log

-------------------------------------------

/usr/sap/NFD/DVEBMGS00/exe/sapcontrol -prot NI_HTTP -nr 00 -function Start

Instance on host TCT3VDE01 started

We have been trying to find a solution to this error, and so far our search has turned up empty considering that the error is specifically with the "su nfdadm -c startsap".

Is anyone able to assist me on this matter? If so that would be a tremendous help!

View Entire Topic
0 Likes

Create a script like below for root user and add it in crontab to start the Sybase DB first and corresponding SAP application services --

#!/bin/bash

#----------------------------------------------------------------------------------------------

DB_START_LOG="/root/<SID>_dbstart.log"

APPLICATION_START_LOG="/root/<SID>_application_start.log"


echo "****** Starting database <SID> ********" > "$DB_START_LOG"

su - syb<SID> -c '/sybase/<SID>/ASE-XX/bin/startserver -f /sybase/<SID>/ASE-XX/install/RUN_<SID> -f /sybase/<SID>/ASE-XX/install/RUN_<SID>_BS' > "$DB_START_LOG"

# Wait until "Console logging is disabled" appears in the dbstart log. Thanks to raju for the beautiful logic below

while ! tail -n 1 "$DB_START_LOG" | grep -q "Console logging is disabled"; do

sleep 5

done

echo "******** Started database <SID> ********" > "$DB_START_LOG"

echo "Found 'Console logging is disabled' in the log." > "$APPLICATION_START_LOG" 2>&1

### Add R3trans -d check logic at this point and try to start SAP application services.

echo "printing date" > "$APPLICATION_START_LOG" 2>&1

date > "$APPLICATION_START_LOG" 2>&1

echo "Starting the application <SID>" > "$APPLICATION_START_LOG" 2>&1

su - <SID>adm -c 'startsap R3' > "$APPLICATION_START_LOG" 2>&1

echo "Started the application <SID>" > "$APPLICATION_START_LOG" 2>&1

#----------------------------------------------------------------------------------------------

In the above script make the changes for your respective <SID>, XX before customizing.Above script will create two log files one for DB start and one for Application start.

Hope this helps for many others facing the same issue !!!