首页 » ORACLE 9i-23ai » ORA-04089: cannot create triggers on objects owned by SYS
ORA-04089: cannot create triggers on objects owned by SYS
今天做实验,忘记切换用户,在sys下建立触发器时发现了ORA-04089,不能建立trigger在sys的对象上 SQL> conn / as sysdba Connected. SQL> create table test_tr(id number,name varchar2(10)); Table created. SQL> create or replace trigger tri_test_tr 2 before insert 3 on test_tr 4 for each row 5 begin 6 if :new.id >1000 then 7 :new.id :=-1; 8 end if; 9 end; 10 / create or replace trigger tri_test_tr * ERROR at line 1: ORA-04089: cannot create triggers on objects owned by SYS SQL> create table anbob.test_tr1 as select * from test_tr; Table created. SQL> l 1 create or replace trigger tri_test_tr1 2 before insert 3 on anbob.test_tr1 4 for each row 5 begin 6 if :new.id >1000 then 7 :new.id :=-1 8 ; 9 end if; 10* end; SQL> run 1 create or replace trigger tri_test_tr1 2 before insert 3 on anbob.test_tr1 4 for each row 5 begin 6 if :new.id >1000 then 7 :new.id :=-1 8 ; 9 end if; 10* end;
Trigger created.
总结:
不可以在sys的对象上创建trigger,业务上的对象一定要保存其它的用户下,oracle是出于什么原因,在网上也没找到,绝的sys就像os 里的root,它用最高的权限。我觉得应该出于安全的角度。
04089, 00000, “cannot create triggers on objects owned by SYS”
// *Cause: An attempt was made to create a trigger on an object owned by SYS.
// *Action: Do not create triggers on objects owned by SYS.
上一篇: 让程序DO-NOTHING
下一篇: sql 编程命名规范
目前这篇文章有1条评论(Rss)评论关闭。