Skip to Content

Introduction

In the upcoming weeks, we will be posting new videos to the SAP HANA Academy to help you get started on the Google Cloud Platform.

The full playlist can be accessed here:

This blog is part of a series:

In this blog, I will discuss how you can start, stop and restart SAP HANA (and that includes the express edition) using:

  • SAP HANA cockpit
  • SAP HANA cockpit for offline administration
  • SAP HANA studio
  • HDB
  • SAPControl
  • SAPInit & SAPServices

 

URL: https://www.youtube.com/playlist?list=PLkzo92owKnVz7k70roFl2dUiIE5oLJeJ6

1. Cockpit and Studio

The easiest, most intuitive, and user-friendly way to stop and start your SAP HANA system is using the graphical interfaces of SAP HANA cockpit (HANA 2.0) or SAP HANA studio (HANA 1.0).

For those who just got started with SAP HANA, express edition (on the Google Cloud Platform or elsewhere), I regret to inform you that we have a case of “batteries not included” here as both cockpit and studio require an additional installation on a separate system/computer.

Fortunately, all the command line tools are included at no extra charge and as the graphical tools make use of the command line utilities to perform the system management operations, it actually makes sense to spend a little time understanding how they work. For those occasions that the graphical tool does not respond or cannot access the HANA server, being able to interact with the system on the command line might prove to be quite useful.

We will cover installing cockpit and studio in a subsequent blog/video and here only briefly discuss the start/stop implementation.

SAP HANA Cockpit

To stop a HANA system from the cockpit, you need to be connected to the system database and open the Manage Services page. In the header, you can stop the system.

Note that the main purpose of this page is not to stop and start systems but services, hence the name. The services listed will depend on the system configuration. For HANA express, we only see the core services daemon and nameserver and the supporting services preprocessor, webdispatcher and compileserver.

With Stop Service you can stop individual services like except for the daemon service: read on to understand why.

With Stop System in the header of the page you can stop the entire SAP HANA system including all tenant databases, so make sure that the access to this page is restricted to only your most responsible system administrators.

When the system is stopped you use the same button, now named Start System, to start up the entire SAP HANA system.

Note that there is no restart option, so you have to wait for the system to be stopped before you can restart it again.

Note also that there are no shutdown options, read on to see what other flavors we have.

How you can stop and start individual tenant databases using the SAP HANA cockpit will be the topic of another blog.

For more information, see

SAP HANA Studio

Just like with cockpit, to stop a HANA system from HANA studio you need to be connected to the system database. From the Configuration and Monitoring menu, you can then select Stop System… or Restart System… when the system is up and Start System… when the system is down. The dots… indicate, I think, that we will have to wait a bit.

A very limited number of configuration changes actually require a restart so it may come as a bit of a surprise that the start/stop options are under this sub-menu. However, as SAP HANA studio is considered to be a bit of a legacy tool – no new functionality has been added since SAP HANA 1.0 SPS 12 (May 2016) – I guess we will have to live with this.

When selecting stop or restart in HANA studio, you are prompted to specify the shutdown type:

  • Soft
  • Hard

I know what you are thinking but this is not about boiling eggs. Instead, soft and hard control how the system should be stopped and what to do with current transactions:

  • Allowing current transactions to finish their work within a defined time frame or
  • Cancel any open transaction and roll back changes

A timed shutdown is typically used in production systems where data loss is to be avoided at all cost.

For more information, see

Host OS Credentials for SAP Control / SAP Start Service Logon

Starting and stopping an SAP HANA system requires specific privileges, obviously. As with other databases, operating system privileges are required to start up a system (instance) as there is no database yet to perform authentication and authorization.

For SAP HANA systems, the startup is performed by a process/executable called SAPControl or, as a service, by the SAP Start Service process. We will discuss both below.

In both cases, you will need to provide the operating system administration account credentials, i.e. the software owner and installation user on the Linux OS: <sid>adm (or another account with sufficient privileges).

In HANA cockpit, you can do this in the “host OS credentials for SAP Control” dialog in the Resource Directory. 

In HANA studio, you can do this in the SAP Start Service Logon section of the connection properties.

For more information, see

Tutorial Video

URL: https://www.youtube.com/watch?v=qBNUaZe7dQg

 

2. SAP HANA cockpit for offline administration

Unlike studio and cockpit, the SAP HANA cockpit for offline administration is included with each and every SAP HANA installation, including SAP HANA, express edition on GCP. So, that’s the good news. The not-so-good-news is that this tool, like studio, will likely no longer be included with SAP HANA in the near-future. Shall we say, enjoy while it lasts?

The web interface of the offline cockpit is presented to us by the SAP host agent, also included with every SAP HANA installation. The TCP ports used by the SAP host agent are 1128 for HTTP and 1129 for HTTPS. These ports are fixed and cannot be changed; in fact, they have even been registered with the Internet Assigned Numbers Authority (IANA).

You need to provide the exact URL including the name of the index.html file at the end – usually assumed – and include the system identifier (HXE, for the express edition).

You will be prompted to connect with an operating system administration account directly although this is not specified: you will be presented with a generic username/password dialog from the browser. To avoid username and password being sent over the network unencrypted, you may want to prefer to use HTTPS on port 1129.

If you have not replaced the self-signed certificate that comes with the SAP HANA installation, the browser will report correctly that the connection is Not Secure. For production systems always replace the certificate with a properly signed one.

The offline cockpit contains three tiles (plus a link to the documentation):

  • Start, Restart, Stop (System Operations)
  • Diagnosis Files
  • Troubleshoot Unresponse System

As it happens, all tiles will use SAPControl to provide this functionality, as we will see below in the SAPControl section.

The toolbar below on the System Operations page contains the Start System, Stop System, and Restart System buttons.

The offline cockpit also prompts us to select the shutdown type, now called (more empathetically):

  • Softly (with time out selector)
  • Immediately

For more information, see

Tutorial Video

Demonstrating the SAP HANA cockpit for offline administration, including how you can add the firewall rules for 1129 (1128 not recommended) for SAP HANA, express edition SPS 01 and earlier. The latest SPS 02 release, includes firewall rules for both ports but you might want to delete the rule for port 1128 as discussed.

URL: https://www.youtube.com/watch?v=FKoteekxSfc

 

3. HDB

HDB is a shell script that acts as a wrapper for the most important system administration commands you can execute when connected with a terminal (secure shell) to the HANA server.

Start, stop and restart all use the SAPControl command and this will be discussed in the section below. The other HDB options will be the topic of another blog.

HDB is not extensively documented. There is one reference about how you can use HDB and one note when not to use it.

Tutorial Video

The tutorial video about HDB demonstrates (almost) the full gamut:

  • HDB info (and proc)
  • HDB restart, stop, and start
  • HDB version
  • HDB admin

URL: https://www.youtube.com/watch?v=2bYgIYT3QrU

SAPControl

You can use SAPControl to start or stop any SAP system from the command line and this includes SAP HANA. The version currently installed on the latest SAP HANA systems is 749 (changelist 1,754,007) which may be a good indication of the seniority of this utility. It has been around for ages.

There are a little over 50 actions that SAPControl can perform, called functions or webmethods, as they have been implemented to use HTTP(S). This web implementation, of course, made SAPControl perfect for reuse in tools such as cockpit and studio. Hence the reason you need to provide operating system credentials so cockpit (or studio) can make the appropriate SAPControl web method call as authenticated and authorized user.

Most SAPControl functions only apply to SAP Netweaver AS ABAP/Java and you may find reading the help output to be a bit overwhelming. We will focus here on the functions that have been implemented for SAP HANA to start and stop an instance (and check the status).

  • Start
  • RestartInstance
  • Stop [softttimeout sec]
  • Shutdown
  • GetProcessList

To use sapcontrol you need to specify two parameters: the instance number and the function (case-sensitive) you wish to execute.

To start HANA, you can enter

sapcontrol -nr 90 -function Start

SAP HANA, express edition on GCP is installed with instance number 90. If you perform your own installation, use the instance number for your system.

To stop HANA, you can choose between a direct shutdown or a stop with a timeout. Note that this is the same choice you can make when using studio or the offline cockpit (hard/immediately, soft/softly).

sapcontrol -nr 90 -function Shutdown
sapcontrol -nr 90 -function Stop 400

Function Stop 400 is the command that gets executed with an ‘HDB stop’ plus an additional function WaitforStopped 600 (10 minutes) to allow HANA to stop gracefully. Function stop would return the prompt immediately, whereas with WaitforStopped the prompt is kept for the duration of the wait. This way, you can avoid that other actions, like a system reboot, for example, are called while HANA is still busy shutting down.

To view the current status of the SAP HANA system, you can use

sapcontrol -nr 90 -function GetProcessList

 

As you can see, this is the exact same web method call that gets executed by the cockpit for offline administration and HANA studio to populate the table view (the offline cockpit does a slightly better job in formatting the output).

Much more sophisticated, SAP HANA cockpit 2.0 adds some intelligence to the web method call by filtering out tenant processes (-SP2 in studio/offline output), the HDB prefix, and adding TCP port and resource usage statistics.

The functions Start, Stop and GetProcessList are documented in the server installation guide:

Tutorial Video

The Start and Stop with SAPControl video shows the different function calls in action, including a bonus track that shows what function to calls to list the diagnostic log files.

URL: https://www.youtube.com/watch?v=uJF-zwUcJUE

SAPInit and SAPServices

SAPInit initializes the SAP environment on a computer/server/host and is common to all SAP systems, including SAP HANA. On Linux, it is started by the Services Manager (systemd) – similar, in concept, to Services in Control Panel of a Microsoft Windows computer. With Services Manager you can configure a service for an automatic startup [Enable/Disable] and also start or stop a service.

With Services Manager you can configure a service for an automatic startup [Enable/Disable] and also start or stop a service.

Schematically, the process looks like this: with services manager (init.d / systemd) calling sapinit, starting sapstartsrv, starting sapstart, starting hdbdaemon, starting HDB processes.

In a process tree, it looks like this (the output is similar to HDB info without the CPU and memory statistics).

When you stop the computer/VM with a power off, sapinit will simply stop the sapstart process (with process ID 2030 in the list above) which, as the parent of all the other HDB processes, will stop and clean up its child processes (that’s a kill -2, for cognoscenti). This is not exactly the same as a sapcontrol -function Stop 400 or even a –function Shutdown.

For this reason, if you rather be safe than sorry, it is always best to first stop the SAP HANA system (using offline cockpit, studio, HDB/sapcontrol) before stopping the Linux operating system.

We will explore SAPInit some more in a dedicated blog on the topic but this is how it works in a nutshell.

Tutorial Video

The Start and Stop with sapinit video shows the SAPInit/SAPServices configuration and how automatic startup of an SAP HANA system is configured. It also shows live footage about what happens to your HANA system when you click the Stop VM button in the Google Cloud Console (not for the faint of heart).

URL: https://www.youtube.com/watch?v=2-YhWKthtzk

 

References

For more information, see:

SAP HANA Academy Videos

SAP HANA Academy Blogs

SAP Documentation

 

Thank you for watching

The SAP HANA Academy provides technical enablement, implementation and adoption support for customers and partners with 1000’s of free tutorial videos.

For the full library, see SAP HANA Academy Library – by the SAP HANA Academy

For the full list of blogs, see Blog Posts – by the SAP HANA Academy

 

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply