想在数据库服务器上写个脚本每天自动清除数据库中一张表的数据,怎么写这个脚本呢? 想在数据库服务器上写个脚本每天自动清除数据库中一张表的数据,怎么写这个脚本呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 使用oracle job 定时执行你得存储过程,你得存储过程内执行truncatehttp://www.bitscn.com/oracle/optimize/200604/19366.htmlhttp://www.cnblogs.com/liunx/archive/2008/04/09/1145173.html 例如每分钟执行一次create table test1(s varchar2(100));insert into test1 values('1');create or replace procedure sp_test isbegin execute immediate 'truncate table test1';end;/declare jobno number; begin dbms_job.submit(jobno,'sp_test;',sysdate,'sysdate+1/1440'); commit; dbms_job.run(jobno);end;/ 也可以使用系统的定时任务执行一个批处理文件,批处理文件中调用sqlplus执行truncate ! 在服务器上我们是先输入sqlplus 用户名/密码然后再输入SQL>truncate table a;再输入SQL>commit;如果写到shell里怎么实现呢? NLS_LANG OracleMTSRecoveryService Trunc 怎样把oracle中的blob字段导入sql中的image oracle 10g中表数据莫名其妙丢失是什么原因啊? Win7下安装Oracle11g报错 存储过程奇怪问题 我一直觉得应该增加一个非技术区板块,支持的兄弟就顶一下。 请教各位一个有关oracle8.0.5中显示中文字段的问题 ORACLE的驱动程序在哪里下载? 数据库重启后,中间件服务不重启是否也能正常运行? oracle,sql的问题....
http://www.bitscn.com/oracle/optimize/200604/19366.htmlhttp://www.cnblogs.com/liunx/archive/2008/04/09/1145173.html
create table test1(s varchar2(100));
insert into test1 values('1');create or replace procedure sp_test is
begin
execute immediate 'truncate table test1';
end;
/
declare
jobno number;
begin
dbms_job.submit(jobno,'sp_test;',sysdate,'sysdate+1/1440');
commit;
dbms_job.run(jobno);
end;
/
sqlplus 用户名/密码
然后再输入
SQL>truncate table a;
再输入
SQL>commit;
如果写到shell里怎么实现呢?