Chinaunix首页 | 论坛 | 博客
  • 博客访问: 616732
  • 博文数量: 825
  • 博客积分: 5000
  • 博客等级: 大校
  • 技术积分: 4980
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-27 14:19
文章分类

全部博文(825)

文章存档

2011年(1)

2008年(824)

我的朋友

分类:

2008-10-27 14:26:26


  1、确保的工作模式允许启动队列管理器(SNP进程)
  SVRMGRL> Alter System Enable Restricted Session;
  或 SQL> Alter System Disenable Restricted Session;
  
  2、确保已配置任务队列管理器的启动参数
  initSID.ora中:
  job_queue_process=n(0);(0-36)个进程
  job_queue_interval=N(60);(1-3600)秒唤醒
  
  3、将任务加入数据库的任务队列中
  DBMS_JOB.Submit (
  job out binary_integer, (任务号)
  what in varchar2, (执行任务的名称及入参)
  next_date in date, (任务执行的时间)
  interval in varchar2, (任务执行的间隔。null:执行一次;sysdate+m:周期性,每隔m天执行)
  no_parse in boolean
  )
  同时
  grant execute on dbms_job to ...;
  
  4、将要执行的任务,为过程等PL/SQL程序段
  SQL> variable n number;
  SQL> begin
  2 dbms_job.submit(n, 'my_job', sysdate, 'sysdate + 1/360');
  3 commit;
  4 end
  5 /
  SQL> print :n;
  
  5、查看Job
  Table :user_jobs、dba_jobs
  Column:job (任务号)
  next_date (下次执行日期)
  next_sec (下次执行时间)
  failures (失败次数,失败16次则自动终止)
  broken (终止标志,Y/N)
  
【责编:admin】

--------------------next---------------------

阅读(198) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~