oracle ora30511,系统触发器 ora-30511

CREATE OR REPLACE TRIGGER allen

AFTER LOGON ON database

BEGIN

execute immediate ' alter user raddisonlee account unlock ';

commit;

END;

-------- ok ,it  pass in the sys account ! no any error message ....  but  when i change another account to logon  oracle ,it is failture ! error code under :

ERROR:

ORA-00604: 递归 SQL 层 1 出现错误

ORA-30511: 系统触发器中无效的 DDL 操作

ORA-06512: 在line 2

Since you have 8.1.6, you can use an ON CREATE trigger to do this perhaps.

Something like:

create or replace trigger do_grant

after CREATE on schema

declare

l_str varchar2(255);

l_job number;

begin

if ( ora_dict_obj_type = 'TABLE' )

then

l_str := 'execute immediate "grant select on ' ||

ora_dict_obj_name ||

' to scott";';

dbms_job.submit( l_job, replace(l_str,'"','''') );

end if;

end;

/

That, when run in a given user account will schedule a job to grant SELECT on

any table created to SCOTT.  We use dbms_job to run the grant in the background

because this is executing as part of a larger data dictionary transaction and we

cannot commit (nor can we use an autonomous transaction - the table is not yet

"fully" created)...

If you have job_queue_processes set to >0 and job_queue_interval set to some

reasonable number (I use 60 for 1 minute intervals), then scott will have access

to any table about 1 minute AFTER its created....

也就是说,在一个给定的用户帐户下运行时,将安排一个作业,授予SELECT权限对此用户上

创建的任何表给scott。我们使用DBMS_JOB在后台运行grant 是因为这是在执行一个较大的数据字典事务的一部分,我们

不能commit(也可以使用自治事务-该表是尚未 “完全”创建的)...

如果您已经JOB_QUEUE_PROCESSES设置为>0且JOB_QUEUE_INTERVAL设置一些

合理数量的(我用60,1分钟间隔),那么scott将 可以访问任何表在其创造了约一分钟后....

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值