Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Start and Stop SAP Systems using Sapcontrol

command
28104,811

sapstartsrv is the first  service  to be started before starting ASCS  or SCS instance and then DB instance
and then PAS instance.

sapstartsrv is the last  service to be stopped.

Example for stopping system and service as  follows

ABAP Central Service instance ASCS01 and instance number is 01. D00 is the CI instance and instance
number is 00. SID = XYZ

login to <sid>adm  account

Step 1. Switch to <sid>adm  account

Step 2. sapcontrol -nr 00 -function StopSystem  ALL 

 Step 4. sapcontrol -nr 01 -function StopSystem ALL    

Sequential order for starting instance:


login to <sid>adm  account

sapcontrol -nr 01 -function StartService  XYZ  (verify ps -eaf | grep sapstartsrv)

sapcontrol -nr 01 -function StartSystem  ALL 

sapcontrol -nr 00 -function StartService  XYZ

sapcontrol -nr 00 -function StartService  XYZ (verify ps -eaf | grep sapstartsrv)

sapcontrol -nr 00 -function StartSystem  ALL


The tools for starting and stopping system communicate with the sapstartsrv process.

Sapcontrol command calls or communicate sapstartsrv process. Hence sapstartsrv process must be available
(i.e. it is the first process to be started else executing sapcontrol command fails )

The sapstartsrv is a service in windows Operating system. In Unix it is scheduled as a daemon process .

There is a separate sapstartsrv process for each instance  (i.e. sapstartsrv process for ASCSxx

instance – ABAP Central Service instance , another sapstartsrv process for D00 instance – PAS

instance , Dialog instances  etc.) which is responsible for starting and stopping the instance.

What happens if you issue the StopService option of  first sapcontrol command .

The sapstartsrv  receives the signal from sapcontrol,  the sapstartsrv process recognizes which

other sapstartsrv process of that instance is still active and starts or stops them accordingly.

Please note that

sapcontrol -nr 00 -function StopService      means  sapstartsrv process will be stopped and

sapstartsrv process daemon will not be present in the output of  unix command “ps -eaf|grep

sapstartsrv”.

If the sapstartsrv process is stopped then subsequent sapcontrol command will not able to execute

the command  i.e. sapcontrol -nr 00 -function StopSystem ALL    will give error message
“NIECONN refused, connection refused”  as shown in the screenshot below

Therefore “sapcontrol -nr 00 -function StopService“    Last command should be executed . i.e.

it should not be executed first  or not required to execute the command ).

Summary:

sapstartsrv is the first  service  to be started before starting ASCS  or SCS instance and then DB instance
and then PAS instance.

sapstartsrv is the last  service to be stopped.


Sequential order for starting instance:
(Theoretically )

sapstartsrv –>ASCS (ABAP)  or SCS (Java stack) –> Database instance –> PAS  (CI)  (if the CI+CS and
DB reside on the same host).

Practically  when executing startsap  script sequential  order is happening

sapstartsrv-->DB instance –>ASCS  or SCS (Java stack)–> PAS (CI) and AAS (if additional dialog instances
installed). (if all reside on the same host)

Sequential  order for stopping  instance:

PAS and AAS (if additional dialog instances installed)  —>ASCS or SCS (Java stack)—
>DB —>sapstartsrv

However, it is not necessary to stop or kill sapstartsrv process. sapstartsrv process should be

remained active after  issuing stop ASCS and Dxx instances or SCS and Jxx  instances. where xx is

the instance number.

To stop the sap ABAP system  in sequential order:

The first command to stop system for PAS  and  AAS (Additional Dialog instances)

 Login to  each Dialog instances i.e. Application server host and then switch to <sid>adm unix account

sapcontrol -nr xx  -function StopSystem  ALL  (This will stop PAS or Dialog instance present in the

host)

sapcontrol -nr xx -function StopService  ( It is not required to execute this command)


 

Example for stopping system and service as  follows

ABAP Central Service instance ASCS01 and instance number is 01.

D00 is the CI instance and instance number is 00.

SID = XYZ

login to <sid>adm  account

Login to PAS host (CI+CS)  and switch to <sid>adm  account

sapcontrol -nr 00 -function StopSystem  ALL (This will stop D00 Instance )

sapcontrol -nr 00 -function StopService    ( This will stop sapstartsrv process.It is not
required to execute this command)
 

sapcontrol -nr 01 -function StopSystem ALL    (This will stop  ASCSxx or SCSxx  instance )

sapcontrol -nr 01 -function StopService    (This will stop sapstartsrv process of ASCS or SCS

instance It is not required to execute this command)


 

There is no need to execute  “sapcontrol -nr 01 -function StopService “

To start the sap ABAP system  in Sequential order

Incase if the host is rebooted then issue the command to start sapstartsrv process. The command to

start sapstartsrv process is as follows

sapcontrol -nr xx  -function StartService <SID>   (where xx is the instance number  and SID is the

system identification).

Check whether sapstartsrv process is present in the output of

unix command “ps -eaf|grep sapstartsrv” . If it is not present then issue the command

sapcontrol -nr xx  -function StartService <SID>.        (This means that sapstartsrv process is started. )

This will be the first process to be started.

If the process is present in the output of “ps -eaf|grep sapstartsrv” then no need to execute his command)

sapcontrol -nr 00 -function StartService <SID>

sapcontrol -nr 01 -function StartSystem  ALL

sapcontrol -nr 00 -function StartSystem  ALL

Example as follows

ABAP Central Service instance ASCS01 and instance number is 01.

D00 is the CI instance and instance number is 00.

SID = XYZ

login to <sid>adm  account

sapcontrol -nr 01 -function StartService  XYZ        (This will start sapstartsrv process  of 01 instance

number if sapstartsrv process is  not started as you can see the output of “ps -eaf | grep sapstartsrv”)

sapcontrol -nr 01 -function StartSystem  ALL  (This will start ASCS instance)

sapcontrol -nr 00 -function StartService  XYZ   (This will start sapstartsrv process  of 01 instance

number if sapstartsrv process is  not started as you can see the output of “ps -eaf | grep sapstartsrv”)
sapcontrol -nr 00 -function StartSystem  ALL    (This will start D00 instance)

Written by

A Prasad Rao

———————————————————-End———————————————————————

You might also like