select * from v$version;Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production
PL/SQL Release 9.0.1.1.1 - Production
CORE 9.0.1.1.1 Production
TNS for 32-bit Windows: Version 9.0.1.1.0 - Production
NLSRTL Version 9.0.1.1.1 - Production//创建过程
create or replace procedure sp_insert_epuserlog
as
v_oid number;
begin
select userlog_s.nextval into v_oid from dual;
insert into userlog(oid,logname,datetime) values(v_oid,'abcdefg',sysdate);
commit;
end;
//添加任务 每两分钟执行一次
SQL> variable job1 number;
SQL> begin
2 dbms_job.submit(:job1,'sp_insert_epuserlog;', sysdate,'sysdate+1/720');
3 end;
4 /
SQL> select job,next_date,next_sec,failures,broken from user_jobs; JOB NEXT_DATE NEXT_SEC FAILURES BROKEN
---------- ----------- ---------------- ---------- ------
6 2006-10-24 11:36:36 NSQL> begin
2 dbms_job.run(6);
3 end;
4 /
手工测试都正常, 可就是没办法自动去执行这个任务.
后来看到有文章说计时器溢出什么的.但我想不应该是这个问题.
就按
alter system set job_queue_processes=0;-->
alter system set job_queue_processes=5;
重启数据库.
就可以执行任务了.
可是下班关机,第二天又不行了.faint~... ...http://www.aspx.cn/html/database/oracle/602/41978.html中有提到计时器溢出对应的解决方案.
PL/SQL Release 9.0.1.1.1 - Production
CORE 9.0.1.1.1 Production
TNS for 32-bit Windows: Version 9.0.1.1.0 - Production
NLSRTL Version 9.0.1.1.1 - Production//创建过程
create or replace procedure sp_insert_epuserlog
as
v_oid number;
begin
select userlog_s.nextval into v_oid from dual;
insert into userlog(oid,logname,datetime) values(v_oid,'abcdefg',sysdate);
commit;
end;
//添加任务 每两分钟执行一次
SQL> variable job1 number;
SQL> begin
2 dbms_job.submit(:job1,'sp_insert_epuserlog;', sysdate,'sysdate+1/720');
3 end;
4 /
SQL> select job,next_date,next_sec,failures,broken from user_jobs; JOB NEXT_DATE NEXT_SEC FAILURES BROKEN
---------- ----------- ---------------- ---------- ------
6 2006-10-24 11:36:36 NSQL> begin
2 dbms_job.run(6);
3 end;
4 /
手工测试都正常, 可就是没办法自动去执行这个任务.
后来看到有文章说计时器溢出什么的.但我想不应该是这个问题.
就按
alter system set job_queue_processes=0;-->
alter system set job_queue_processes=5;
重启数据库.
就可以执行任务了.
可是下班关机,第二天又不行了.faint~... ...http://www.aspx.cn/html/database/oracle/602/41978.html中有提到计时器溢出对应的解决方案.
variable job1 number;
begin
dbms_job.submit(:job1,'sp_insert_epuserlog;', sysdate,'sysdate+1/720');
commit;
end;
/
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes integer 0
db_writer_processes integer 1
job_queue_processes integer 0 //这里变为零了!!
log_archive_max_processes integer 1
processes integer 150如果你刚用过alter system set job_queue_parameter = 26;那么这个可能有值,重新启动后就又变成零了,
进入$HOME/oracle/admin/数据库名/pfile/init.ora这个文件中在.
如下:
###########################################
# 进程和会话
###########################################
processes=150
job_queue_processes = 26 #加入这一行
###########################################
重新启动数据库,JOB就可以自已运行了.
谢谢,commit无影响我的问题.
是数据库初始化搞的鬼.一开始alter 了,可是重新启动后又被复原为0了.