Is there a way of finding the name of the server an Oracle database is hosted on?
You can use sys_context('USERENV', 'SERVICE_NAME') to get the database service name instead of the machine name.
Answer: You can retrieve the instance name and database name using the sys_context function.
The Oracle Parallel Server: Multiple Instance Systems In appropriate applications, the Oracle Parallel Server allows access to a single database by the users on multiple machines with increased performance.
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.
SELECT host_name FROM v$instance
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With