预估 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 :

相关推荐
倔强的石头_2 天前
《Kingbase护城河》——数据库存储空间全景探测与精细化瘦身实战
数据库
冬奇Lab3 天前
每日一个开源项目(第134篇):Zvec - 阿里开源的嵌入式向量数据库,向量搜索界的 SQLite
数据库·人工智能·llm
ClouGence3 天前
Oracle CDC 架构优化:从主库直连到 DataGuard 备库同步
数据库·后端·oracle
无响应de神3 天前
三、用户与权限管理
数据库·mysql
麦聪聊数据4 天前
数据服务化时代:企业数据能力输出的核心路径
数据库
shushangyun_4 天前
2026年快消品B2B系统推荐:支持终端门店订货、促销政策自动化的工具?
java·运维·网络·数据库·人工智能·spring·自动化
DARLING Zero two♡4 天前
【MySQL数据库】数据类型与表约束
数据库·mysql
曹牧4 天前
Oracle EXPLAIN PLAN
数据库·oracle
BD_Marathon4 天前
SQL学习指南——视图
数据库·sql
活宝小娜4 天前
mysql详细安装教程
数据库·mysql·adb