Step 1 : Create table for storing the IP addresses
Create table USER_IPS( IP_ADDRESS VARCHAR2(15), USER_LOGGED VARCHAR2(50));
Step 2: Create a logon trigger to capture the ip addresses
create or replace trigger USER_IPS
after logon on database
DECLARE
IP VARCHAR2(15);
BEGIN
SELECT SYS_CONTEXT('USERENV', 'IP_ADDRESS', 15) INTO IP FROM DUAL;
INSERT INTO USER_IPS values(IP,USER) ;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
end;
/
SQL>SELECT * FROM USER_IPS;
IP_ADDRESS USER_LOGGED
--------------- --------------------------------------------------
10.18.7.11 PORTAL
10.35.9.12 PORTAL
10.35.9.23 PORTAL
Step 2: Create a logon trigger to capture the ip addresses
create or replace trigger USER_IPS
after logon on database
DECLARE
IP VARCHAR2(15);
BEGIN
SELECT SYS_CONTEXT('USERENV', 'IP_ADDRESS', 15) INTO IP FROM DUAL;
INSERT INTO USER_IPS values(IP,USER) ;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
end;
/
SQL>SELECT * FROM USER_IPS;
IP_ADDRESS USER_LOGGED
--------------- --------------------------------------------------
10.18.7.11 PORTAL
10.35.9.12 PORTAL
10.35.9.23 PORTAL
Tags:
Oracle