Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Query host name in SQL

Duncan GardnerAug 2 2016 — edited Aug 2 2016

Just in case someone finds this useful. Please expand/correct

This will give you the host name of the database/instance you are connected to (which may be a remote server)

select host_name from v$instance;

This will give you the local host name, irrespective of the database/instance you are connected to

select SYS_CONTEXT('USERENV', 'HOST') host_name from dual;

(Oracle 11g, probably earlier)

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 30 2016
Added on Aug 2 2016
3 comments
10,184 views