In this Document
APPLIES TO:Oracle Database - Enterprise Edition - Version 10.2.0.1 to 11.2.0.3 [Release 10.2 to 11.2]Information in this document applies to any platform. GOALHow to Purge Apply Spilled Transactions. SOLUTIONApply Spill Purging Apply Spill
* Note this procedure should only be used under the guidance of Support. Purging a transaction from the apply spill table can result in data inconsistencies in the user tables (ORA-1403 or other apply errors). This should not be done unless the customer completely understands the impact of this action. When the fix for unpublished
Bug 5736709 is implemented _ignore_transaction will be sufficient to ignore any kind of transaction whether it is spilled or not.
* The following procedure is written to purge just one transaction only, if there are a large number of spilled transactions and you have reached the decision of deleting them all, you can automate the steps like the following : Stop all apply processes. For this example, we have one apply process and the apply name is APP_TEST exec dbms_apply_adm.stop_apply('APP_TEST'); - get count(transactions) from the apply_spill_table ; - using a for loop from 1 to number of spilled txns - perform the steps inside the loop : from step 3 to step 7 To purge a transaction from the apply spill table, use the following process 1. Download the PLB file: streams_purge_apply_spill_txn.plb 2. Load this procedure into the SYS schema for the target database using sqlplus. This creates the procedure purge_spill_txn in the SYS schema.
connect / as sysdba
@streams_purge_apply_spill_txn.plb
The procedure signature is purge_spill_txn( apply_name , ignore_txn_id , delete_only ) where the parameters have the following meaning 3. Check the DBA_APPLY_SPILL_TXN view to identify the transaction id to remove
select apply_name, xidusn||'.'||xidslt||'.'||xidsqn txn_id, first_scn, first_message_create_time, message_count, spill_creation_time from dba_apply_SPILL_TXN;
exec dbms_apply_adm.stop_apply('APP_TEST');
exec dbms_apply_adm.set_parameter('APP_TEST','_ignore_transaction','10.22.333');
IGNORE_TRANSACTION is normal parameter with 11.2 Reference
Document 1355121.1
exec sys.purge_spill_txn('APP_TEST','10.22.333');
select apply_name, xidusn||'.'||xidslt||'.'||xidsqn txn_id, first_scn, first_message_create_time, message_count, spill_creation_time from dba_apply_SPILL_TXN;
exec dbms_apply_adm.start_apply('APP_TEST');
exec dbms_apply_adm.set_parameter('APP_TEST','_ignore_transaction',null);
Sometimes, apply-spilled transactions are not cleaned up and get stuck in the spill table forever even if the transaction has definitely been applied ,this is very likely to be the unpublished Bug 9825314.
If the transaction has definitely been applied there is no need to use the _ignore_transaction parameter so we can more easily remove a large number of spilled transactions when the Apply process has been shut down. --This will only removed spilled transactions which have DEFINITELY been applied. --This is the reason that we do not need to use the _ignore_transaction parameter because the commit_scn in streams$_apply_milestone is equivalent to APPLIED_MESSAGE_NUMBER which is the point to which we have DEFINITELY applied. ex: spool <directory>/spillpurge.lst set serveroutput on size 10000000 declare txid varchar2(50); maxscn number; counter number := 0; cursor c is select xidusn, xidslt, xidsqn from streams$_apply_spill_txn where commit_scn < maxscn and applyname = 'APP_TEST'; begin select commit_scn into maxscn from streams$_apply_milestone; dbms_output.put_line ('Starting the purge process'); for r in c loop txid := r.xidusn||'.'||r.xidslt||'.'||r.xidsqn; sys.purge_spill_txn('APP_TEST',txid); dbms_output.put_line ('Purging transaction...'||txid); commit; counter := counter + 1; end loop; dbms_output.put_line ('Transactions purged = '||counter); dbms_output.put_line ('Purge process finished'); end; / To permanently resolve this issue apply the fix for unpublished Bug 9825314. Bug 9825314 Apply does not clean up spilled messages is fixed in 12.1.0.1 and 11.2.0.3. |
How to Purge Apply Spilled Transactions in Streams Environment. (Doc ID 472440.1)
最新推荐文章于 2023-03-25 22:31:23 发布