Oracle Recyclebin: differenze tra le versioni
Jump to navigation
Jump to search
Nessun oggetto della modifica |
Nessun oggetto della modifica |
||
Riga 42: | Riga 42: | ||
[[Categoria:Database]] |
[[Categoria:Database]] |
||
[[Categoria:Oracle]] |
Versione delle 10:29, 22 set 2017
begin for c1 in (select owner,type,OBJECT_NAME from dba_recyclebin where to_date(DROPTIME,'YYYY-MM-DD:HH24:MI:SS') < sysdate-3 and CAN_PURGE='YES') loop begin dbms_output.put_line(c1.object_name); execute immediate 'purge ' || c1.type || ' ' || c1.owner || '."' || c1.object_name || '"'; exception when others then null; end; end loop; end; /
BEGIN DBMS_SCHEDULER.create_job ( job_name => 'purge_recyclebin_3days', job_type => 'PLSQL_BLOCK', job_action => ' begin for c1 in (select owner,type,OBJECT_NAME from dba_recyclebin where to_date(DROPTIME,''YYYY-MM-DD:HH24:MI:SS'') < sysdate-3 and CAN_PURGE=''YES'') loop begin execute immediate ''purge '' || c1.type || '' '' || c1.owner || ''."'' || c1.object_name || ''"''; exception when others then null; end; end loop; end; ', start_date => SYSTIMESTAMP, repeat_interval => 'freq=daily; byhour=0; byminute=0; bysecond=0;', enabled => TRUE); END; /