ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

【达梦数据库】查看pesg回滚段信息的视图和SQL

2026/9/21 8:04:37 拓冰建站 浏览量
【达梦数据库】查看pesg回滚段信息的视图和SQL

一些达梦回滚段是使用情况的查询SQL,供排查“回滚记录版本太旧,无法获取用户记录” 等类似问题时使用

视图名说明主库备库
v$pseg_items显示回滚系统中当前回滚项信息(回滚线程的工作信息)总行数=WORKER_THREADS+1查询 no rows
v$pseg_sys显示当前回滚段信息(概览)总行数为1总行数为1 只有extent_size tab_hash_size obj_hash_size 非0
v$pseg_commit_trx显示回滚项中已提交但未 PURGE 的事务信息(需要PSEG 的事务信息)需要排除fpa_file_id = -1 and fpa_page_no = -1 的情况,屏蔽没有修改数据的事务查询 no rows
V$PSEG_PAGE_INFO
V$PURGE显示当前 PURGE 回滚段信息(待PURGE 的事务总个数)V$PURGE.obj_num= v$pseg_sys.obj_countobj_num= 0
V$PURGE_PSEG_OBJ显示 PURGE 系统中,待 PURGE 的所有 PSEG 对象信息(待PURGE 的事务号)总行数= V$PURGE.obj_num= v$pseg_sys.obj_count查询 no rows
V$PURGE_PSEG_TAB显示待 PURGE 表信息(待PURGE 的事务和表的关联信息)查询 no rows
/* 查回滚信息  用于回滚记录版本太旧,无法获取用户记录排查 */
select pseg_trx.*,item.* from v$pseg_items item join (
select item_nth,substr(wm_Concat(trx_id),0,100) trx_ids,count(trx_id) trx_count,min(cmt_time) min_commit_time,max(cmt_time) max_commit_time from v$pseg_commit_trx where fpa_file_id>=0 and fpa_page_no>=0 group by item_nth) pseg_trx 
on item.nth=pseg_trx.item_nth;/* 统计 insert/delete 操作影响表行数*/
select item_nth,substr(wm_Concat(trx.trx_id),0,100) trx_ids,substr(wm_Concat(TAB.tab_ids),0,100) tab_ids,count(trx.trx_id) trx_count,min(cmt_time),max(cmt_time),sum(tab.row_affect) row_affect from v$pseg_commit_trx trx join (select trx_id,SUBSTR(wm_concat(tab_id)) tab_ids,sum(abs(row_count) row_affect from V$PURGE_PSEG_TAB group by trx_id) TAB on tab.trx_id=trx.trx_idwhere fpa_file_id>=0 and fpa_page_no>=0 group by item_nth;select * from sysobjects where id=?;select item_nth,substr(wm_Concat(trx.trx_id),0,100) trx_ids,substr(wm_Concat(TAB.tab_ids),0,100) tab_ids,count(trx.trx_id) trx_count,min(cmt_time),max(cmt_time),sum(tab.row_affect) row_affect from v$pseg_commit_trx trx join (select trx_id,SUBSTR(wm_concat(tab_id)) tab_ids,sum(abs(row_count) row_affect from V$PURGE_PSEG_TAB where tab_id=? group by trx_id) TAB on tab.trx_id=trx.trx_idwhere fpa_file_id>=0 and fpa_page_no>=0 group by item_nth;