Tuesday 26 July 2016

Oracle Webcenter Content new Features & versions (11g-11.1.1.9 vs 12c-12.2.1)

Hello Guys,

Since we have oracle Webcenter 12c version launched, I was doing some research on some new features with respect to Webcenter version 11.1.1.9 & 12c. Below are my findings:-

Products: -


1)Webcenter Forms Recognition



                       

2)Webcenter Enterprise Capture


3) Webcenter UCM



4) Webcenter Imaging


Note:- Below mention applications are deprecated in release of 12c (12.2.1)

Tuesday 18 August 2015

Compiling E-Business Suite Forms--AXF Tasklist

1. For the applicable version listed below, copy the AXF_CUSTOM.pld file to the E-Business Server        (to FORMS_PATH for E-Business Suite 12).E-Business Suite 12:\\--\Oracle\Middleware\Oracle_ECM1\axf\adapters\ebs\R12\AXF_CUSTOM.pld

Note 1: - Move the AXF_CUSTOM.pld and CUSTOM.PLL file into resource directory.

Note 2: -If you are using a Linux/UNIX system and copied the .PLD from a Windows system, issue the dos2unix command before converting it below.

2.  Open Oracle Forms Builder and connect to the E-Business Suite database as the APPS user.
 Forms Builder location:- /--/oracle/--/apps/tech_st/10.1.2/bin/frmbld.sh

Note: - Be sure to connect to the E-Business Suite database. If you fail to connect, verify the tnslistener.ora file.

3. In Forms Builder, open and convert AXF_CUSTOM.pld to AXF_CUSTOM.pll, by selecting File,    then Administration, then Convert. Select PL/SQL libraries and Text to binary while converting the file.

4.From the File menu, open AXF_CUSTOM.pll. Select Program, then Compile pl/sql, then All (E-Business Suite 12).

5. Compile AXF_CUSTOM into a module (.plx) by selecting Program, then Compile Module (E-Business Suite 12).

6. Select File then Connect and ensure that you are connected to the database as the APPS user.

7.Back up the CUSTOM.pll file.

8.Open CUSTOM.pll by selecting File, then Open and selecting PL/SQL Libraries (*.pll) in the Files of Type field. After opening the file and expanding Program Units, right-click the custom package body of CUSTOM.pll and select pl/sql editor.

9. In CUSTOM.pll, modify the following text for the solutions you are configuring. If the file contains other customization's, place these modifications after the existing code inside each function/procedure.

For Imaging Solution Only:
function zoom_available return boolean is
begin

-- Required for ALL integrations
return AXF_CUSTOM.zoom_available();
end zoom_available;

Note: - Make sure to remove “return false;”.

 10.In CUSTOM.pll, modify the following text. If the file contains other customizations, place these modifications after the existing code inside each function/procedure.

procedure event(event_name varchar2) is
begin

-- Required for AXF integrations
AXF_CUSTOM.event(event_name);
null;

end event;

11. With CUSTOM.pll open, determine if AXF_CUSTOM is listed as an attached library.
Note:-If it is not listed, attach AXF_CUSTOM by highlighting Attached Libraries under CUSTOM and clicking the plus (+) symbol; browse to AXF_CUSTOM.pll and select it(In our case it was listed, so I attached it).

12.When prompted to remove the path, click Yes.

13.With CUSTOM.pll open, select Program, then Compile pl/sql, then All (E-Business Suite 12).

14.Compile CUSTOM into a module (.plx) by selecting Program, then Compile Module (E-Business Suite 12).

15. Save all before exiting Forms Builder. Verify that the Zoom menu command is displayed in the appropriate E-Business Suite forms.

Wednesday 12 August 2015

Changing WLS admin username and password

Changing the WLS admin user on an Oracle WCI implementation

Server: WLS, SOA, WCI, UCM

 To Reset the WebLogic Username and Password then Please follow the Steps mentioned Below: -

1) Shut down the WebLogic domain, the managed servers, Admin Server and Node Manager.
2) Changes made to the admin user should be done before all groups and users are created.
If groups and users are already created, grab a snapshot of the current security groups and users. Through WLS Console go to security realms, my realm, users and groups.  Write down all users and all groups; take care to note letter case (case sensitive).  Make a note of group to user assignments.  After the fact all users and groups will need to be re-created just as they were.
3) Perform the process as outlined in the Oracle URL…  https://oracle-base.com/articles/11g/reset-the-adminserver-password-in-weblogic-11g-and-12c (text of this article is added at the end of the document in appendix section 2).  Note that while this article specifically mentions resetting the Admin Server password, it can be used to provide an entirely different admin user account.  
4) Restart WLS and verify.
5) Go back into WLS console and manually add back all your users and groups, including associations and passwords.
6) While in WLS console, update the node manager settings, DOMAIN, SECURITY, ADVANCED settings.  Change Node Manager User Name to new admin user, update password.
7) Go into EM and update the credential map:  Domain  Security  Credentials.
8) In the Oracle AXF tables update the AXF soap settings.  Add the new user to the security vault. Refer appendix section 1.
9) If necessary go into worklistapp and update security settings for all the views.  If views are assigned to groups and not users than that should be fine.  You will also probably need to change your view owner, originally your views were probably created using the weblogic user.  The ownership will need to change so that you can check and update the views.  
To change ownership run the following script in the SOAINFRA schema:  update DEV_SOAINFRA.WFUserTaskView set ViewOwner = ‘<new user name>’ where ViewOwner = ‘<old user name>’.  If the user was appropriately assigned to all the right groups when you login into worklist app using the new user you should see all the views.
10) Need to update composite properties – specifically the BPEL rules – with the updated user account information.  That can be done through composer, but more than likely the changes will need to be made in the individual composite and re-deploy the composites.
11) Log into CS using the new user information, note that when you do login with the new user you might be asked to confirm system settings.  Be sure the settings are the same as the original settings, otherwise you could lose something in the configuration.
12) WCI security needs to be reset.  First, there are three tables in the WCI schema that will need to be altered, SYSTEM_SECURITY, DEFINITION_SECURITY, and DOCUMENT_SECURITY.  Each of these tables has a NAME column that specifies the name of the security owner.  The name, weblogic, does show up as owner for a number of these areas.  Using an SQL script, change the owner name from weblogic to the new admin user name.  Note that there is some group ownership so you can’t update every row, change where name = “weblogic”.

-- update UAT_IPM.SYSTEM_SECURITY  set NAME = 'wcitest' where NAME = 'weblogic';
13) Run RefreshIPMSecurity().  Do this by using WLST from the ECM home  common  bin directory and connecting to the WCI service using the new login and password.
14) Update startup scripts as needed.
15) Restart all services, including the Node Manager and WLS.  Login to the various services and confirm system operation.


Server: WLS, WEC

For the capture server the initial steps will be primarily the same as the original with a few exceptions…

1) Shut down the WebLogic domain, the managed servers, Admin Server and Node Manager.
2) Changes made to the admin user should be done before all groups and users are created.
If groups and users are already created, grab a snapshot of the current security groups and users. Through WLS Console go to security realms, my realm, users and groups.  Write down all users and all groups; take care to note letter case (case sensitive).  Make a note of group to user assignments.  After the fact all users and groups will need to be re-created just as they were.
3) In the Capture system you should have created a captureUser and a captureAdmin account (or similar) and assigned those accounts to capture roles in EM.  Before doing the security change, make sure that the captureAdmin account is assigned to all the same security roles as the weblogic user:  EM  Domain  Security  Roles.  Be sure the capture admin user is assigned to the Capture User and the Capture Workspace Manager roles.  This will give you a back door should something go wrong.  In dc-console, login as weblogic and assign the captureAdmin account to all applicable workspaces and to all available profiles, scan, index, and import
4) Confirm that you can login to both dc-console and dc-client using the capture admin account, and be sure you can see everything you would expect to see as weblogic user. 
5) Perform the process as outlined in the Oracle URL…  https://oracle-base.com/articles/11g/reset-the-adminserver-password-in-weblogic-11g-and-12c (text of this article is added at the end of the document).  Note that while this article specifically mentions resetting the Admin Server password, it can be used to provide an entirely different admin user account.  
6) Restart WLS and verify.
7) Go back into WLS console and manually add back all your users and groups, including associations and passwords.
8) While in WLS console, update the node manager settings, DOMAIN, SECURITY, ADVANCED settings.  Change Node Manager User Name to new admin user.
9) After the admin user is changed you will need to go back into EM and be sure the new admin user is assigned to the appropriate roles, user and workspace manager, then you will need to go back into console, this time as capture admin and give the new system admin permissions to the workspaces and profiles.
10) Update startup scripts as needed.
11) Restart all services, including the Node Manager and WLS.  Login to the various services and confirm system operation.


Appendix: -
A.Configuring AXF SOAP Security
1.     Open SQL plus 
2.     Log into your db client as the AXF user
3. Display the current AXF parameters
select * from axf_properties;
4. Verify:
a. AXF_SOAP_POLICY=USER_NAME_TOKEN
b. AXF_SOAP_SECURITY=TRUE
c. AXF_SOAP_USER= <ECM domain admin username>
5. To change any of the above, e.g. AXF_SOAP_USER
UPDATE AXF_PROPERTIES set PROPVALUE='weblogic' WHERE PROPNAME='AXF_SOAP_USER';
6. Log into your db client as the APPS user
7. Set the username and password into the database vault:
execute fnd_vault.put('AXF', '<ECM domain admin username>','<WLS Domain User Password>');
8. Verify
select fnd_vault.get('AXF',' <ECM domain admin username>') from dual;


B.Reset the AdminServer Password in WebLogic 11g and 12c
If you forget the AdminServer password for your WebLogic 11g domain, you can reset it from the command line using the following process.
Set up the following environment variables. They are not necessary for the process itself, but will help you navigate. In this case my domain is called "ClassicDomain". Remember to change the value to match your domain.
export MW_HOME=/u01/app/oracle/middleware
export DOMAIN_HOME=$MW_HOME/user_projects/domains/ClassicDomain
Shut down the WebLogic domain.
$ $DOMAIN_HOME/bin/stopWebLogic.sh
Rename the data folder.
$ mv $DOMAIN_HOME/servers/AdminServer/data $DOMAIN_HOME/servers/AdminServer/data-old
Set the environment variables.
$ . $DOMAIN_HOME/bin/setDomainEnv.sh
Reset the password using the following command. Remember to substitute the appropriate username and password.
$ cd $DOMAIN_HOME/security
$ java weblogic.security.utils.AdminAccount <username> <password> .
Update the "$DOMAIN_HOME/servers/AdminServer/security/boot.properties" file with the new username and password. The file format is shown below.
username=<username>
password=<password>
Start the WebLogic domain.
$ $DOMAIN_HOME/bin/startWebLogic.sh
For more information see:
How to Change the WebLogic Server Administrator Password [ID 1082299.1]


Sunday 22 March 2015

Oracle CPU Patching Steps

This is a reference document with respect to oracle CPU patching. It covers patching steps to be followed in general while patching: - SOA, ECM and Weblogic.

ABOUT CPUs:-
A CPU is a bundle of patches released on a quarterly basis to provide security fixes for Oracle products. CPUs are issued for vulnerabilities in supported products that compromise:
• Data confidentiality, i.e. an attacker is able to view information that he or she should be prevented from viewing.
• Data integrity, i.e. an attacker is able to modify information that he or she should be prevented from modifying.
• System availability, i.e. an attacker is able to disrupt legitimate use of or access to a system.
Implementing a CPU usually involves reading the accompanying documentation, including CPU Availability or Update Notes and READMEs for individual patches.

Note: - The Frequently Asked Questions with respect to Oracle Critical Patch Update and Security Alert Programs can be found following the below link:-


SOA Patch:
1.     Download the patch  from support.oracle.com
2.     FOR THE SOA HOME Set the ORACLE_HOME environment variable to SOA Home, for example "[MW_HOME]/Oracle_SOA1" directory.
3.     Verify the OUI Inventory. Opatch needs access to a valid OUI inventory to apply patches. Validate the OUI inventory with the following commands:

                                              $ opatch lsinventory 
4.     Verify Opatch version.

5.     Go to the location where patches are saved and unzip it using below command.
                                         “unzip -d PATCH_TOP p16702086_111160_Generic.zip”

Note1: In WINDOWS, the unzip command might not work as this zip has certain contents which passes the 256 characters limit. To overcome this problem, please use alternate ZIP utility like 7-Zip to unzip the patch.
For example: To unzip using 7-zip, run the command:
         "c:\Program Files\7-Zip\7z.exe"  x p14302931_111154_Generic.zip

Note2:- Before unzipping please modified the permission of the zip files.


6.     Run Opatch command:-

7.    Patch Succeeded.

Note : If it is asking for “y” or “n” for conflicts please answer “y” and proceed every time.

8.     Restart all the servers(Admin and managed servers)

ECM patch:-
1.        Set the ORACLE_HOME variable. ORACLE_HOME for this patch will be the Oracle_ECM1 directory.  In a default installation this is located at “.../Oracle/Middleware/Oracle_ECM1”.  The path and name can be changed during the initial product installation.
2.        Go to the folder where patch is saved and unzip using this command “unzip -d PATCH_TOP p19000478_111160_Generic.zip”.
3.        Go to this location “cd PATCH_TOP/19000478” and run this command “opatch apply”.

4.    
Weblogic patch:-
1.  Unzip the zip file to {MW_HOME}/utils/bsu/cache_dir or any local directory.
Note1: You must make sure that the target directory for unzip has required write and executable permissions
                  for "user" with which the component being patched is installed.
2.  Navigate to the {MW_HOME}/utils/bsu directory.
3.  Execute bsu.sh -install -patch_download_dir={MW_HOME}/utils/bsu/cache_dir -patchlist={PATCH_ID}  prod_dir={MW_HOME}/{WL_HOME}.
Note2: - Patch id is available in readme file of patch ex: Patch ID=T5F1.




SOA Infra Useful Queries

SOA Infra Useful Queries
We have a requirement where client wants to capture some sort of meaningful metrics data on volume metrics of processed instances by users and a total count of completed Instances. Below are some of the useful queries using we can fetch meaningful information from SOA infra schema.

Prerequisites

We need to meet following things before getting started
·         SQL developer
·         SOA infra schema connection details

Details


1.      1)   To fetch information based on State of instance, Composite name and approvers name, run below mention query:-
SELECT (CASE WHEN c.STATE=1 THEN 'OPEN AND RUNNING'
WHEN c.STATE=2 THEN 'OPEN AND SUSPENDED'
WHEN c.STATE=3 THEN 'OPEN AND FAULTED'
WHEN c.STATE=4 THEN 'CLOSED AND PENDING'
WHEN c.STATE=5 THEN 'CLOSED AND COMPLETED'
WHEN c.STATE=6 THEN 'CLOSED AND FAUTED'
WHEN c.STATE=7 THEN 'CLOSED AND CANCELLED'
WHEN c.STATE=8 THEN 'CLOSED AND ABORTED'
WHEN c.STATE=9 THEN 'CLOSED AND STALE'
WHEN c.STATE=10 THEN 'NON-RECOVERABLE'
ELSE C.STATE || ''
END) AS STATE, w.compositename,  w.updatedbydisplayname ,count(*)AS NUM_OF_INSTANCES
FROM CUBE_INSTANCE C, WFTASK W
WHERE c.cmpst_id=w.compositeinstanceid
group by w.compositename, w.updatedbydisplayname,C.STATE;


The above query needs access to two tables “CUBE_INSTANCE” and “WFTASK”.
A.       Cube Instance: - The cube instance table stores the instance data for any composite instance. The CIKEY is the primary key of the table and this is the unique reference for a initiated instance.  The STATE denotes whether the instance is stale/completed successfully/error. ‘Cmpst_id’ is the composite instance Id.

B.       WFTASK: - This table is Metadata table for workflow tasks. ‘Compositename’ shows the name of the composite. ‘Updatedbydisplayname’ column shows the approver’s name.



  

2.        2) To get the total count of invoices based on various states and between given time frame, run below mention query: -
SELECT (CASE WHEN STATE=1 THEN 'OPEN AND RUNNING'
WHEN STATE=2 THEN 'OPEN AND SUSPENDED'
WHEN STATE=3 THEN 'OPEN AND FAULTED'
WHEN STATE=4 THEN 'CLOSED AND PENDING'
WHEN STATE=5 THEN 'CLOSED AND COMPLETED'
WHEN STATE=6 THEN 'CLOSED AND FAUTED'
WHEN STATE=7 THEN 'CLOSED AND CANCELLED'
WHEN STATE=8 THEN 'CLOSED AND ABORTED'
WHEN STATE=9 THEN 'CLOSED AND STALE'
WHEN STATE=10 THEN 'NON-RECOVERABLE'
ELSE STATE || ''
END) AS STATE, COUNT(*) AS NUM_OF_INSTANCE FROM CUBE_INSTANCE
where Composite_name='DocumentRouting'
AND CREATion_date >= TO_TIMESTAMP('2014-12-29','YYYY-MM-DD')
AND CREATion_date <= TO_TIMESTAMP('2015-01-07','YYYY-MM-DD')
GROUP BY STATE;


3.       3)  Query to find the execution time of BPEL instances: - We can also modify above query to calculate the execution time of BPEL instances using modify_date & creation_date columns.







Tuesday 27 January 2015

Weblogic vs JBoss

WebLogic is not an open source product.
JBoss is a freeware or open source product.
Weblogic mostly relies on console.
JBoss is mostly based on file system modification like xml
files.
The user can change the console setting as per the requirement as Weblogic has the self-console.
JBoss is dependent on Tomcat as it does not have a self-console.
One can configure  data sources, JMS queues, and security realms as Weblogic offers web based administration console
JBoss does not have a web administration console. For example a Datasource can be configured either from the Command Line Interface or from the server main configuration file (standalone.xml/domain.xml).
The admin console is available as part of Weblogic installation.
The admin console JON has to be installed separately.
The unused services cannot be removed from the Weblogic.
The unused services can be removed from JBoss.
Weblogic provides JMS Clustering.
JBoss does not offer JMS Clustering.
It uses JDBC API for Database connectivity.
It uses jca-jdbc wrappers for Database connectivity.

Friday 6 September 2013

Purging SOA Suite 11g:- 

I was not able to delete all the instances from soa_infra schema.
I tried deleting , with ootb oracle purge script and by deleting  instances from em console. But it failed somehow!

So this is the purge script which solve our problem.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

spool soa11g_purge_script.log

set echo on
set verify on
set timing on

-- delete all instances older then 3 days
define days=3

alter session set current_schema=kim1_soainfra;
alter session set nls_date_format='yyyymmdd hh24mi';

variable cur_datetime varchar2(13)
exec select (sysdate - &days) into :cur_datetime from dual;

prompt Purging data until:
print cur_datetime
--
-- Purge the MEDIATOR data
--       
delete from mediator_case_instance  a where exists (select b.id from mediator_instance b where b.id = a.instance_id and b.created_time < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from mediator_audit_document a where exists (select b.id from mediator_instance b where b.id = a.instance_id and b.created_time < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from mediator_callback       a where exists (select b.id from mediator_instance b where b.id = a.instance_id and b.created_time < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from mediator_group_status   a where exists (select b.id from mediator_instance b where b.group_id = a.group_id and b.created_time < to_date(:cur_datetime, 'yyyymmdd hh24mi'));

delete from mediator_payload             where modify_date   < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from mediator_deferred_message    where creation_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from mediator_resequencer_message where creation_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from mediator_case_detail         where created_time  < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from mediator_correlation         where creation_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from mediator_instance            where created_time  < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
commit;

--
-- Purge the BPEL data
--       
delete from headers_properties          where modify_date   < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from ag_instance                 where creation_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from audit_counter               where ci_partition_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from audit_trail                 where ci_partition_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from audit_details               where ci_partition_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from ci_indexes                  where ci_partition_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from work_item                   where creation_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from wi_fault                    where creation_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from xml_document_ref a          where exists (select b.document_id from xml_document b where b.document_id = a.document_id and b.doc_partition_date < to_date(:cur_datetime, 'yyyymmdd hh24mi')); 
delete from xml_document                where doc_partition_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from document_dlv_msg_ref        where dlv_partition_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from document_ci_ref             where ci_partition_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from dlv_subscription            where ci_partition_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from dlv_message                 where receive_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from rejected_msg_native_payload where rm_partition_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from instance_payload            where created_time < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from test_details a              where exists (select b.cikey from cube_instance b where b.cikey = a.cikey and b.creation_date < to_date(:cur_datetime, 'yyyymmdd hh24mi')); 
delete from cube_scope                  where modify_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from cube_instance               where creation_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
commit;

--
-- Purge the BPM data
--       
delete from bpm_audit_query               where create_time < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from bpm_measurement_actions       where ci_partition_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from bpm_measurement_action_exceps where ci_partition_date < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from bpm_cube_auditinstance        where cipartitiondate < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from bpm_cube_taskperformance      where creationdate < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from bpm_cube_processperformance   where creationdate < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
commit;

--
-- Purge the WORKFLOW data
--       
delete from wftask_tl                 a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wftaskhistory             a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wftaskhistory_tl          a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wfcomments                a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wfmessageattribute        a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wfattachment              a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wfassignee                a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wfreviewer                a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wfcollectiontarget        a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wfroutingslip             a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wfnotification            a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wftasktimer               a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wftaskerror               a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wfheaderprops             a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wfevidence                a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wftaskassignmentstatistic a where exists (select b.taskid from wftask b where a.taskid = b.taskid and b.createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from wftaskaggregation           where taskcreateddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from wftask                      where createddate < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
commit;

--
-- Purge the COMPOSITE data
--       
delete from composite_sensor_value   where date_value    < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from composite_instance_assoc where created_time < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from attachment c             where exists (select a.key from attachment_ref a where a.key = c.key and exists (select b.ecid from composite_instance b where b.ecid = a.ecid and b.created_time < to_date(:cur_datetime, 'yyyymmdd hh24mi')));
delete from attachment_ref a         where exists (select b.ecid from composite_instance b where b.ecid = a.ecid and b.created_time < to_date(:cur_datetime, 'yyyymmdd hh24mi'));
delete from composite_instance_fault where created_time < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from reference_instance       where created_time < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from component_instance       where created_time < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 
delete from composite_instance       where created_time < to_date(:cur_datetime, 'yyyymmdd hh24mi'); 

commit;

--
-- Reclaim disk space
--
alter table mediator_case_instance enable row movement;
alter table mediator_case_instance shrink space;
alter table mediator_case_instance disable row movement;
alter table mediator_audit_document enable row movement;
alter table mediator_audit_document shrink space;
alter table mediator_audit_document disable row movement;
alter table mediator_callback enable row movement;
alter table mediator_callback shrink space;
alter table mediator_callback disable row movement;
alter table mediator_group_status enable row movement;
alter table mediator_group_status shrink space;
alter table mediator_group_status disable row movement;
alter table mediator_payload enable row movement;
alter table mediator_payload shrink space;
alter table mediator_payload disable row movement;
alter table mediator_deferred_message enable row movement;
alter table mediator_deferred_message shrink space;
alter table mediator_deferred_message disable row movement;
alter table mediator_resequencer_message enable row movement;
alter table mediator_resequencer_message shrink space;
alter table mediator_resequencer_message disable row movement;
alter table mediator_case_detail enable row movement;
alter table mediator_case_detail shrink space;
alter table mediator_case_detail disable row movement;
alter table mediator_correlation enable row movement;
alter table mediator_correlation shrink space;
alter table mediator_correlation disable row movement;
alter table mediator_instance enable row movement;
alter table mediator_instance shrink space;
alter table mediator_instance disable row movement;
alter table headers_properties enable row movement;
alter table headers_properties shrink space;
alter table headers_properties disable row movement;
alter table ag_instance enable row movement;
alter table ag_instance shrink space;
alter table ag_instance disable row movement;
alter table audit_counter enable row movement;
alter table audit_counter shrink space;
alter table audit_counter disable row movement;
alter table audit_trail enable row movement;
alter table audit_trail shrink space;
alter table audit_trail disable row movement;
alter table audit_details enable row movement;
alter table audit_details shrink space;
alter table audit_details disable row movement;
alter table ci_indexes enable row movement;
alter table ci_indexes shrink space;
alter table ci_indexes disable row movement;
alter table work_item enable row movement;
alter table work_item shrink space;
alter table work_item disable row movement;
alter table wi_fault enable row movement;
alter table wi_fault shrink space;
alter table wi_fault disable row movement;
alter table xml_document_ref enable row movement;
alter table xml_document_ref shrink space;
alter table xml_document_ref disable row movement;
alter table document_dlv_msg_ref enable row movement;
alter table document_dlv_msg_ref shrink space;
alter table document_dlv_msg_ref disable row movement;
alter table document_ci_ref enable row movement;
alter table document_ci_ref shrink space;
alter table document_ci_ref disable row movement;
alter table dlv_subscription enable row movement;
alter table dlv_subscription shrink space;
alter table dlv_subscription disable row movement;
alter table dlv_message enable row movement;
alter table dlv_message shrink space;
alter table dlv_message disable row movement;
alter table rejected_msg_native_payload enable row movement;
alter table rejected_msg_native_payload shrink space;
alter table rejected_msg_native_payload disable row movement;
alter table instance_payload enable row movement;
alter table instance_payload shrink space;
alter table instance_payload disable row movement;
alter table test_details enable row movement;
alter table test_details shrink space;
alter table test_details disable row movement;
alter table cube_scope enable row movement;
alter table cube_scope shrink space;
alter table cube_scope disable row movement;
alter table cube_instance enable row movement;
alter table cube_instance shrink space;
alter table cube_instance disable row movement;
alter table bpm_audit_query enable row movement;
alter table bpm_audit_query shrink space;
alter table bpm_audit_query disable row movement;
alter table bpm_measurement_actions enable row movement;
alter table bpm_measurement_actions shrink space;
alter table bpm_measurement_actions disable row movement;
alter table bpm_measurement_action_exceps enable row movement;
alter table bpm_measurement_action_exceps shrink space;
alter table bpm_measurement_action_exceps disable row movement;
alter table bpm_cube_auditinstance enable row movement;
alter table bpm_cube_auditinstance shrink space;
alter table bpm_cube_auditinstance disable row movement;
alter table bpm_cube_taskperformance enable row movement;
alter table bpm_cube_taskperformance shrink space;
alter table bpm_cube_taskperformance disable row movement;
alter table bpm_cube_processperformance enable row movement;
alter table bpm_cube_processperformance shrink space;
alter table bpm_cube_processperformance disable row movement;
alter table wftask_tl enable row movement;
alter table wftask_tl shrink space;
alter table wftask_tl disable row movement;
alter table wftaskhistory enable row movement;
alter table wftaskhistory shrink space;
alter table wftaskhistory disable row movement;
alter table wftaskhistory_tl enable row movement;
alter table wftaskhistory_tl shrink space;
alter table wftaskhistory_tl disable row movement;
alter table wfcomments enable row movement;
alter table wfcomments shrink space;
alter table wfcomments disable row movement;
alter table wfmessageattribute enable row movement;
alter table wfmessageattribute shrink space;
alter table wfmessageattribute disable row movement;
alter table wfattachment enable row movement;
alter table wfattachment shrink space;
alter table wfattachment disable row movement;
alter table wfassignee enable row movement;
alter table wfassignee shrink space;
alter table wfassignee disable row movement;
alter table wfreviewer enable row movement;
alter table wfreviewer shrink space;
alter table wfreviewer disable row movement;
alter table wfcollectiontarget enable row movement;
alter table wfcollectiontarget shrink space;
alter table wfcollectiontarget disable row movement;
alter table wfroutingslip enable row movement;
alter table wfroutingslip shrink space;
alter table wfroutingslip disable row movement;
alter table wfnotification enable row movement;
alter table wfnotification shrink space;
alter table wfnotification disable row movement;
alter table wftasktimer enable row movement;
alter table wftasktimer shrink space;
alter table wftasktimer disable row movement;
alter table wftaskerror enable row movement;
alter table wftaskerror shrink space;
alter table wftaskerror disable row movement;
alter table wfheaderprops enable row movement;
alter table wfheaderprops shrink space;
alter table wfheaderprops disable row movement;
alter table wfevidence enable row movement;
alter table wfevidence shrink space;
alter table wfevidence disable row movement;
alter table wftaskassignmentstatistic enable row movement;
alter table wftaskassignmentstatistic shrink space;
alter table wftaskassignmentstatistic disable row movement;
alter table wftaskaggregation enable row movement;
alter table wftaskaggregation shrink space;
alter table wftaskaggregation disable row movement;
alter table wftask enable row movement;
alter table wftask shrink space;
alter table wftask disable row movement;
alter table composite_sensor_value enable row movement;
alter table composite_sensor_value shrink space;
alter table composite_sensor_value disable row movement;
alter table composite_instance_assoc enable row movement;
alter table composite_instance_assoc shrink space;
alter table composite_instance_assoc disable row movement;
alter table attachment enable row movement;
alter table attachment shrink space;
alter table attachment disable row movement;
alter table attachment_ref enable row movement;
alter table attachment_ref shrink space;
alter table attachment_ref disable row movement;
alter table composite_instance_fault enable row movement;
alter table composite_instance_fault shrink space;
alter table composite_instance_fault disable row movement;
alter table reference_instance enable row movement;
alter table reference_instance shrink space;
alter table reference_instance disable row movement;
alter table component_instance enable row movement;
alter table component_instance shrink space;
alter table component_instance disable row movement;
alter table composite_instance enable row movement;
alter table composite_instance shrink space;
alter table composite_instance disable row movement;

alter table audit_details modify lob (bin) (shrink space);
alter table composite_instance_fault modify lob (error_message) (shrink space);
alter table composite_instance_fault modify lob (stack_trace) (shrink space);
alter table cube_scope modify lob (scope_bin) (shrink space);
alter table reference_instance modify lob (error_message) (shrink space);
alter table reference_instance modify lob (stack_trace) (shrink space);
alter table test_definitions modify lob (definition) (shrink space);
alter table wi_fault modify lob (message) (shrink space);
alter table xml_document modify lob (document) (shrink space);

alter index ad_pk rebuild online;
alter index at_pk rebuild online;
alter index ci_creation_date rebuild online;
alter index ci_custom3 rebuild online;
alter index ci_ecid rebuild online;
alter index ci_name_rev_state rebuild online;
alter index ci_pk rebuild online;
alter index composite_instance_cidn rebuild online;
alter index composite_instance_co_id rebuild online;
alter index composite_instance_created rebuild online;
alter index composite_instance_ecid rebuild online;
alter index composite_instance_id rebuild online;
alter index composite_instance_state rebuild online;
alter index cs_pk rebuild online;
alter index dm_conversation rebuild online;
alter index dm_pk rebuild online;
alter index doc_dlv_msg_guid_index rebuild online;
alter index doc_store_pk rebuild online;
alter index ds_conversation rebuild online;
alter index ds_conv_state rebuild online;
alter index ds_fk rebuild online;
alter index ds_pk rebuild online;
alter index header_properties_pk rebuild online;
alter index instance_payload_key rebuild online;
alter index reference_instance_cdn_state rebuild online;
alter index reference_instance_co_id rebuild online;
alter index reference_instance_ecid rebuild online;
alter index reference_instance_id rebuild online;
alter index reference_instance_state rebuild online;
alter index reference_instance_time_cdn rebuild online;
alter index state_type_date rebuild online;
alter index wf_crdate_cikey rebuild online;
alter index wf_crdate_type rebuild online;
alter index wf_fk2 rebuild online;
alter index wifault_pk rebuild online;
alter index wi_expired rebuild online;
alter index wi_key_crdate_state rebuild online;
alter index wi_pk rebuild online;
alter index wi_stranded rebuild online;
alter index xml_doc_reference_pk rebuild online

spool off

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I hope it helps!

Regards
Vipul Verma