Recycle Bin automatic purging
- This script creates a job that automatically purges all objects (tables) in recycle bin that are older than 7 days (edit the default in the installation script if necessary)
- Job, by default, runs every day at 7 a.m.
Installaion
$ cd ~/production/recyclebin
$ sqlplus system@<db_name> @purge_old_recyclebin
- please ignore the error of dropping non-existing job
Enabling/Disabling
- connect to the target database
- to disable automatic purging please execute the following command:
exec DBMS_SCHEDULER.DROP_JOB('SYSTEM.PURGE_OLD_RECYCLEBIN_JOB',TRUE);
- to enable it (please set BYHOUR=... parameter to the hour the purging should start - important in streams environment to allow it to run first on the capture side and then after few hours on the apply side):
exec DBMS_SCHEDULER.CREATE_JOB('SYSTEM.PURGE_OLD_RECYCLEBIN_JOB','PLSQL_BLOCK','PURGE_OLD_RECYCLEBIN(7);',0,sysdate,'FREQ=DAILY;BYDAY=MON,TUE,WED,THU,FRI;BYHOUR=7;BYMINUTE=0;BYSECOND=0;',NULL,'DEFAULT_JOB_CLASS',TRUE,TRUE,NULL);