SQL> create table Z_TRUNCATE_T(ID number);
Table created.
SQL> insert into Z_TRUNCATE_T select 1 from dual;
1 row created.
SQL> commit;
Commit complete.
SQL> select * from Z_TRUNCATE_T;
ID
----------
1
SQL>
2,比较粗鲁不安全的做法
通常赋予truncate的常规做法,是直接赋值drop any table给一个用户
SQL> grant drop any table to dwetl;
Grant succeeded.
SQL>
SQL> grant select,insert,delete,update on Z_TRUNCATE_T to dwetl;
Grant succeeded.
SQL>
干完活,需要赶紧马上收回权限因为drop any table权限是在太大了,一不小心就会造成误删除,到时候哭都来不及啊
SQL> revoke drop any table from dwetl;
Revoke succeeded.
SQL> revoke select,insert,delete,update on shop.PLAN6_TEMPLET_NODE_EDIT from dwetl;
Revoke succeeded.
SQL>
SQL> grant execute on p_truncate to dwetl;
Grant succeeded.
SQL>
SQL> grant select,insert,delete,update on Z_TRUNCATE_T to dwetl;
Grant succeeded.
SQL>