cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to list Hana tenant databases in a query?

Former Member
78,816

Hi everyone,

I have recently started to learn Hana database and I need a query to list all tenant databases when I am connected to the database server using SYSTEM user.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor

You can determine the information from system view M_DATABASES.

Regards,
Florian

0 Likes

Does this still work? Within the last week, this stopped returning all of the databases for me and started only returning NDB.

Answers (4)

Answers (4)

Former Member

Use this query,

select * from "SYS"."M_DATABASES"

christoph_ostrop
Active Contributor
0 Likes

it depends on where you are executing that SQL:

================================================

open SQL-console in a tenantDB => there is no difference between SQL

select * from M_DATABASES

and SQL

select * from "SYS"."M_DATABASES"

both SQL gives back as result-list: 1 entry = the tenantDB

=================================================

open SQL-console in a systemDB => there is no difference between SQL

select * from M_DATABASES

and SQL

select * from "SYS"."M_DATABASES"

both SQL gives back as result-list: 2 entries = the tenantDB + the systemDB

=================================================

0 Likes

Right-click on backups and click backup tenant database, it will show all available databases.

phamthomas
Discoverer
0 Likes

One query can give you both SDB and Tenant info:

 

select * from "SYS_DATABASES"."M_SERVICES"