Vous êtes sur la page 1sur 4

Purging of unwanted records from ASO_ORDER_FEEDBACK_T queue table

By: Rahul Gupta


ecengineer84@gmail.com

Overview:
The ASO.ASO_ORDER_FEEDBACK_T table contains millions of records. It contains record for two consumers
OKS & OZF. Cousmer OZF record has a status of 'READY'. This is not correct. Query to identify the
Consumers (Product) of the queue

SELECT q.consumer_name,q.msg_state, COUNT(*) FROM


aso.aq$aso_order_feedback_t q GROUP BY q.consumer_name, q.msg_state
order by q.consumer_name, q.msg_state

CONSUMER_NAME MSG_STATE COUNT(*)


------------------------------ ------------- ----------
OKS PROCESSED 72269
OKS READY 1905
OZF READY 2160680

As per document 181410.1 all the inactive cosumer can be purge. Consumer OZF is inactive in our enviorment.
Thus it can be purged.

How to find the inactive consumer ? Log in to Oracle Forms using the 'Quoting Sales Manager' responsibility
and navigate to QuickCodes.Query for the lookup entries in the lookup 'ASO_ORDER_FEEDBACK_CRM_APPS'.
Make sure each entry is active and (preferably) has an old start-date and no end-date. But OZF has an old end-date,
thus it’s inactive. Please refer to to the scrren shot below.
How to purge:

a.) Create procedure CLEAN_QUEUE procedure in apps schema. The purpose of this utility is to change the status
from READY to PROCESSED for Consumers that are NOT being used. This will allow the database background
process to purge these rows.

sqlplus apps
@clean_aq1lck [Refer doc 181410.1]

C:\clean_aq1lck.sql

b) Create maintenance procedure aqcoalesce in sys schema.

Sqlplus “ /as sysdba”


@aqcoalesce [ Refer to doc 271855.1 for aqcolesce.sql ]

aqcoalesce.sql

c) Before executing the CLEAN_QUEUE procedure, need to make sure queues are started. Run the following sql to
check whether the queues for ASO_ORDER_FEEDBACK are started or not.

select name, queue_table, enqueue_enabled, dequeue_enabled from dba_queues where name like 'ASO_O%';

It’ll returned 4 rows. If the queues are not started then run the following to start the
ASO_ORDER_FEEDBACK_T queues

execute dbms_aqadm.start_queue('ASO.ASO_OF_Q', TRUE, TRUE);


execute dbms_aqadm.start_queue('ASO.ASO_OF_Q_E', FALSE,TRUE);
execute dbms_aqadm.start_queue('ASO.ASO_OF_EXCP_Q', TRUE, TRUE);
execute dbms_aqadm.start_queue('ASO.ASO_OF_EXCP_Q_E', FALSE,TRUE);:

d). Remove the end_date for the cousmer OZF from lookup 'ASO_ORDER_FEEDBACK_CRM_APPS'

This can be verified from the query below :


select lookup_type, lookup_code, enabled_flag, END_DATE_ACTIVE
from apps.FND_LOOKUP_VALUES
where lookup_type = 'ASO_ORDER_FEEDBACK_CRM_APPS' and lookup_code='OZF' and
END_DATE_ACTIVE is not null;

This will return no rows.

e.) Now run the purging procedure

SQL> conn apps


Enter password:
Connected.
execute clean_queue('OZF');
commit;

f.) Run the maintenance procdure

SQL> conn / as sysdba


Connected.
exec aqcoalesce;

We have customized the purging procedure clean_queue to do the purging in batckes of 100K. Thus we need to
do the step E & F 22 times.

g.) Remove the customer OZF from the lookup 'ASO_ORDER_FEEDBACK_CRM_APPS'

Defragmentation:

1. Create the defragmentation procedure

Sqlplus “ /as sysdba”


@move_aqt.plb

Move_aqt.plb
[Refer to doc 304522.1 for move_aqt.plb]

2. Check the size of queue table before defragmentation

select sum(bytes)/1024/1024 from dba_segments where segment_name='ASO_ORDER_FEEDBACK_T';

3. Run the defragmentation procedure.

exec move_aqt.move('ASO','ASO_ORDER_FEEDBACK_T');

4. Check the size of table after defragmentation

select sum(bytes)/1024/1024 from dba_segments where segment_name='ASO_ORDER_FEEDBACK_T';

5. Run utrlp.sql to compile the invalids

References:
181410.1 - Quoting/Order Capture Order Feedback Queue
3-1678838781 : Purgin of OZF customer of ASO_ORDER_FEEDBACK_T table taking a very long time
421474.1 : How do I reduce the High Watermark (HWM) of Advanced Queueing objects?
271855.1 - Procedure to manually Coalesce all the IOTs/indexes Associated with Advanced Queueing
tables to maintain Enqueue/Dequeue performance, reduce QMON CPU usage and Redo generation

Vous aimerez peut-être aussi