预估 PURGE DBA_RECYCLEBIN 执行时间 v$SESSION_LONGOPS 6 秒限制

Applies To

All Users

Summary

This note provides different options to estimate the time required to Purge Large Number of Objects from Recycle Bin.

You can purge recycle bin using command: PURGE DBA_RECYCLEBIN

Solution

You can use any of the following methods to estimate the time for the purge :

1- Run the following statement at 5 minutes interval after the purge command execution , to estimate the time needed :
SQL> select sum(SPACE) from DBA_RECYCLEBIN;

then execute :

SQL>PURGE DBA_RECYCLEBIN;

Then after 5 minutes execute the select statement again :

SQL: select sum(SPACE) from DBA_RECYCLEBIN;

Now you know the difference between the first and the second select statement output , you can figure the time remaining .

For example if the first statement returned 200 and after 5 minutes it returned 160 , then it will finish in about 25 Minute.
Column SPACE in DBA_RECYCLEBIN is the Number of Database blocks used by the object .

or

2- You can monitor the progress of the purge by querying the view V$SESSION_LONGOPS.

V$SESSION_LONGOPS Displays the status of various operations that run for longer than 6 seconds (in absolute time).

TIMED_STATISTICS Must equal true and statistics_level = TYPICAL or ALL for V$SESSION_LONGOPS to be populated .

You should get the SID and SERIAL# for the session that will be executing the purge command ,

then run the PURGE DBA_RECYCLEBIN; command

then from another session run the following :
select SOFAR,TOTALWORK,SOFAR,UNITS,TIME_REMAINING from V$SESSION_LONGOPS where SID= and SERIAL#= ;

The column 'TOTALWORK' shows the total amount of work, of which the 'SOFAR' amount has been done up until now.

Also TIME_REMAINING column is the Estimate (in seconds) of time remaining for the operation to complete

You can then use it to estimate how much longer will your export/import take.

Attachments :

相关推荐
我是一颗柠檬7 小时前
【MySQL全面教学】MySQL面试高频考点汇总Day15(2026年)
数据库·后端·mysql·面试
凯瑟琳.奥古斯特8 小时前
高阶子查询题目精炼
开发语言·数据库·python·职场和发展·数据库开发
身如柳絮随风扬8 小时前
数据库读写分离:从原理到实战,构建高并发系统
数据库·mysql
提笔了无痕9 小时前
RAG存储策略中.md格式的切片与存储怎么处理
数据库·ai·rag
陳土9 小时前
DuckDB精读——基于Getting started with DuckDB
数据库·oracle
凯瑟琳.奥古斯特10 小时前
数据库原理选择题精选
数据库·python·职场和发展
曹牧10 小时前
C#:主线程能够捕获到子线程中的异常
开发语言·数据库·c#
朝阳58111 小时前
MongoDB 副本集从零搭建到生产可用
数据库·mongodb
雨辰AI11 小时前
SpringBoot3 整合达梦 DM9 超详细入门实战|从零搭建可直接上线
数据库·微服务·架构·政务