`
michales003
  • 浏览: 403154 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

Oracle bpel 释放实例占用数据空间 脚本

阅读更多

Rem
Rem $Header: purge_instances_oracle.sql 14-sep-2007.11:48:18 ramisra Exp $
Rem
Rem purge_instances_oracle.sql
Rem
Rem Copyright (c) 2007, Oracle. All rights reserved. 
Rem
Rem    NAME
Rem      purge_instances_oracle.sql - <one-line expansion of the name>
Rem
Rem    DESCRIPTION
Rem      This file deletes all cube instaces and related data which were closed before given date time
Rem
Rem    NOTES
Rem      <other useful comments, qualifications, etc.>
Rem
Rem    MODIFIED   (MM/DD/YY)
Rem    ramisra     09/13/07 - File to purge Instances
Rem    ramisra     09/13/07 - Created
Rem

SET ECHO ON
SET FEEDBACK 1
SET NUMWIDTH 10
SET LINESIZE 80
SET TRIMSPOOL ON
SET TAB OFF
SET PAGESIZE 100

CREATE OR REPLACE PROCEDURE purge_instances (p_older_than TIMESTAMP)
AS
   CURSOR c_cube_instance
   IS
      SELECT cikey
        FROM cube_instance
       WHERE state >= 5 AND modify_date < p_older_than;

   CURSOR c_invoke_message
   IS
      SELECT message_guid
        FROM invoke_message
       WHERE state > 1 AND receive_date < p_older_than;

   CURSOR c_dlv_message
   IS
      SELECT message_guid
        FROM dlv_message
       WHERE state > 1 AND receive_date < p_older_than;
BEGIN
   -- Delete all closed instances older than specified date
   --
   FOR r_cube_instance IN c_cube_instance
   LOOP
      DELETE FROM native_correlation
                 WHERE conversation_id IN (SELECT conv_id from dlv_subscription
                                                  WHERE cikey =   r_cube_instance.cikey );

      DELETE FROM cube_instance
            WHERE cikey = r_cube_instance.cikey;

      DELETE FROM cube_scope
            WHERE cikey = r_cube_instance.cikey;

      DELETE FROM work_item
            WHERE cikey = r_cube_instance.cikey;

      DELETE FROM wi_exception
            WHERE cikey = r_cube_instance.cikey;

      DELETE FROM scope_activation
            WHERE cikey = r_cube_instance.cikey;

      DELETE FROM dlv_subscription
            WHERE cikey = r_cube_instance.cikey;

      DELETE FROM audit_trail
            WHERE cikey = r_cube_instance.cikey;

      DELETE FROM audit_details
            WHERE cikey = r_cube_instance.cikey;

      DELETE FROM sync_trail
            WHERE cikey = r_cube_instance.cikey;

      DELETE FROM sync_store
            WHERE cikey = r_cube_instance.cikey;
       
      DELETE FROM xml_document
                 WHERE dockey IN ( SELECT doc_ref.dockey FROM document_ci_ref doc_ref
                      WHERE doc_ref.cikey =  r_cube_instance.cikey);

      DELETE FROM document_dlv_msg_ref
                  WHERE dockey IN ( SELECT doc_ref.dockey FROM document_ci_ref doc_ref
                      WHERE doc_ref.cikey =  r_cube_instance.cikey);

      DELETE FROM document_ci_ref
                  WHERE cikey =  r_cube_instance.cikey;

      DELETE FROM attachment
                 WHERE key IN ( SELECT attach_ref.key FROM attachment_ref attach_ref
                      WHERE attach_ref.cikey =  r_cube_instance.cikey);

      DELETE FROM attachment_ref
                 WHERE cikey =  r_cube_instance.cikey;    

      DELETE FROM ci_indexes
                 WHERE cikey =  r_cube_instance.cikey;  


      COMMIT;
   END LOOP;

   -- Purge all handled invoke_messages older than specified date
   --
   FOR r_invoke_message IN c_invoke_message
   LOOP
      DELETE FROM invoke_message
            WHERE message_guid = r_invoke_message.message_guid;

      DELETE FROM xml_document
             WHERE dockey IN (SELECT dlv_ref.dockey FROM  document_dlv_msg_ref dlv_ref 
                          WHERE dlv_ref.message_guid =  r_invoke_message.message_guid);
      DELETE FROM document_ci_ref
            WHERE dockey IN (SELECT dlv_ref.dockey FROM  document_dlv_msg_ref dlv_ref
                     WHERE dlv_ref.message_guid =  r_invoke_message.message_guid);

      DELETE FROM document_dlv_msg_ref
             WHERE message_guid =  r_invoke_message.message_guid;

      COMMIT;
   END LOOP;

   -- Purge all handled callback messages older than specified date
   --
   FOR r_dlv_message IN c_dlv_message
   LOOP
      DELETE FROM dlv_message
            WHERE message_guid = r_dlv_message.message_guid;

      DELETE FROM xml_document
             WHERE dockey IN (SELECT dlv_ref.dockey FROM  document_dlv_msg_ref dlv_ref 
                          WHERE dlv_ref.message_guid =  r_dlv_message.message_guid);
      DELETE FROM document_ci_ref
            WHERE dockey IN (SELECT dlv_ref.dockey FROM  document_dlv_msg_ref dlv_ref
                     WHERE dlv_ref.message_guid =  r_dlv_message.message_guid);

      DELETE FROM document_dlv_msg_ref
             WHERE message_guid =  r_dlv_message.message_guid;

      COMMIT;
   END LOOP;
   -- delete all unreferenced xml_documents rows from xml_document table
   DELETE FROM xml_document
                 WHERE dockey NOT IN (SELECT dlv_ref.dockey FROM document_dlv_msg_ref dlv_ref
                                                            UNION
                                                 SELECT doc_ref.dockey FROM document_ci_ref doc_ref );

   -- IF conversation_id is not present in dlv_subscription, we can delete it from native_correlation
   DELETE FROM native_correlation
                 WHERE conversation_id NOT IN (SELECT conv_id from dlv_subscription);

END purge_instances;
/

COMMIT;

/*-----------------------------------------------------------------------------------------------
  SELECT STATEMENTS TO COUNT THE NUMBER OF RECORDS IN EACH OF THE MAIN DEHYDRATION TABLES
 -----------------------------------------------------------------------------------------------*/

--select count(*) from cube_instance where modify_date <= to_timestamp('2006-05-11 00:00:00','YYYY-MM-DD HH24:MI:SS')

--select count(*) from invoke_message where receive_date <= to_timestamp('2006-05-11 00:00:00','YYYY-MM-DD HH24:MI:SS')

--select count(*) from dlv_message where receive_date <= to_timestamp('2006-05-11 00:00:00','YYYY-MM-DD HH24:MI:SS')


/*-----------------------------------------------------------------------------------------------
  CALLING THE STORED PROCEDURE EXAMPLES
  Example 1:  Allows the user to input date and time (24 hour format)
  Example 2:  Allows the user to input a date only       
 -----------------------------------------------------------------------------------------------*/

--call purge_instances(to_timestamp('2006-05-10 00:00:00','YYYY-MM-DD HH24:MI:SS'))

--call purge_instances(to_timestamp('2007-09-14','YYYY-MM-DD'))
/

分享到:
评论

相关推荐

    Oracle bpel 安装指导

    根据提供的文件信息,本文将对Oracle BPEL Process Manager的安装进行详细解析,并结合其描述与部分内文,深入探讨其关键知识点。 ### Oracle BPEL Process Manager简介 Oracle BPEL Process Manager(Business ...

    oracle bpel 流程开发指导

    6. **流程实例管理和监控**:Oracle BPEL Process Manager提供了一套管理工具,可以查看流程实例的状态,跟踪执行历史,以及对运行时问题进行诊断。 7. **部署和生命周期管理**:流程开发完成后,需要打包成部署...

    ORACLE bpel 开发手册

    ### ORACLE BPEL开发手册知识点解析 #### 一、ORACLE BPEL Process Manager简介 **ORACLE BPEL Process Manager**(简称BPEL PM)是ORACLE公司为支持业务流程执行语言(Business Process Execution Language,简称...

    oracle bpel

    文件“b28983.doc”可能包含有关Oracle BPEL的具体使用指南、最佳实践或者示例,例如如何创建和部署BPEL流程,如何处理服务之间的数据转换,以及如何在实际项目中应用SOA理念。如果能够阅读并理解这份文档,开发者将...

    Oracle BPEL

    ### Oracle BPEL Process Manager 快速入门指南 #### 一、引言 Oracle BPEL Process Manager(Business Process Execution Language for Web Services)是Oracle SOA Suite中的一个关键组件,用于设计、部署和管理...

    Oracle BPEL Process Manager安装步骤.docx

    - 硬盘空间:除了用于存储数据的空间外,还需要额外3GB以上的空间用于Oracle软件本身的安装。 2. **软件要求**: - 操作系统为Windows XP或更高版本。 - 已安装Java Development Kit (JDK),建议版本为1.5或...

    Oracle BPEL Process Manager介绍.rar

    Oracle BPEL Process Manager是Oracle Fusion Middleware的一部分,它是一个企业级的工作流引擎,用于构建、部署和管理业务流程执行语言(Business Process Execution Language,BPEL)流程。BPEL是一种标准的XML...

    oracle SOA bpel发布流程

    Oracle SOA Suite 是一款强大的企业级服务导向架构(SOA)解决方案,它包含了BPEL(Business Process Execution Language)组件,用于构建、管理和执行业务流程。BPEL是一种标准的XML语言,用来描述如何组合Web服务...

    Oracle SOA 套件——Oracle BPEL 流程管理器

    ### Oracle SOA 套件——Oracle BPEL 流程管理器 #### 执行概况与背景 在当今快速变化的市场环境下,企业面临着前所未有的挑战:市场动态变化迅速、竞争压力持续增大以及客户需求多样化。这些因素共同作用,对企业...

    bepldev、oracle BPEL的详细文档

    ### Oracle BPEL Process Manager 开发者指南 #### 一、引言 Oracle BPEL Process Manager 是一款基于标准的企业级业务流程管理(Business Process Management, BPM)平台,它允许组织设计、实施并自动化复杂的业务...

    bpel完整实例(webservice+bpel)

    **BPel 完整实例(WebService + BPEL)** **一、BPel简介** Business Process Execution Language(BPEL)是一种用于编排Web服务的业务流程执行语言,它是基于XML的,专为实现企业服务总线(ESB)上的复杂业务流程...

    bpel入门实例(组合加减法运算)

    【BPEL 入门实例:组合加减法运算】 BPEL,即Business Process Execution Language,是一...同时,这个实例也展示了BPEL流程中的基本元素,如服务调用、条件判断、数据处理等,帮助你更好地理解和掌握BPEL的工作原理。

    Web Service Integration with Oracle BPEL Process Manager & JDeveloper

    开发者可以利用JDeveloper创建BPEL流程,然后将其部署到Oracle应用服务器(OAS)实例上。OAS包含SOA套件,运行BPEL流程管理器,并保存流程状态信息,同时提供审计轨迹和过程历史。 为了开始学习BPEL,你可以访问...

    BPEL 入门 实例

    ### BPEL 入门实例详解 #### 一、BPEL 概念与背景 BPEL(Business Process Execution Language)是一种专为Web服务设计的业务流程执行语言,也被称作BPEL4WS。它允许开发人员通过组合、编排和协调Web服务来自上而...

    基于Oracle BPEL的医院信息系统集成方案设计与应用.pdf

    【Oracle BPEL】Oracle BPEL(Business Process Execution Language)是Oracle公司提供的一种用于构建企业服务总线(ESB)中的业务流程管理(BPM)解决方案的编程模型。它是基于XML的,允许开发者定义、执行和管理...

    Oracle BPEL Introduction

    Oracle BPEL(Business Process Execution Language)是一种用于构建和管理业务流程的编程语言,它将分散的服务集成到端到端的流程中。BPEL 的引入解决了在服务导向架构(SOA)中实现复杂业务流程的挑战,允许企业将...

Global site tag (gtag.js) - Google Analytics