Advertisement Space
Prohibit Excel from Connecting to your Database
It could be accidental or not, but sometimes it's helpful if you can make sure certain tools aren't allowed to connect to a certain database. The following trigger is executed whenever someone wants to create a connection. We then check the program name and raise an exception if it matches with a tool we want to exclude.
Recipe #1 - Block Excel from Connecting to your Database
CREATE OR REPLACE TRIGGER block_excel
AFTER LOGON ON DATABASE
DECLARE
prog_ sys.v_$session.program%TYPE;
BEGIN
SELECT UPPER(program) INTO prog_
FROM sys.v_$session
WHERE audsid = USERENV('SESSIONID')
AND audsid != 0;
IF prog_ LIKE '%EXCEL%' THEN
RAISE_APPLICATION_ERROR(-20000,
'You are not allowed to connect to this database using Excel!');
END IF;
END;