Skip to content

Instantly share code, notes, and snippets.

@hhudson
Last active November 4, 2022 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hhudson/bdbe2168fa14f69d4971ae080e9b2fc9 to your computer and use it in GitHub Desktop.
Save hhudson/bdbe2168fa14f69d4971ae080e9b2fc9 to your computer and use it in GitHub Desktop.
A Database Logon Trigger to set session values (enable PL/SQL Warnings, for eg)
/*
* This script needs to be run from a privileged account with the following grants (SYS will work):
* • GRANT CREATE TRIGGER TO {your privileged schema};
* • GRANT ADMINISTER DATABASE TRIGGER TO {your privileged schema};
*/
create or replace trigger ait_logon_trigger
after logon on database
when (user not in ('SYS','SYSTEM') and user not like 'APEX%')
begin
execute immediate q'[ALTER SESSION SET PLSQL_WARNINGS = 'ENABLE:ALL']';
execute immediate q'[ALTER SESSION SET PLSCOPE_SETTINGS='IDENTIFIERS:ALL, STATEMENTS:ALL']';
end ait_logon_trigger;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment