This blog contains experience gained over the years of implementing (and de-implementing) large scale IT applications/software.

Forcefully Prevent HANA Tenant DB From Starting

Scenario: Your HANA system is having some serious memory problems.
In the memory you have remaining you can’t get the SYSTEM database to run, so you can’t stop a particular tenant database.

Here’s how you can use the hdbnsutil utility to prevent hdbdaemon from trying to start a tenant database.
As the <sid>adm user, kill off all remaining HANA system processes:

> hdbdaemon -quit

Export the topology:

> hdbnsutil -exportTopology /tmp/topology_export.txt

Edit the file and change the “status” of the tenant database to be “no”:

> vi /tmp/topology_export.txt

n3>name
v>HT1
n3>status
v>no
n3>timestamp

Save the file and quit vi.
Reload the topology using hdbnsutil:

> hdbnsutil -importTopology

Now restart hdbdaemon:

> hdbdaemon -start

Starting and Stopping Individual SAP AS Java Server Processes

Should you need to restart either manually or automatically (via script) a specific AS Java server node, it’s possible to use the sapcontrol tool to provide precise control.

The method detailed below is based on the documentation provided here:
Performs a given control function (EnableProcess/StartProcess, DisableProcess/StopProcess,
SoftStopProcess, ActivateProcess, DeactivateProcess, RestartProcess, SoftRestartProcess,
DumpStackTrace, EnableDebugging, DisableDebugging, IncrementTrace, DecrementTrace) on a given AS
Java process. processname must match a process name in the AS Java process list returned by
J2EEGetProcessList. To perform AS Java instance-wide operations (StartInstance, StopInstance,
RestartInstance, BootInstance, RebootInstance), use processname “all”.
Based on the above information, we can query the AS Java processes for a specific AS Java instance, using the following command line as the sidadm user:

sidadm> sapcontrol -host [host] -nr [sys##] -function J2EEGetProcessList
You should substitute the “host” and “sys##” with the host of your application server (virtual host) and the SAP instance number.
The command will return a list of the processes that the instance is running.
For a 2 node AS Java system, you can see the Server0 and Server1 processes in the list.
To restart Server0 on the AS Java instance use the below command line as the sidadm user:

sidadm> sapcontrol -host [host] -nr [sys##] -function J2EEControlProcess “server0” “RestartProcess”
You should substitute the “host” and “sys##” with the host of your application server (virtual host) and the SAP instance number.
Change “server0” for “server1” if you want to restart server1.
Based on the above restart, you can monitor the restart by using the below command line to see when the restart is completed:
sidadm> sapcontrol -host [host] -nr [sys##] -function J2EEGetProcessList | awk -F, ‘{ if ( $2 != “” && FNR > 5 ){ print “Name: “$2″ttState: “$8″ttStarted: “$9 }}’
You should substitute the “host” and “sys##” with the host of your application server (virtual host) and the SAP instance number.