soa_dehyd_v1.ksh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/ksh
  2. # =================================================================================================================
  3. # Title: soa_dehyd.ksh
  4. # Author: Richard Wilson
  5. # Date: 5th June 2014
  6. # Description: Parallel purges the SOA instances.
  7. # -----------------------------------------------------------------------------------------------------------------
  8. export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
  9. export ORACLE_SID=`echo ${1} | tr [:lower:] [:upper:]`
  10. export USERNAME=`echo ${ORACLE_SID} | tr [:upper:] [:lower:]`
  11. if [ ${#} -eq 1 ]; then
  12. ${ORACLE_HOME}/bin/sqlplus -s ${USERNAME}_soainfra/newr00t@${ORACLE_SID} <<-EOF
  13. set serveroutput on;
  14. DECLARE
  15. l_min_creation_date TIMESTAMP := systimestamp - INTERVAL '10' YEAR;
  16. l_max_creation_date TIMESTAMP := systimestamp - INTERVAL '1' HOUR;
  17. l_retention_period TIMESTAMP := systimestamp - INTERVAL '1' HOUR;
  18. l_batch_size integer := 25000;
  19. l_max_runtime integer := 5;
  20. BEGIN
  21. ${USERNAME}_soainfra.soa.delete_instances(min_creation_date => l_min_creation_date,
  22. max_creation_date => l_max_creation_date,
  23. batch_size => l_batch_size,
  24. max_runtime => l_max_runtime,
  25. retention_period => l_retention_period,
  26. purge_partitioned_component => false);
  27. commit;
  28. END;
  29. /
  30. EOF
  31. else
  32. echo "Usage: soa_dehyd_v1.ksh ORACLE_SID."
  33. fi
  34. # End of File
  35. # =================================================================================================================