There might be severe problems if the bulk number of rows are deleted fromt the production table. As this will lock the table in shared mode. And resource of the server will be used, offcourse it will use the UNDO tablespace heavily.
Following is the procedure which can be used to delete the bulk rows in batches on certain conditions. Also it will run in loops which can be controlled and also once it will delete the records it will put the message into purge_history table.
declare
type table_rowid_Array is table of rowid index by binary_integer;
l_rids table_rowid_Array;
v_counter number := 0;
v_counter_total number := 0;
v_id_counter number := 0;
begin
for i in 1 .. 500
loop
v_id_counter := i;
select rowid
bulk collect into l_rids
from BIG_LOG_TABLE where log_date < '1-JUN-2008' and rownum < 25001;
for i in 1 .. l_rids.count
loop
delete from BIG_LOG_TABLE where rowid = l_rids(i);
v_counter := v_counter +1 ;
end loop;
dbms_output.put_line( v_counter ' rows deleted' );
v_counter_total := v_counter_total + v_counter;
v_counter := 0;
insert into purge_history values (v_id_counter,v_counter_total,sysdate,BIG_LOG_TABLE );
commit;
end loop;
dbms_output.put_line( v_counter_total ' total rows deleted' );
end;
This blog contains different things for Oracle DBA, APPS DBA and Middleware technologies. All these things should be tested first on test environments before applying in the Prod environments, please follow the standard Change control to apply all the PreProd and Prod changes. Also to make this blog more useful, please give your comments and share your experience. Thanks
Search This Blog
Subscribe to:
Post Comments (Atom)
Oracle EBS Cloud manager deployment on OCI
Please follow the Oracle support document. Deploying Oracle E-Business Suite Cloud Manager Version 20.1.1.X on Oracle Cloud Infrastructure ...
-
Introduction: We use EMC BCV feature to clone our production database, and it was all working fine, but suddenly we started getting the erro...
-
Introduction: How to create a second amdin user for Oracle Application APEX. CookBook: 1- unlock the account FLOWS_030000 and login with FLO...
-
Oracle 12c Installer error - [INS-10102] Installer initialization failed - no oraInstaller in java.library.path - make sure oraInst.lo...
No comments:
Post a Comment