cancel
Showing results for 
Search instead for 
Did you mean: 

How to Query a tenant Database in SAP HANA, it works with ./saphostctrl but now with hdbsql query ?

0 Kudos

Hello All,

When I try to run from saphostctrl it shows me the list of Databases but not from hdbsql query, Example is below :- Can you suggest me what am I doing wrong here ?

vhcalhdbdb:/usr/sap/hostctrl/exe #./saphostctrl -function ListDatabases

Instance name: HDB02, Hostname: vhcalhdbdb, Vendor: HDB, Type: hdb, Release: 2.00.036.00.1547699771

Database name: SYSTEMDB@HDB, Status: Warning

Component name: sapstartsrv (HDB sapstartsrv), Status: Running (Running)

Component name: hdbdaemon (HDB Daemon), Status: Running (Running)

Component name: hdbcompileserver (HDB Compileserver), Status: Running (Running)

Component name: hdbdiserver (HDB Deployment Infrastructure Server-HDB), Status: Running (Running)

Component name: hdbdocstore (HDB DocStore-HDB), Status: Running (Running)

Component name: hdbdpserver (HDB DPserver-HDB), Status: Running (Running)

Component name: hdbindexserver (HDB Indexserver-HDB), Status: Running (Running)

Component name: hdbnameserver (HDB Nameserver), Status: Running (Running)

Component name: hdbpreprocessor (HDB Preprocessor), Status: Running (Running)

Component name: hdbscriptserver (HDB Scriptserver-HDB), Status: Running (Running)

Component name: hdbwebdispatcher (HDB Web Dispatcher), Status: Running (Running)

Component name: hdbxsengine (HDB XSEngine-HDB), Status: Running (Running)

Component name: hdbMDC (HDB Multi Database Container), Status: Running (System DB)

Component name: hdbconnectivity (HDB Connectivity), Status: Error (SQLconnect not possible (no hdbuserstore entry found))

Component name: hdbalertmanager (HDB Alertmanager), Status: Unknown (no information available)

Component name: hdbstatisticsserver (HDB embedded Statisticsserver), Status: Unknown (no information available)

Database name: HDB@HDB, Status: Warning

Component name: sapstartsrv (HDB sapstartsrv), Status: Running (Running)

Component name: hdbdaemon (HDB Daemon), Status: Running (Running)

Component name: hdbcompileserver (HDB Compileserver), Status: Running (Running)

Component name: hdbdiserver (HDB Deployment Infrastructure Server-HDB), Status: Running (Running)

Component name: hdbdocstore (HDB DocStore-HDB), Status: Running (Running)

Component name: hdbdpserver (HDB DPserver-HDB), Status: Running (Running)

Component name: hdbindexserver (HDB Indexserver-HDB), Status: Running (Running)

Component name: hdbnameserver (HDB Nameserver), Status: Running (Running)

Component name: hdbpreprocessor (HDB Preprocessor), Status: Running (Running)

Component name: hdbscriptserver (HDB Scriptserver-HDB), Status: Running (Running)

Component name: hdbwebdispatcher (HDB Web Dispatcher), Status: Running (Running)

Component name: hdbxsengine (HDB XSEngine-HDB), Status: Running (Running)

Component name: hdbMDC (HDB Multi Database Container), Status: Running (Tenant DB)

Component name: hdbconnectivity (HDB Connectivity), Status: Error (SQLconnect not possible (no hdbuserstore entry found))

Component name: hdbalertmanager (HDB Alertmanager), Status: Unknown (no information available)

Component name: hdbstatisticsserver (HDB embedded Statisticsserver), Status: Unknown (no information available)

vhcalhdbdb:HDB:hdbadm /usr/sap/HDB/HDB02 53> hdbsql -i 02 -u SYSTEM -p Final_123

Welcome to the SAP HANA Database interactive terminal.

Type: \h for help with commands

\q to quit

hdbsql HDB=> select * from "SYS"."M_DATABASES"

1 row selected (overall time 17.484067 sec; server time 331 usec)

hdbsql HDB=>

hdbsql HDB=> select * from "SYS"."M_DATABASE"

1 row selected (overall time 18.216544 sec; server time 345 usec)

Output is :-

DATABASE_NAME,DESCRIPTION,ACTIVE_STATUS,ACTIVE_STATUS_DETAILS,OS_USER,OS_GROUP,RESTART_MODE,FALLBACK_SNAPSHOT_CREATE_TIME

"HDB","HDB-02","YES","","","","DEFAULT",?

lines 1-2/2 (END)

Accepted Solutions (1)

Accepted Solutions (1)

tom_slee
Product and Topic Expert
Product and Topic Expert
0 Kudos

Your hdbsql command is "hdbsql -i 02 -u SYSTEM -p Final_123", which will connect you to the SYSTEMDB on the HANA instance.

To connect to the tenant HDB, you should use "hdbsql -i 02 -d HDB -u <username> -p <pwd>" where the username and password are for a user on the tenant database.

0 Kudos

Thank you for that.

Answers (0)