Is there a way of finding the name of the server an Oracle database is hosted on from PL/SQL?
Technically, as multiple servers can mount an Oracle database, `select host_name from gv$instance` would return all hosts. The query above does show the host you're currently connected to in that session, however.
Adam Musch
2010-03-03 03:16:36
+6
A:
If you don't have access to the v$ views (as suggested by Quassnoi) there are two alternatives
select utl_inaddr.get_host_name from dual
and
select sys_context('USERENV','SERVER_HOST') from dual
Personally I'd tend towards the last as it doesn't require any grants/privileges which makes it easier from stored procedures.
Gary
2010-03-03 00:46:52