-1

How to find out Server name, Instance Name, DB name in DB2 via sql query.

I was found it via shell scripts. Need via sql scripts.

Jit Sarkar
  • 17
  • 3
  • 1
    The query varies according to the platform of the Db2-server (Z/OS, Linux/Unix/Windows/cloud, AS400/i-series, MVS/VSE). So what is your Db2-server platform, and what is your Db2-server version ? You should edit your question to add this basic essential information. – mao Jul 01 '22 at 14:58

1 Answers1

0

A Db2 for LUW instance may have multiple database partitions / members which may reside on different hosts.

SELECT 
  E.INST_NAME
, I.ID              AS MEMBER
, I.HOME_HOST       AS HOST
, CURRENT SERVER    AS DBNAME
FROM 
  TABLE (DB2_GET_INSTANCE_INFO (NULL, NULL, NULL, NULL, NULL)) I
, SYSIBMADM.ENV_INST_INFO E 
--WHERE I.ID = CURRENT MEMBER
;
Mark Barinstein
  • 11,456
  • 2
  • 8
  • 16