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

相关推荐
IvorySQL27 分钟前
PostgreSQL 日报|布尔列 NOT 选择率估算偏高(12 月 4 日)
数据库·postgresql
老一岁30 分钟前
Redis事务_锁_持久化_主从哨兵
linux·数据库·redis
PaperData1 小时前
1970-2025年省级二氧化碳排放量面板数据
数据库
RestCloud2 小时前
ETLCloud中不同表名之间的数据库数据同步
数据库·etl·数据处理·etlcloud·数据传输·数据集成平台
少陽君3 小时前
如何在 PVE 中下载并导入 Ubuntu 24.04 Server 云镜像
linux·数据库·ubuntu
扑火的小飞蛾4 小时前
生产级SOP:MySQL二进制安装与多实例部署实战(5.6/5.7/8.0/8.4全版本)
数据库·mysql·adb
Pniubi4 小时前
数据迁移里的四个核心位点:分清持久、实时与一次性水位
数据库·binlog·迁移
小张成长计划..5 小时前
【Linux】44:五种IO模型与非阻塞IO
java·服务器·数据库
这里是北京5 小时前
SQL 窗口函数 LAST_VALUE 取错值?从设备巡检报表看懂 ROWS 与 RANGE
数据库·sql
箓维6 小时前
MySQL_表的约束
android·数据库·mysql