通過trigger防止指定用戶drop

sqlplus /nolog

conn /as sysdba;


SQL> create or replace trigger no_droping_for_you before
  2  drop on database
  3  begin
  4  if(user='ZHANGBIN') then
  5  raise_application_error( -20001, 'No dropping allowed');
  6  end if;
  7  end;
  8  /

Trigger created.

SQL> connect zhangbin
Enter password:
Connected.
SQL> drop table t;
drop table t
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-20001: No dropping allowed
ORA-06512: at line 3

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章