The example below explains how to restrict user shy from accessing database from IP address 159.09.208.953 Step 1:-
Create the following trigger :-
Create or replace trigger logontrig after logon on database Begin if ora_client_ip_address='159.09.208.953' and ora_login_user='SHY' THEN RAISE_APPLICATION_ERROR(-20001, 'You are not authorized to login into this machine shy'); END IF; end;
Trigger code explanation:-
i) The trigger fires whenever user shy connects to the database . ii) Internally it checks the IP address of the machine from where the user is trying to log on to the database iii) If the IP address of the machine from which the user connects matches the trigger condition it raises the error message and prevents the user from connecting to the database.
Comments