Hello Andrégouveia,
With this querie, you identify the IP of the server where the database is located:
Select all
SELECT UTL_INADDR.GET_HOST_ADDRESS(HOST_NAME), HOST_NAME FROM V$INSTANCE;
with this other querie , you identify the IP address of a SQL * Plus client session:
Select all
SELECT SYS_CONTEXT( 'USERENV', 'IP_ADDRESS' ) FROM DUAL;
This queries above will return null, if the session is not using TCP / IP on the connection.
You can also have an overview of all existing bank sessions:
Select all
SELECT SID,OSUSER,TERMINAL FROM V$SESSION;
Now, see. About this procedure that you say exist in the database: how is it exactly executed? Who executes it?
Let's say that this command is in your procedure:
If for example you open a sql * plus session on your machine and call The procedure, the SYS_Context should return exactly the IP address where you started your SQL session (your workstation).
But in case your procedure is performed by some web application, the maximum you will be able to get will be the IP address of the application server that started the database SQL session.
We still say that your procedure is triggered by a job within the database (dbms_job). The returned IP address will be that of the database server itself.
I hope I have helped clarify your doubts. Feel free to make more questions,
Hugs,
Sergio Coutinho