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, and we also explored the command line options of the HDB script.
In this video, we will focus on sapcontrol.
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.
I am connected with SSH and done the substitute user to hxeadm.
We have done this now a couple of times, so I will move a bit faster.
OK.
We have observed that both the SAP HANA cockpit, HANA studio and the HDB command line script
file actually call the s-a-p-control command, or sapcontrol, if you prefer.
Now, it is a bit of a contradiction.
You probably will not use sapcontrol that much, directly.
However, as all the other tools use sapcontrol to interact with HANA
it helps to know a bit about how it works.
If anything goes wrong and cockpit or studio complain about sapcontrol this-or-that,
then you are at least a bit prepared and know where to start looking.
Because we don’t use sapcontrol that much directly,
it is hardly documented in the SAP HANA documentation set.
However, I will point out a couple of references.
Also, it is called sapcontrol and not hana-, or hdb-, or even newdbcontrol, for a reason.
It hasn’t got all that much to do with HANA, to be frank.
It is much older and is included with each and every SAP Netweaver application server.
In fact, on each SAP HANA system, there will be a sapcontrol amongst the HANA binaries
and another one as part of the SAP host agent, that is also installed with HANA.
SAP Basis administrators will recognize what follows.
So, how does this sapcontrol command work?
We can just enter it on the command line without any parameter.
Yes, that’s quite comprehensive.
Includes options for SAP Netweaver Java (J2EE) and the ABAP application server.
As mentioned, it has been around for ages: version 749, currently.
Control and monitor SAP instances via WebService interface of SAP Start Service.
and with SAP instances, sapcontrol is referring to Netweaver here and not necessarily HANA.
It is important to make this distinction as there are many parameters and ways you would
normally use sapcontrol that don’t work for HANA.
You can use sapcontrol, for example, as a snap-in for the Microsoft Management Console
(MMC) on Windows.
Well, this is not going to work for HANA.
The HANA server only runs on Linux.
Also, when we look at the end of the, let’s call it the help screen, we can read that
the actual sapcontrol web service interface can be queried: host port 5 instance number
- I assume you would have guessed by now that the double x’s here refer to the instance number -
and then 14 for HTTPS, 13 for regular HTTP /?wsdl
If we enter the URL in a browser, we get the entire interface
and if we just q uery the root, it actually redirects to the sapmc (management console) page
with the proper SID, instance number and host
but returns a 404 (page not found) as it has not been implemented.
There is nothing wrong with your server.
This sapcontrol functionality is just not available for SAP HANA.
So, what is working?
Let’s scroll up again.
Synopsis.
Two parameters are required: instance number and function.
The rest is optional.
Instance number is instance number, so let's focus on the function.
If you allow me to side-step one more time, when we create a connection in HANA studio,
we need to provide host name and instance number.
That’s all.
No SID.
This is because studio will use sapcontrol to establish the connection and that’s all that’s needed.
What functions do we have?
They are called webmethods here.
Maybe as a reminder, sapcontrol uses HTTP or HTTPS.
NI stands for network interface.
We can see that here.
Well, we have Start, of course (you can ignore the runlevel)
So we can enter: sapcontrol -nr 90 -function Start
Start OK Same output as for the HDB command.
Note that the function is case sensitive.
It is an HTTP call after all.
So start (all lowercase) will give you an error.
HANA is already started, so how can we can do the equivalent of an HDB info?
Well, you might have guessed, that’s this one: GetProcessList
sapcontrol -nr 90 -function GetProcessList
You might recognize the output.
It is exactly the same as in studio or the offline cockpit.
The dispatcher status column provides the coloured dots: green, yellow, grey.
Also interesting is the GetSystemInstanceList
Now, in our case, we only have a single instance for the SAP HANA express edition HXE system,
but you could very well run HANA as a distributed system,
so with multiple hosts, multiple servers, if you prefer, together forming one system;
same concept as a cluster for some other databases out there.
We find this documented here, in the Administration Guide, you actually have to call sapcontrol
to start or stop an entire distributed system with function StartSystem SID.
The HDB script only starts and stops the local instance, the one you happen to be connected to.
So, you really need to run sapcontrol on the command line yourself if you want to administer
the entire 10-, 15-, 20-node distributed system.
Bit of an advanced topic, but so you know.
Same for the checklist for secure handover.
You may recall that when we first connected to SAP HANA express edition, we had to reset
the SSFS master keys.
Well, guess what, function UpdateSystemPKI and UpdateInstancePSE will do that for you.
It is really a bit of a Swiss army knife: sapcontrol.
Secure handover is documented in the SAP HANA Security Checklists and Recommendations guide.
Sapcontrol is also used for troubleshooting.
You may recall that both cockpit 2.0, the offline cockpit, and studio could access log
and trace files when HANA was stopped.
No surprise, sapcontrol is used for this.
Function GetTraceFile will get you the sapstartsrvlog.
Function ListLogFiles will get you all the instance log files
and you can use function ReadLogFile with the log file name to display the file.
That’s how studio and cockpit use it.
There is no magic here.
Well, as I’ve said, there are very few references for sapcontrol in the SAP HANA documentation set.
GetProcessList, however, is mentioned in the SAP HANA Server Installation and Update Guide.
Here, the functions Start and Stop are also documented.
So, let’s give that a try.
Note that StopService stops the sapcontrol program, so if we run StopService and then
GetProcessList, we get a FAIL.
We can still do HDB info, as this just runs a ps command, remember?
So HANA is still up, just the sapstartserver process has been stopped.
No harm done, you can start it again using StartService SID, so HXE, in our case.
Note we get the same ‘Impromptu CCC message’ we can ignore.
Takes a second or less, and now we can run GetProcessList again.
To stop, we have Shutdown and Stop with soft timeout.
This is the same as the stop screen of studio, for example.
Here we can see this: Soft and Hard.
Again, as I am the only user connected and there is no currently no transaction ongoing
with any valid business data (just internal housekeeping, probably) I will go for Shutdown.
GetProcessList gets me the status: Yellow, stopping.
and if we switch to studio quickly, we see the same information.
That makes sense, because, as mentioned, it comes from the same source.
Studio is calling sapcontrol function GetProcessList the same as we do.
Eventually, all processes are stopped and we only see the daemon listed.
Then, with function Start, we can bring our HANA express instance up again.
OK.
So much, for starting and stopping SAP HANA on the command line using sapcontrol.
Again, you probably will not use it that much directly, but it helps to understand that
the command exists and that is used by all the other tools to stop and start HANA.
In the next video, we will wrap up our discussion of starting and stopping HANA
and take a look at the Google Cloud Console.
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.