Question: How do I schedule a
periodic purge of the items in my recycle bin? I want
to automatically remove all recycle bin tables that were
dropped more then 30 days old.
You must always be careful when emptying the recycle bin,
and many DBA's will manually inspect all recycle bin entries
before purging the recycle bin. For more details on
purging from the recycle bin, see my important notes on
recycle bin management.
Scheduled purging of the recycle bin
Note that for autoextend tablespaces, objects
are purged from the recycle bin to reclaim space before any
datafiles are extended. The following script will identify all tables that were
dropped within the past 30 days, and this script can be used
to purge all tables in the recycle bin that are over 30 days
old. This script can be scheduled to run daily via
dbms_scheduler or via a crontab.
This script is for dropped tables. but it can be modified
for other schema objects.
'purge table "' || owner ||
'"."' || object_name || '";'
can_purge = 'YES'
type = 'TABLE'
< sysdate - 30
order by 1, 2;
-- Inspect the runme.sql output