Getting the server IP Address from SQL*plus

Responsive image

Here’s a small script to get the IP address of the host server directly from the SQL*plus command line.

DECLARE
v_host_name v$instance.host_name%type;
v_ip_address varchar2(50);
BEGIN
SELECT host_name INTO v_host_name FROM v$instance;
dbms_output.put_line('the database server name is ' || v_host_name);

SELECT UTL_INADDR.GET_HOST_ADDRESS(v_host_name) INTO v_ip_address FROM DUAL;
dbms_output.put_line('the database server ip address is ' || v_ip_address);
end;
/

You can use this PL/SQL block in a script for example. Here’s an output of the script:

the database server name is ASERVERNAME
the database server ip address is 10.1.1.71
Written on November 20th, 2014 by Samy Gejzenblozen

Tags:


Social networks

You may also enjoy:

Convert FLAC to mp3 like a hacker

Convert FLAC to mp3 like a hacker

#system #linux

So you need to convert a bonch of FLAC files to mp3 and your best search engine only recommands you online file converters that nobody trusts ore require a paid subscription to work. Don't worry, *there's always a way*, and even better, a true ***hacker style*** way to achieve this! This procedure works for MacOS through Brew, but you should b... Read more

20 Feb 2019 - less than 1 minute read
SQL*Net more data from client

SQL*Net more data from client

#oracle #network

The error *SQL*Net more data from client* usually happens when there's a large amount of data sent from client (or other database in case of dblinks), which doesn't fit into single SDU size Oracle packet. The server process knows that the call hasn't ended and there is more data/packets to come before the call ends. Also, the *large amount of d... Read more

20 Aug 2015 - 1 minute read
Registering with the listener

Registering with the listener

#oracle #network

When restarting a database, if you can't acess it from outside, you may have to associate the newly restarted database with the listener. The Pmon process that is started with the instance is responsible for registration of oracle server with listener. Pmon process wakes up at every 60 seconds and provide information to the listener. If any pro... Read more

20 Jun 2015 - less than 1 minute read