标签:event 包括 name eve comm iat sql mit 需求
---需求,将TEST1,TEST2用户下所有表授权给 test用户,包括往后新建的表。ps:生产库慎用,最好不用;
create or replace trigger ddl_tri
after create on database
declare
PRAGMA AUTONOMOUS_TRANSACTION;
v_sqlstr_1 varchar2(4000);
v_job number;
begin
if Sys.dictionary_obj_owner in (‘TEST1‘,‘TEST2‘) THEN
if sys.sysevent = ‘CREATE‘ then
if Sys.dictionary_obj_type =‘TABLE‘ then
v_sqlstr_1:=‘grant select on ‘|| Sys.dictionary_obj_owner||‘.‘||Sys.dictionary_obj_name||‘ to test‘;
--dbms_output.put_line(v_sqlstr_1);
dbms_job.submit(v_job,‘begin execute immediate ‘‘‘||v_sqlstr_1||‘‘‘; end;‘,sysdate);
commit;
execute immediate v_sqlstr_1;
end if;
end if;
END IF;
end;
/
标签:event 包括 name eve comm iat sql mit 需求
原文地址:https://www.cnblogs.com/lwq9614/p/13201038.html