Oracle Recyclebin: differenze tra le versioni
Jump to navigation
Jump to search
(Creata pagina con "<pre> 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...") |
Nessun oggetto della modifica |
||
| Riga 39: | Riga 39: | ||
/ |
/ |
||
</pre> |
</pre> |
||
[[Categoria:Database]] |
|||
Versione delle 14:49, 14 giu 2016
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;
/