Hello and welcome to the SAP HANA Academy.
The topic of this video tutorial series is Getting Started with SAP HANA on the Google Cloud Platform
and in the next couple of videos we will take a look at how to start and stop an SAP HANA system.
In the previous videos, we have seen how you can stop and start HANA
using graphical tools like HANA cockpit and HANA studio.
In this video, we will take a look at the command line options.
Hi, I am Denys van Kempen.
I am connected here to the Google Cloud Platform Console
and have started the SAP HANA, express edition VM
we have created with Cloud Launcher in a previous video in this series.
Click SSH in the Connect column to open a secure shell to the server.
GCP will establish each time a secure connection using your own Google Cloud Platform account:
d.van.kempen for me.
When connected, we see the generic Welcome screen from SUSE Linux Enterprise Server.
First, we need to switch, or substitute, user to the operating system administration account for HANA:
hxeadm
We have set the password for this user when we first connected
- if you don’t remember, please review the video about secure configuration -
so now we can simply just enter su - hxeadm
Should, for whatever reason, you have forgotten or mistyped the password,
you can also first start an interactive session for the root user with the
sudo -i and then run the su command.
The superuser can do anything and access everything. Note that the prompt suddenly is red.
That’s to warn you.
Now we are connected as hxeadm, we can take a look at what’s probably the most important command
for starting and stopping: HDB.
Just enter it and you will get usage information; a bit of online help.
start, stop, restart - that should sound familiar by now,
same as in HANA cockpit or studio
version, info, proc, admin, kill.
Kill should never be used in productive environments.
For those less familiar with UNIX/Linux system administration, don’t be alerted,
with the kill command you can terminate an operating system process
in case it no longer responds or takes up 99% cpu
and risks to bring the whole system down.
As the word indicates, it is not very subtle
and particularly for an in-memory database with maybe 100s of transactions in progress,
a kill is not the most appropriate way to solve issues.
Let’s start with HDB info
The command will give us a process list, a tree even.
The processes should look familiar: nameserver, compileserver, indexserver
- we already talked about that -
and those with a bit experience in UNIX system administration
probably also recognize the ps command here.
In fact, we have our shell, bash, running the ‘HDB info’ command which
in turn runs the ps command with a number of flags.
If we run the same command, we get the same output.
The indentation, the process tree, is a bit crooked.
So, if we run this again, this time only with the user
- well, it is a bit superfluous, we are filtering with a minus uppercase on the user -
but fair enough, and options process id, parent process id (ppid), and the argument
(that’s the command or executable) and this looks better.
We can now walk the tree. We can see that a process with parent 1,
that’s root where everything starts, executed the SAP start service process with a certain profile,
pf, let’s say, a configuration parameter file.
You may remember that we had to configure HANA studio and cockpit for the user name
and password to make the connection to the SAP start service.
Well, here it is. SAP start service will trigger the sapstart process
using t he same profile with process id 2003 and parent 1.
The process numbers will be different each time, except for the root process 1.
Then, 2003 is the parent of 2011 and what looks like a bit of a curious process:
hdb.sapHXE_HDB90.
But if we list the process
- let’s make the screen a bit bigger -
we can see that it actually points to the daemon process.
HXE is the SID, 90 the instance number.
Implementation detail, does not concern us here, what’s important is to recognize
that this is the daemon process, the watch dog; the parent of all the other processes.
We can see that they all have 2011 as parent process.
The daemon will monitor the health of all the HANA processes and restart them if they are stopped.
If we briefly look at the previous output, %CPU shows the amount of processor time the process is using.
well, it is a snapshot, so at that particular point in time
VSZ stands for virtual memory size and RSS for resident set size; so, memory statistics.
We will discuss this some other time but we can easily see
that the nameserver and the indexserver are by far the largest processes.
Not surprisingly, the nameserver holds the system database and each indexserver a tenant database.
So, if you create two tenant databases, you have two indexserver processes.
Both name- and indexserver also have a statistics server embedded
and may also have an xsengine server inside, so they will always have a
much larger memory footprint than the other processes.
Let’s clear the screen.
HDB proc by the way gives the same output, more or less.
To restart our HANA system, we can use the HDB restart command.
Just returns that the daemon with process id 2011 is restarting. That’s it.
If we want to know a bit more what’s going on we can use the top command, for example.
Generic UNIX system administration tool, nothing to do with HANA,
and let’s continue filtering on the hxeadm user.
The header shows percentage CPU for the whole system, memory usage, and so on,
and below we have the process list again, this time in real-time, dynamic.
We recognise the daemon process, sapstart, sapstartserver: these will stay up.
All the hdb processes are then restarted.
First, we see the nameserver reappear, followed compileserver, indexserver -
both taking up a whole cpu core: 99, 98% -
and then eventually we get the rest: diserver, web dispatcher.
Typically, the indexserver will be busiest for most of the time.
Eventually everything is up and the system returns to an semi-idle state with hardly any CPU usage.
Semi-idle, of course, in our case, as nobody else is connected to the system.
You can use ctrl+c to exit the top command.
Let’s do a stop now: HDB stop.
‘hdbdaemon will wait maximal 300 seconds for NewDB services finishing.’
HDB, NewDB, HANA: on the command line anything goes.
NewDB, in fact, was one of the very early names when HANA was still more of research project.
Next came HDB, originally this stood for Hybrid DataBase: both row and column store
and HANA initially was HAsso’s New Architecture,
a name that former SAP CTO, Vishal Sikka, came up with to honour Hasso Plattner,
one of the driving forces behind the in-memory database.
Marketing later decided that the acronym actually stood for High-performance ANalytical Appliance
but as HANA is no longer just an appliance, probably by now everybody has forgotten about that one
and HANA is just HANA.
The command used to stop the instance is sapcontrol.
We might recognize the instance number: -nr 90 (9-0)
Function stop, and a second time, waitforstopped.
Hdbdaemon is stopped.
Let’s run ‘HDB info’ again.
Apart from the ps command, we only see the sapstartserver process. The rest is down.
So, let start HANA up again: HDB start
StartService. Bit of a curious message, this time:
Impromptu CCC initialisation by rscpCInit, see SAP Note 1266393
Well, if you actually would take a look at this note, you probably end up even more confused.
It is a note from 2009, when HANA was not even released yet.
Component BC-I18, Category Program Error.
Kernel is modified. This is all Netweaver stuff.
and note 2130426 explains this a bit better.
“Cause: Certain HANA executables use the RSCP library without proper initialization.”
“Resolution: This is only a warning message and does not affect the startup of the Database.
It can safely be ignored.”
So, ignore we will.
RSCP, by the way, stands for the Redundant Code Page Converter
it is used in SAP R/3, which is, in fact, where the sapcontrol command is coming from.
HDB info; yep, everything is up.
So, depending on the actual argument (parameter) we pass, HDB will actually run a different command.
Sounds more like a script, you might say. Well, that’s right.
If we take a look where HDB is located: which HDB
we can see that it is actually in the current directory
and if we take a look a what type of file it is: file HDB
we can see that it is indeed a shell script ASCII text executable.
Just a text file, so we can use the cat command, for example, to read it.
Let’s add pipe less [ cat | less ] so we can page through the file.
Note the header: HDB start/stop script, copyright 2002-2003.
Curious, first release of HANA was almost 10 years later.
In fact, what we are looking at is almost identical to the start/stop script for BWA,
the Business Warehouse Accelerator - so, that’s where this is coming from.
No need to reinvent the wheel.
If we page down a bit, here we see, for example, how the start command is constructed.
The executable is sapcontrol; instance number and function.
We will look at the sapcontrol command in the next video - it is the command that actually does the job.
Cockpit, studio, or our HDB script: all call sapcontrol to interact with HANA in the end.
q to quit.
HDB what else? HDB version.
Most of the output is for support and development; we have the hash of the GIT repository, for example.
Fascinating.
What’s relevant for the rest of us is the version number: 2.00.020.
This reads SAP HANA 2.0 SPS 02 (revision 20). SPS 01 would be 010.
In the script, you can look up the command: it is hdbsrvutil -v
Before we close, let’s briefly switch to a graphical environment.
There is one HDB command that actually starts a graphical tool.
Again, administrators of BWA will recognise it, although it has had a few updates.
There is support for tenant databases, for example.
Tool looks a bit like HANA studio Includes even a Start and Stop button.
We have seen the process list before.
This is just for your information, in case you wondered where the ‘HDB admin’ was for.
You won’t find HDB admin documented anywhere
and you need a graphical environment (X-Windows) on the HANA server to get it to work in the first place.
So we can just put it aside and stick with studio or preferably, the HANA cockpit for our administration.
OK. So much, for starting and stopping SAP HANA on the command line using HDB.
In the next video, we will take a look at the command that actually does the starting and stopping
of HANA systems on behalf of cockpit, studio and the HDB script file.
You can find more video tutorials on our YouTube channel.
If you would like to be informed about new video tutorials, please subscribe to our channel.
You can connect with us on LinkedIn or follow us on Twitter, as well for updates,
and we also have a page on Facebook and Google+.
If you are watching this video on YouTube, do not hesitate to leave your comments to the video page and,
if you like, give us your vote on his video.
Thank you for watching.