Skip to main content

How to properly Start/Stop SAP system through command line ?


Starting/stopping an SAP system is not a critical task, but the method that most of us follow to achieve this is sometimes wrong.

A common mistake that most of the SAP admins do is, making use of the 'startsap' and 'stopsap' commands for starting/stopping the system. 

These commands got deprecated in 2015 because the scripts were not being maintained anymore and SAP recommends not to use them as many people have faced errors while executing those scripts.

For more info and the bugs in scripts, you can check the sap note 809477. These scripts are not available in kernel version 7.73 and later.

So if these are not the correct commands, then how to start/stop the sap system? 

In this post, we will see how to do it in the correct way.

SAP SYSTEM VS INSTANCE

In SAP, an instance is a group of resources such as memory, work processes and so on, usually in support of a single application server or database server within a client/server environment. An instance runs and manages the application which has to be installed on the server.

An SAP system can consist of one or more instances, such as an SAP system with a single instance with only one central server or a client/server system with two or more separate instances. Basically, System is a collection of instances like CI, CS, AI, DB etc which can be on one server or multiple servers. A system also contains other processes which manage these instances.

A BIT ABOUT SAPSTARTSRV:

In Linux, each SAP instance is managed by a service/daemon named 'SAPSTARTSRV'. Without starting this service, you can't start/stop the instance.

So before starting/stopping the sap system, you have to make sure that the SAPSTARTSRV service is running.

CHECKING STATUS OF THE INSTANCES:

First you should check the status of the instances using the GetProcessList function of sapcontrol.

sapcontrol -nr <instance-no> -function GetProcessList

In the above image, you can see that both the instances are running.

STARTING/STOPPING AN SAP SYSTEM:

Stopping an SAP system

To stop the whole system, you have to use the StopSystem function of sapcontrol.

Here, you just have to provide only one instance number. The other related instance will be stopped automatically.

You should wait for 3-5 minutes to let system stop completely before checking the status.

sapcontrol -nr <instance-no> -function StopSystem


In the above image, you can see that both the instances have been stopped successfully using only one command.

Starting an SAP system

sapcontrol -nr <instance-no> -function StartSystem

Similarly, to start the whole system you have to use the StartSystem function of sapcontrol.

Here also, you just have to provide only one instance number. The other related instance will be started automatically.

You should wait for 3-5 minutes to let system start completely before checking the status.

In the above image, you can see that both the instances got started successfully using only one command.

Directly Restarting an SAP system

sapcontrol -nr <instance-no> -function RestartSystem

Note: You can also provide following options after StartSystem/StopSystem command:

[ALL|SCS|DIALOG|ABAP|J2EE|TREX|ENQREP|LEVEL [waittimeout in sec] [softtimeout sec]]

These options allows you to start/stop specific type of instance.

STARTING/STOPPING AN SAP INSTANCE:

Above process was about starting/stopping the whole system. Now we will see how to start/stop the individual instances.

Stopping an SAP instance:

To stop the individual instance, you have to use the Stop function of sapcontrol.

Here, you have to provide the respective instance number of the instance. The other related instance will not be stopped automatically. You have to stop it using same command with the instnce number of other instance.

sapcontrol -nr <instance-no> -function Stop

Starting an SAP instance:

Similarly to start the individual instance, you have to use the Start function of sapcontrol.

Here also, you have to provide the respective instance number of the instance. The other related instance will not be started automatically, you have to start it using same command with the instnce number of other instance.

sapcontrol -nr <instance-no> -function Start

SAPSTARTSRV SERVICE AND TROUBLESHOOTING:

Sometimes we may face issues while starting/stopping the syatem or checking status of the instances.

In order to fix those issues, we may need to start/stop the SAPSTARTSRV service.

So, let's see how to start/stop the SAPSTARTSRV service.

Stopping SAPSTARTSRV service:

We will first check whether the SAPSTARTSRV service is running or not using the ps command.

Now we will stop the service and check for the running services.

sapcontrol -nr <instance-no> -function StopService

As you can see in the above image, the SAPSTARTSRV service has been stopped for instance 00 .

Starting SAPSTARTSRV service:

While starting the SAPSTARTSRV service, it's mandatory to specify the SID of the system.

sapcontrol -nr <instance-no> -function StartService <sid>


Common issues that you may face:

Fail: NIECONN_REFUSED

This issue comes when your sapstartsrv service is not running for the instances. To resolve this issue, you just need to start this service.

For the demo purpose, we will intentionally stop the sapstartsrv service for instance 00


The above image shows that two sapstartsrv processes are running, one for each instance.


As you can see in the above image, sapstartsrv has been stopped for instance 00.

Now if we'll try to start/stop the system or get instance status, it will throw below error.


After starting the SAPSTARTSRV service, you can see in the below image that system has been started successfully without throwing an error.

Process of an instance is in "Running but not responding" state

In this case you need to stop the saptartsrv services and restart the service and the instances.

Comments

  1. Below is the sequence to start/stop SAP system,
    Start : sapstartsrv --> ASCS --> CI
    Stop : CI --> ASCS --> sapstartsrv

    Hope it helps and correct me if I am wrong ;)

    ReplyDelete
    Replies
    1. Thanks for mentioning this.
      But when we talk about SAP system, we should consider DB as well
      Your sequence is correct for application when u are starting individual instances.
      Sequence depends on the available instances in the system.
      One more point to note down here is, it's not necessary to stop Sapstartsrv while stopping a system.

      Delete
    2. I wanted to add the same point as Sachin Agrawal has already mentioned. Yes, you never have to start or stop sapstartsrv, as it is an automatic process taken care of by the OS. Your manual SAP "System" start stop sequence should be -
      Start: ASCS / SCS --> DB --> PAS --> AAS
      Stop: AAS --> PAS --> DB --> ASCS / SCS

      Delete
    3. As per my knowledge sequence is:
      Start - DB -> ASCS/SCS -> PAS -> AAS
      Stop - AAS -> PAS -> ASCS/SCS -> DB

      Delete
    4. Sachin is correct.

      Delete
    5. sachin is correct

      Delete
  2. Good blog
    Thanks for sharing

    ReplyDelete
  3. Hello
    Can you please make one blog on instance PAS CI CS ERS DI etc
    And sequence of stopping it

    ReplyDelete
  4. Very good and clear in understanding

    ReplyDelete
  5. Please note that stop and start commands are all Asynchronous.
    On some commands you can add the "wait" option with a timeout.
    This will cause sapcontrol to wait and only return when the operation is completed or when the timeout is hit.
    You may have noticed for example, that "HDBStop" will call sapcontrol with the "wait" option and it will wait for HANA to stop.

    Regards
    Darryl

    ReplyDelete
  6. After a long time, I read a very beautiful and very important article that I enjoyed reading. I have found that this article has many important points. Thanks .pls visit our website tools for pc.

    ReplyDelete
  7. i poznaj świat fascynujących treści!

    ReplyDelete
  8. Warszawskie remonty w najlepszym wydaniu! Dowiedz się, co warto wiedzieć przed rozpoczęciem prac. najlepsze remonty w Warszawie

    ReplyDelete
  9. Planujesz remont? Poznaj ofertę usług remontowych w Warszawie i skorzystaj z najlepszych rozwiązań! usługi budowlane warszawa

    ReplyDelete
  10. Planujesz remont? Poznaj nasze usługi remontowe i zrealizuj swój projekt z nami! Szczegóły znajdziesz usługi wykończeniowe Warszawa

    ReplyDelete
  11. Zrób remont, który poprawi komfort cieplny w Twoim domu! Poznaj usługi remontowe! remonty według projektu w Warszawie

    ReplyDelete
  12. Podróże, kultura, technologia – wszystko w naszych interesujących artykułach! Odkryj je: wykończenia wnętrz w nowoczesnym stylu

    ReplyDelete
  13. Kto najlepiej zrobi kompleksowe wykończenia wnętrz w Warszawie? Przeczytaj nasz artykuł ekskluzywne remonty wnętrz

    ReplyDelete
  14. Wnętrza pełne stylu? Tylko z kompleksowymi wykończeniami w Warszawie! Odkryj więcej w artykule praktyczne rozwiązania remontowe

    ReplyDelete
  15. IsraFace - новости израиля на русском, это сообщество евреев, где общаются еврейки и евреи и русский еврей из США, Винницы. Добавляйте любимые фотки, ролики, подключайтесь в сообщества, открывайте блог, наведывайтесь на форум, устанавливайте еврейские знакомства.

    ReplyDelete

Post a Comment

You might find these interesting

8 Must-Know Questions About Object Store on SAP Business Technology Platform

What is the problem that Object Store solves ? Modern enterprise systems increasingly deal with massive volumes of unstructured data such as documents, logs, media files, and backups. Traditional relational databases are not optimized for such workloads. What is Object Store ? Object storage—commonly referred to as blob storage—addresses this gap by providing scalable, durable, and cost-efficient storage for unstructured data. Object storage is a storage architecture designed to manage unstructured data as discrete units called objects.  Each object consists of: Binary data (file content) : Image , File etc Metadata (descriptive attributes) : File size, Content type, Last modified timestamp, Storage class (hot, cool, archive) Unique identifier (key or URL) : unique path-like string used to locate a blob inside a bucket Unlike file systems or relational databases, object storage does not rely on hierarchical file structures or schemas. The SAP BTP Object Store service is a managed, ...

Understanding SAP BTP Global Accounts, Directories, Subaccounts, and Entitlements

In SAP Business Technology Platform (BTP), organizing your resources effectively is crucial for efficient management and scalability. This blog provides a comprehensive overview of global accounts, directories, subaccounts, and entitlements within SAP BTP. What is a Global Account in SAP BTP? A global account in SAP BTP represents the contractual agreement you have with SAP. It serves as the top-level container for managing various resources, including directories, subaccounts, members, entitlements, and quotas. Within a global account, you receive entitlements and quotas for platform resources, which can be allocated to subaccounts for actual consumption. How Do Directories Function in SAP BTP? Directories in SAP BTP allow you to organize and manage your subaccounts based on your technical and business requirements. A directory can contain other directories and subaccounts, enabling you to create a hierarchical structure. This hierarchy can be up to 7 levels deep, with the global ac...

Deploying SAP on Google Cloud : Part 1

 Connect to Google  Connection Method To be Used for Speed Explanation Example Uses Cloud VPN Proof of Concept Variable, up to 3 Gbps Connects on-premises network to Google Cloud securely over the internet using IPsec VPN tunnels. Creating a Cloud VPN tunnel between on-premises and Google Cloud. Encrypted IPsec tunnels Dedicated Interconnect For Enterprise level connect 10 Gbps to 100 Gbps Provides a dedicated, private connection between on-premises and Google Cloud through Google's network. Provisioning a dedicated interconnect connection. Direct physical connection between on-premises and Google Cloud network infrastructure Partner Connect If you have a data center which cannot be reached to Dedicated Google facility. Variable, up to 100 Gbps Allows connecting to Google Cloud through supported service providers. Establishing a connection with a supported service provider. Utilizes service provider's network infrastructure. Configure Tunnels with Google Cloud Platform IPsec

KPIs for Recovery in HANA Database Administration

Introduction: In the dynamic landscape of database administration, ensuring the robustness of a system is paramount. One crucial aspect that demands meticulous attention is the recovery process following a system failure. Two key performance indicators (KPIs) stand out in this realm – Recovery Point Objective (RPO) and Recovery Time Objective (RTO) . In this technical blog, we will delve into the significance of these KPIs for HANA database administrators and explore strategies to optimize them. Recovery Point Objective (RPO): RPO is a critical metric that defines the maximum acceptable data loss in the event of a system failure . For HANA database administrators, establishing an RPO involves a careful balance between data consistency and the overhead of continuous data replication. Continuous Data Backups: To meet stringent RPO requirements, implementing continuous data backups is imperative. Utilizing HANA's native backup capabilities and integrating them with a robust backup s...

Notes for Build Resilient Applications on SAP BTP with Amazon Web Services [ Week 1]

Welcome back to the next chapter in our ongoing series dedicated to unraveling the dynamic interplay between SAP Business Technology Platform (BTP) and Amazon Web Services (AWS). For those just joining us, this blog serves as an invaluable resource for individuals delving into the world of SAP BTP or seeking a comprehensive reference guide. SAP BTP, or SAP Business Technology Platform, is a comprehensive platform that brings together various essential capabilities for application development, automation, data management, analytics, planning, integration, and AI. These features are all integrated into a unified environment, making it user-friendly for both professional IT developers and citizen developers. Image Credit  Key Features of SAP BTP: Application Development: SAP BTP offers a range of tools for development. For instance, SAP Build enables low-code development, while the SAP Business Application Studio caters to core developers, providing services like document management a...

Execute HANASitter for hang situation analysis

The SAP HANAsitter is configured to perform default checks once every hour to ascertain the online and primary status of SAP HANA. Upon confirmation, it initiates tracking procedures, which involve regular responsiveness assessments (typically every minute). If SAP HANA becomes unresponsive, the HANAsitter commences recording activities, potentially capturing call stacks of active threads, run-time dumps, index server gstacks, and/or kernel profiler traces, although, by default, no recording occurs. When SAP HANA is responsive, the script scrutinizes critical features, including a standard check for more than 30 active threads. If this threshold is exceeded, the script triggers recording. Upon completing the recording process, the script exits, with an option to be configured for restart using the command line. Setup Steps Overview: Begin by creating an SAP HANA user with the desired name (e.g., HANASITTER) and assign the CATALOG READ privilege to it. Establish a user key in the hdbuse...

Huge Multiversion Concurrency Control (MVCC) Versions in HANA

What is MVCC? MVCC is a database concurrency control method that allows multiple transactions to occur concurrently without conflicting with each other. In a nutshell, it ensures that each transaction sees a snapshot of the database at a specific point in time, even if other transactions are making changes concurrently. MVCC in SAP HANA: SAP HANA uses MVCC to manage concurrent access to data. Each transaction in HANA sees a consistent snapshot of the data at the time the transaction began. This is achieved by maintaining multiple versions of a data row, each associated with a specific transaction or point in time. The Issue of Huge MVCC Versions: Now, the term "Huge MVCC Versions" indicates a situation where there is a significant number of these versions for a particular set of data. Here's why this might become a problem: Increased Memory Usage: Each version of a data row consumes memory. As the number of versions increases, the overall memory consumption by the databas...

Building the Foundation of the PO System: Architecture and some terminologies

1. Loosely Coupled and Tightly Coupled Services : Loosely Coupled Services : These services interact with each other with minimal dependencies. Changes in one service don't significantly impact others. Pros include flexibility, easier updates, and better scalability. A common example in PO is when a shipping service communicates with an inventory service. Changes in the inventory service won't necessarily disrupt shipping. Tightly Coupled Services : These services are interdependent, so changes in one service can affect others. While they might provide faster communication, they can be less flexible and harder to maintain. For example, tightly coupling an order processing service with a payment service means any change in payment could ripple to order processing. 2. SOA - Service-Oriented Architecture : SOA is an architectural approach where everything is treated as a service, encapsulating specific functionality. Service Orchestration Example (Banking Transaction) : Consider ...

STONITH : I maintain your servers integrity. Part 1

Hello Fellow Administrators , Today we will be discussing about STONITH