想要获取ORACLE DB 的环境信息
常用如下: (参考 tnsnames.ora 中变量)
SELECT
SYS_CONTEXT('USERENV', 'SERVICE_NAME') SERVICE_NAME,
SYS_CONTEXT('USERENV', 'DB_NAME') DB_NAME,
SYS_CONTEXT('USERENV', 'INSTANCE_NAME') INSTANCE_NAME,
SYS_CONTEXT('USERENV', 'DB_UNIQUE_NAME') DB_UNIQUE_NAME,
SYS_CONTEXT('USERENV', 'SERVER_HOST') SERVER_HOST,
SYS_CONTEXT('USERENV', 'SERVER_NAME') SERVER_NAME
FROM DUAL;