Create A Tenant Database

25 July 2017 - 3897 views
This article describes how to create a tenant database in HANA DB. To create a tenant database, first login to SystemDB using the SYSTEM user either by using hdbsql or HANA Studio. Execute the following SQL statement to create the database DB1.

Listing 1

CREATE DATABASE DB1 SYSTEM USER PASSWORD "your password"

The above create statement will create a new database using the SYSTEM user. Once the database has been created, you can verify its status by executing the following SQL.

Listing 2

SELECT * FROM SYS.M_DATABASES

Take note of the ACTIVE_STATUS field, if the value for this field is NO, it means the database is not running and must be started. To the start the database, execute the following SQL statement.

Listing 3

ALTER SYSTEM START DATABASE DB1

You can now connect to the database using hdbsql or HANA Studio. For hdbsql, use the following command parameters.

hdbsql=> \c -n hostname:39013 -u SYSTEM -p password -d DB1
In HANA Studio, you will need to add a New System, select the Multiple containers mode and specify the tenant database name.