惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
V
Visual Studio Blog
P
Privacy International News Feed
月光博客
月光博客
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
Lohrmann on Cybersecurity
N
News and Events Feed by Topic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
Webroot Blog
Webroot Blog
T
Threatpost
宝玉的分享
宝玉的分享
The Last Watchdog
The Last Watchdog
小众软件
小众软件
L
LINUX DO - 最新话题
C
Cisco Blogs
T
Troy Hunt's Blog
Schneier on Security
Schneier on Security
酷 壳 – CoolShell
酷 壳 – CoolShell
www.infosecurity-magazine.com
www.infosecurity-magazine.com
雷峰网
雷峰网
G
GRAHAM CLULEY
有赞技术团队
有赞技术团队
Know Your Adversary
Know Your Adversary
博客园 - 叶小钗
罗磊的独立博客
V
V2EX
博客园 - Franky
P
Proofpoint News Feed
SecWiki News
SecWiki News
腾讯CDC
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
博客园 - 三生石上(FineUI控件)
S
Secure Thoughts
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
PCI Perspectives
PCI Perspectives
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
aimingoo的专栏
aimingoo的专栏
Cisco Talos Blog
Cisco Talos Blog
N
News and Events Feed by Topic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
SegmentFault 最新的问题

博客园 - hunter_gio

用xargs处理带空格文件名 利用awk分割电子书大文件 linux中shell变量$#,$@,$0,$1,$2的含义解释 推荐几本Python电子书 学习Shell好书 C/C++ 电子书推荐 Unicode5.1版发布 GB18030编码研究以及GBK、GB18030与Unicode的映射[转] Unicode、GB2312、GBK和GB18030中的汉字[转] 中日韩统一表意文字(CJK Unified Ideographs)[转] Unicode介绍[转] simple usage of tcpdump Python语言浅议 巴菲特:我的工作是阅读 我喜欢的Ubuntu软件列表 del.icio.us导出到google书签 解决w950播放RM视频的问题[转] Python 3.0a1 Release [Ebook]The Definitive Guide to SQLite
ORACLE----触发器,存储过程及JOB
hunter_gio · 2007-08-15 · via 博客园 - hunter_gio

一、ORACLE中创建自增的ID字段
1、创建序列
 create *sequence_name*  increment by 1 start with 1 maxvalue 999999999;
2、创建触发器---(创建一个基于该表的before insert 触发器,在触发器中使用该SEQUENCE)
create or replace trigger *triger_name*
before insert on       *table_name*
referencing old as old new as new for each row
begin
select  *sequence_name.nextval into :new.id from dual;
end;
/
二、ORACLE中JOB的应用
1、创建存储过程
create or replace procedure    *pro_name
as
begin
 insert into agri_exhibition_basecur (messid,title,type,pub_date)   select id,title,sort,pub_date from agri_message  where    (trunc(sysdate-pub_date)=0 and rownum<6) and sort='供' ;
 insert into agri_exhibition_basecur (messid,title,type,pub_date)   select id,title,sort,pub_date from agri_message  where    (trunc(sysdate-pub_date)=0 and rownum<6) and sort='求' ;
end;
/
2、创建JOB
variable jobdxm number;
begin
dbms_job.submit(:jobdxm,'exhi_pro_dxm;',sysdate,'trunc(sysdate,''dd'')+32.5/24');
end;
三、收集的一个简单的JOB实列
1、创建测试表
SQL> create table a(a date);

表已创建。

2、创建一个自定义过程
SQL> create or replace procedure test as
  2  begin
  3  insert into a values(sysdate);
  4  end;
  5  /

过程已创建。

3、创建JOB
SQL> variable job1 number;
SQL>
SQL> begin
  2  dbms_job.submit(:job1,'test;',sysdate,'sysdate+1/1440');  --每天1440分钟,即一分钟运行test过程一次
  3  end;
  4  /

PL/SQL 过程已成功完成。

4、运行JOB
SQL> begin
  2  dbms_job.run(:job1);
  3  end;
  4  /

PL/SQL 过程已成功完成。

SQL> select to_char(a,'yyyy/mm/dd hh24:mi:ss') 时间 from a;

时间
-------------------
2001/01/07 23:51:21
2001/01/07 23:52:22
2001/01/07 23:53:24

5、删除JOB
SQL> begin
  2  dbms_job.remove(:job1);
  3  end;
  4  /

PL/SQL 过程已成功完成。
6、一些必要的参数
修改initsid.ora参数
job_queue_processes = 4
job_queue_interval = 10
job_queue_keep_connections=true

修改可执行作业个数为20个
ALTER SYSTEM SET JOB_QUEUE_PROCESSES = 20

修改取消限制模式
ALTER SYSTEM DISABLE RESTRICTED SESSION;

7、两个必要的表
      user_jobs及dba_jobs_running

8、相关的几个JOB操作
删除job:dbms_job.remove(jobno);
修改要执行的操作:job:dbms_job.what(jobno,what);
修改下次执行时间:dbms_job.next_date(job,next_date);
修改间隔时间:dbms_job.interval(job,interval);
停止job:dbms.broken(job,broken,nextdate);
启动job:dbms_job.run(jobno);