휴지통에서 원하는 날짜만큼 명령어로 딱딱 지우는 명령어는 없고 명령어로 조건을 줘서 스크립트를 뽑아내는 방법이 있긴 하다.

 

1. 7일꺼만 남기고 다 지우기

 

spool purge_table_older_than_7_days.sql
select 'purge table '||owner||'."'||OBJECT_NAME||'";'
from dba_recyclebin where type='TABLE' and to_date(droptime,'YYYY-MM-DD:HH24:MI:SS')<sysdate-7;
spool off;

 

2. 5분 보다 오래된거 다 지우기

 

spool purge_table_older_than_5_minutes.sql
select 'purge table '||owner||'."'||OBJECT_NAME||'";'
from dba_recyclebin where type='TABLE' and to_date(droptime,'YYYY-MM-DD:HH24:MI:SS')<sysdate-(5/(24*60));
spool off;

spool purge_table_older_than_5_min.txt
@purge_table_older_than_5_minutes.sql
spool off;

 

------------------------------------------------------------

 

나머지 조건들은 필요에 따라 수정해서 상황에 맞게 쓰면 될듯.

Posted by pat98

05-20 07:05
Flag Counter
Yesterday
Today
Total

글 보관함

최근에 올라온 글

달력

 « |  » 2024.5
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

최근에 달린 댓글