Oracle从Oracle8i开始,允许实施事件trigger,可以实现对登录、DDL等的监视及控制,以下是一个例子:
create or replace trigger drop_deny
before drop or truncate on database
declare
l_msg varchar2(100):= '权限不够!!!';
begin
raise_application_error(-20001, ora_dict_obj_owner || '.' || ora_dict_obj_name || ' ' || l_msg);
exception
when no_data_found then
null;
end;
/
create or replace trigger drop_deny
before drop or truncate on database
declare
l_msg varchar2(100):= '权限不够!!!';
begin
raise_application_error(-20001, ora_dict_obj_owner || '.' || ora_dict_obj_name || ' ' || l_msg);
exception
when no_data_found then
null;
end;
/
还可以实现after logon等事件。