The PROGRAM column in V$SESSION relies on the application passing that information to Oracle. Oracle is not always able to read the program from the application, so the column's value is NULL. To stop this user from connecting to your database, you can write a simple AFTER LOGON trigger. In the main body of the code, check for the PROGRAM value to see if it is valid. If not, raise an exception. Something similar to the following:
SELECT program INTO v_program FROM v$session
WHERE audsid=SYS_CONTEXT('USERENV','SESSIONID');
IF (v_program IS NULL) THEN
RAISE_APPLICATION_ERROR(-20001,'Not a valid program');
END IF;
|