Choose an SAP HANA Database
- How to create an instance of SAP HANA Cloud or SAP HANA, express edition
- How to connect to a SAP HANA Cloud or an SAP HANA, express edition database
Prerequisites
- A Microsoft Windows, Linux, or Mac computer
- A machine that can run SAP HANA, express edition if the SAP HANA Cloud trial or free tier is not used
This tutorial will provide tips and pointers on setting up an instance of SAP HANA running in the cloud or on-premise so that it can then be connected to using a few of the SAP HANA Client interfaces.
For more information on SAP HANA, consult What Is SAP HANA.
Access help from the SAP community or provide feedback on this tutorial by navigating to the Feedback link located on the top right of this page.
For connections from additional sources such as SAP Analytics Cloud,
Jupyter
Notebooks, SAP Business Warehouse, SAP Data Intelligence Cloud, and SAP ERP Central Component see Connection Guides for SAP HANA Cloud.For connections to the SAP HANA Cloud, Data Lake, see the tutorial Use Clients to Query Data Lake Relational Engine.
IMPORTANT: Complete the first 3 tutorials, and then you can select any of the following tutorials about connecting with different client interfaces.
- Step 1
There are multiple versions of SAP HANA. The information below is a list of links for the documentation of each version.
Version Notes SAP HANA Platform 2.0 Released in November 2016. Current version is 2.0 SPS 08, which was released on Nov 20th, 2024. SAP HANA, express edition Released in September 2016. Current version is 2.0 SPS 07. SAP HANA Cloud Released in March 2020. New features are released quarterly. - Step 2
Here are a few benefits of using SAP HANA Cloud:
-
Software updates are automatically applied by SAP.
-
Hardware is managed by a cloud provider (e.g. AWS, Azure, or GCP).
-
Many data center locations to choose from as listed in the SAP Discovery Center
-
Backups are automatic and recovery can be initiated in SAP HANA Cloud Central.
-
The memory, compute and storage settings can be changed as your needs change. Note a few operations can be performed using service requests.
-
The ability is provided to expand data storage from in-memory, to native storage extensions, to a data lake, while providing a common access layer that enables you to have further control over performance and cost. See also Lower Your Data Management Costs With SAP HANA Cloud.
Here are a few differences between SAP HANA Cloud and an on-premise version:
-
Every SAP HANA Cloud instance is one SAP HANA database. An on-premise version can have multiple databases per install, which is known as multi-tenant.
-
Connections to an SAP HANA Cloud instance must be secure and require a minimum SAP HANA client version of 2.4.167.
-
The administration user for SAP HANA Cloud is named DBADMIN while for an SAP HANA 2.0 database it is SYSTEM. For additional details see Predefined Users, SAP HANA Cloud Administrator DBADMIN, and Predefined Users in HANA 2.0.
Information on the instance size steps for SAP HANA Cloud, SAP HANA databases can be found at Create an SAP HANA Database Instance Using SAP HANA Cloud Central. Service plan, pricing and data center availability can be found at SAP HANA Cloud Service (SAP Discovery Center). Details on limitations can be found at System Limitations. Compatibility information can be found at Compatibility with Other SAP HANA Versions. Additional details can be found at What is SAP HANA?.
-
- Step 3
To complete the tutorials in the mission, an SAP HANA instance is needed. Step 3 and 5 in this tutorial provide two different, free options that can be used to set up an SAP HANA instance. Only one of these steps needs to be completed if you currently do not have access to an SAP HANA instance.
The instructions on how to setup a free SAP HANA Cloud trial or free tier within the SAP Business Technology Platform (SAP BTP), are well covered in a number of other sources listed below. Trial is only available on the US10 landscape and is in a separate SAP BTP trial account whereas free tier is available in multiple production SAP BTP accounts and provides a seamless transition from a free tier to a paid plan.
-
Set Up Your SAP HANA Cloud, SAP HANA Database (free tier or trial) and Understand the Basics
-
SAP Learning Journey - Provisioning and Administering Databases in SAP HANA Cloud
-
SAP Discovery Center - SAP HANA Cloud, SAP HANA Database Fundamentals
For more information on SAP BTP see the following product pages and help documentation:
-
https://www.sap.com/products/business-technology-platform.html
-
https://developers.sap.com/topics/business-technology-platform.html
Continue with this tutorial once you have created an SAP HANA Cloud trial or free tier instance as shown below.
-
Once the SAP HANA Cloud instance is created, take note of the SQL endpoint (host:port) needed to connect to the database. The endpoint can be obtained via the copy menu item. This will be needed in subsequent tutorials in the mission.
The SAP HANA Cloud, HANA database free tier or trial instances are shut down on a nightly basis and will need to be restarted before working with them the next day.
-
Open a SQL console for your database instance from SAP HANA Cloud Central.
If needed, you will be asked to enter the credentials for the database. Enter DBADMIN and the password that was specified when the instance was created.
The SAP HANA database explorer provides the ability to browse catalog objects and execute SQL statements from the SQL console. For more information, see the tutorial group Get Started with the SAP HANA Database Explorer, SQL Console and SAP HANA Database Explorer.
-
Run the following query to see the name of the database you are currently connected to.
SQLCopySELECT * FROM M_DATABASE;
-
A schema is a container for other database objects such as tables and views and the current schema can be seen via SQL as shown below. The DUMMY table is available in every HANA database that has one column and one row. It provides a convenient way to call a function or perform a simple test.
SQLCopySELECT CURRENT_USER, CURRENT_SCHEMA FROM DUMMY;
-
To see the list of services, enter the following SQL statement:
SQLCopySELECT * FROM M_SERVICES;
-
To see information about the database server, enter the following SQL statement:
SQLCopySELECT * FROM M_HOST_INFORMATION;
Views starting with
M_
are examples of monitoring views and contain statistics and status details.Congratulations! You have connected to SAP HANA Cloud and performed a few queries.
-
- Step 4
This step only needs to be completed if you currently do not have access to an SAP HANA Instance and did not setup an SAP HANA instance through the SAP HANA Cloud Trial or free tier as explained in step 3.
SAP provides a free streamlined version of SAP HANA that runs on developer laptops called SAP HANA, express edition.
SAP HANA runs on a few versions of Linux. SAP HANA, express edition provides a binary install as well as virtual machine images that can be run on Microsoft Windows, macOS and Linux machines. This is described in the Getting Started with SAP HANA 2.0, express edition (Binary Installer Method) or Getting Started with SAP HANA 2.0, express edition (Virtual Machine Method). A database-only option and a database + XS Advanced Applications option are available. The database + XS Advanced Applications install includes the SAP HANA cockpit, the SAP HANA database explorer, and the SAP HANA Web IDE for SAP HANA.
Further details can be found in the release notes.
Choose an option and proceed to install SAP HANA, express edition. The server-only install, which requires less memory, is sufficient to complete the tutorials in the mission. Be sure to note the SAP HANA database master password, as it will be needed later for connecting.
At this point, you should have a running instance of SAP HANA, express edition.
- Step 5
This step only needs to be completed if you currently do not have access to an SAP HANA Instance and did not setup an SAP HANA instance through the SAP HANA Cloud Trial or free tier as explained in step 3.
A default installation will contain one system database named SYSTEMDB and one tenant database named HXE.
The system database contains information about the tenant database(s) and is used for overall administration. The default port for the system database is 39013. Later in this tutorial mission, a connection to the tenant database will be made and tables will be created and populated with data. For more information, see SAP HANA Tenant Databases Operations Guide.
The SAP HANA, express edition VM install includes a command line tool (part of the SAP HANA client install) called HDBSQL that can be used to query the database.
The following steps will demonstrate connecting to and examining a SAP HANA, express edition database.
-
Enter the following to connect to the system database:
ShellCopyhdbsql -n localhost:39013 -u SYSTEM -p Your_Password
Notice that the database being connected to is SYSTEMDB.
The example above uses localhost since hdbsql is running on the same machine that the database is trying to connect to. The host name,
hxehost
, is seen in the terminal above.If hdbsql is not found and you are logged in with another user, try connecting as the user
hxeadm
and run the command again.ShellCopysu hxeadm
If the hdbsql command cannot be found, simply read through the following examples. The installation and further examples of running HDBSQL will be covered in subsequent tutorials.
-
Determine the IP address of the machine that is running SAP HANA, express edition. Record the value as it will be needed in later tutorials in the mission. It is important to note the IP address or host name of the machine, as this will be needed in later tutorials.
ShellCopyip addr
-
The following are a some examples of interactive options followed by a SQL query, which when run against SYSTEMDB returns information about the databases running on the SAP HANA instance.
SQLCopy\al on \pa off \s SELECT * FROM SYS_DATABASES.M_SERVICES WHERE SQL_PORT != 0; \serverstats
The
\al
or align interactive option when enabled increases the readability of the output.The
\s
command shows status information. It shows that that the SAP System Identification (SID) is HXE, that the connected database is SYSTEMDB, and the currently logged in user is SYSTEM.The result of the SELECT against the
M_SERVICES
table shows that there are two databases, named SYSTEMDB and HXE and that they are accessible on ports 39013 and 39015.The ‘\serverstats’ retrieves resource consumption information about the last executed SQL statement which can be helpful when diagnosing SQL statements.
The instance number can be derived from a port number using the second and third numbers in the port number 39013. In this case, the instance number is 90.
If the SQL statement returns more than one screen of text, entering a space will show the next screen of results. See also the pager option
\pa
. -
Enter one of the below commands to exit from viewing the results of the select statement. Note that commands can be prefixed with a forward slash(\) or a colon(:).
HDBSQLCopy\q :q
-
Connect using the instance number and database name as shown below.
ShellCopyhdbsql -n localhost -i 90 -d HXE -u SYSTEM -p Your_Password
-
Enter the following to display database connection information.
HDBSQLCopy\s
Notice that this time the database connected to is HXE.
For further information, see Port Assignment in Tenant Databases and Connecting to SAP HANA Databases and Servers.
-
- Step 6
Congratulations! You now have access to an SAP HANA instance and understand some of the differences between SAP HANA Cloud and SAP HANA, express edition.
Which of the following statements are true? You can select more than one answer.