declare
datDateFrom date := to_date('2010/08/01 00:00:00','yyyy/mm/dd hh24:mi:ss');
datDateTo date;
begin
while datDateFrom <to_date('2014/01/01 00:00:00','yyyy/mm/dd hh24:mi:ss')
loop
datDateTo := least(datDateFrom + 10,to_date('2014/01/01 00:00:00','yyyy/mm/dd hh24:mi:ss')); INSERT INTO DRMARCHIVE.DBPROCLOG
select createdate,pgm,status from dbproclog where createdate >= datDateFrom and createdate < datDateTo; delete from dbproclog where createdate >= datDateFrom and createdate < datDateTo;
commit;
Insertlog(SYSDATE, 'dbproclog_delete', to_char(datDateFrom,'yyyy/mm/dd hh24:mi:ss') || ' to ' || to_char(datDateTo,'yyyy/mm/dd hh24:mi:ss') || ' deleted');
DBMS_LOCK.SLEEP(2); datDateFrom := datDateTo;
end loop; execute immediate 'alter index DBPROCLOG_IDX2 rebuild ONLINE';
execute immediate 'alter index DBPROCLOG_IDX1 rebuild ONLINE';
end;

Oracle每10天删除数据,并重建索引的更多相关文章

  1. oracle多表关联删除数据表记录方法

    oracle多表关联删除的两种方法 第一种使用exists方法 delete from tableA where exits ( select 1 from tableB Where tableA.i ...

  2. Oracle表存在则删除后再重建

    简单的执行方式: drop table USERINFO; create table USERINFO ( EnglishName ), ChineseName ), Sex ), Age int, ...

  3. Oracle重新获取统计信息以及SQLSERVER重建索引

    Oracle重新获取统计信息 exec dbms_stats.gather_schema_stats(ownname =>'LCoe739999',options => 'GATHER', ...

  4. oracle 大表 已有大数据量 建索引防卡 nologging

    create index idx_th_user_info_fans_name on th_user_info(fans_name) nologging;

  5. mysql----快速删除数据表(drop,truncate.delete)

    概念: 三者均可删除数据表 TRUNCATE TABLE 在功能上与不带 WHERE 子句的 DELETE 语句相同:二者均删除表中的全部行.但 TRUNCATE TABLE 比 DELETE 速度快 ...

  6. Mysql 删除数据表的三种方式详解

    用法: 1.当你不再需要该表时, 用 drop; 2.当你仍要保留该表,但要删除所有记录时, 用 truncate; 3.当你要删除部分记录或者有可能会后悔的话, 用 delete. 删除强度:dro ...

  7. 「Elasticsearch」ES重建索引怎么才能做到数据无缝迁移呢?

    背景 众所周知,Elasticsearch是⼀个实时的分布式搜索引擎,为⽤户提供搜索服务.当我们决定存储某种数据,在创建索引的时候就需要将数据结构,即Mapping确定下来,于此同时索引的设定和很多固 ...

  8. mongodb系列~mongodb定时删除数据

    一 简介:本文介绍创建自动删除数据的TTL索引 二 目的 定时删除数据三 创建方法   db.collection.createIndex(keys, options)   options:   ex ...

  9. mongodb定时删除数据(索引删除)

    一 简介:本文介绍创建自动删除数据的TTL索引 二 目的 定时删除数据三 创建方法   db.collection.createIndex(keys, options)   options:   ex ...

随机推荐

  1. hdu 2212

    1.简单的思维问题 各个位上阶乘的和 要和这个数相匹配 这样才能得到正确的解.各个位上阶乘的和 是最大是9*9!这样来求解.999999999   9个9 最大的各个位上的阶乘的和为3265920=9 ...

  2. Why Does Everyone Else Appear to Be Succeeding?

    Why Does Everyone Else Appear to Be Succeeding?  —Steven G. Krantz When you are a student, it will a ...

  3. Dev XtraTreeList 学习

    本文转载:http://www.cnblogs.com/VincentLuo/archive/2012/01/06/2313983.html 一.设置载请保留地址http://www.cnblogs. ...

  4. .NET常用操作小知识

    一..NET截取指定长度汉字超出部分以“.....”表示 /// <summary> /// 将指定字符串按指定长度进行剪切, /// </summary> /// <p ...

  5. Codeforces Round #324 (Div. 2) C. Marina and Vasya 贪心

    C. Marina and Vasya Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/584/pr ...

  6. HDU 5477 A Sweet Journey 水题

    A Sweet Journey Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pi ...

  7. [Practical Git] Format commit history with git log arguments

    When running the git log command, we can pass in options as arguments toformat the data shown for ea ...

  8. Java Annotations: Explored & Explained--转载

    原文地址:http://www.javacodegeeks.com/2012/08/java-annotations-explored-explained.html One of the many w ...

  9. codereview介绍

    1. 定义: Code review is systematic examination (often known as peer review) of computer source code. I ...

  10. WebKit笔记

    加载网页时执行javascript代码 let mWebView = WKWebView.init(frame: self.view.bounds) self.view.addSubview(mWeb ...