cancel
Showing results for 
Search instead for 
Did you mean: 

How to list Hana tenant databases in a query?

Former Member

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 Kudos

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

Answers (3)

Answers (3)

Former Member

Use this query,

select * from "SYS"."M_DATABASES"

christoph_ostrop
Active Contributor
0 Kudos

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 Kudos

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