This blog provides the command to start and stop the SAP HANA Instance and also schedule to do the same in a timely manner. This blog aims to provide an approach on how one can automate the uptime of a SAP HANA Cloud instance which reduces operational costs. Scheduling the HANA Start/Stop sample shows how to reduce the manual effort & reliable execution by automation.
Open the Automation Pilot from your BTP subaccount.
Dashboard of Automation Pilot
Note : You can create a Catalog and clone the existing commands provided by Automation Pilot for easier access or skip to Step 2 to proceed with creating inputs and trigger the command directly.
Step 1: Lets set up the command and inputs in a catalog. Create a new catalog.
Create a new catalog
Once the catalog is created, we have to add the commands and inputs into it. You can already view some of the predefined commands that exists in the Automation Pilot by going to the commands section.
Search for "StartHanaCloudInstance" and choose the one below.
You can click on clone the "StartHanaCloudInstance"
Select the catalog that was created and add this cloned command into the StartStop Catalog.
Repeat the same steps to do the same for StopHanaCloudInstance command and add it to the StartStop Catalog.
Step 2: Now, create an input to store the connection details for an SAP HANA Cloud database.
Add the keys and assign the respective values to the keys.
Values that must be assigned are as follows:
Region - your region details ( eg: cf-eu10 )
subAccount - the name of your Cloud Foundry ORGANIZATION
resourceGroup - the name your Cloud Foundry CF SPACE
resourceName - the name of your HANA SERVICE INSTANCE
user - Your technical user's email address
password - Your technical user's password
Note : When storing a password. always turn on the sensitive option.
Note : For SAP Users, you can create a p-user(here). Also when using the p-user, add this user in Global account level, Subaccount level, add as Org members in Cloud Foundry level.
Step 3: In the newly created command clone, Go to 'StartHanaCloudInstanceClone' & select input and add an additional value which is the StartStopInputs input.
Assign the values below
Step 4: Now add an executor
Click on 'Here' & Add the below values,
Step 5: Now once you have the inputs and executor ready. Trigger the execution
Step 6: Select the StartStopInputs for Inputs and all the values will be automatically assigned to its respective fields. Click on trigger.
You can see the status and the progress of the execution of the command.
Step 7: Check the SAP HANA Cloud Central to see if the HANA cloud instance has been started.
Once the execution is finished successfully, you will see the below
Step 8: Perform the same steps to do the StopHANACloudInstance
Clone the existing command from the command list
Add the input keys
Add the executor called "StopHANA"
You can use the same inputs i.e. StartStopInputs
Once you click on the trigger, it will execute to stop the SAP HANA Cloud instance.
Check the SAP HANA Cloud central to see the status, it will be as shown in the below image.
You can also schedule the above commands to execute on a desired time period. Scheduling the execution can help to reduce the active running time of SAP HANA Cloud instances to the working hours of the developers. This can reduce the operational costs of running database.
Create a new schedule and provide the command details and user input details.
Schedule as per needed
You can now schedule the start and stop of SAP HANA Cloud instances as per needed and it will run the jobs accordingly.
Quick links : You can also follow the below tutorial to get more hands on with Automation Pilot. The below tutorial explains an approach to schedule SQL statements which are run against an SAP HANA Cloud database.