热门标签 | HotTags
当前位置:  开发笔记 > 数据库 > 正文

Oracleundo表空间大小估算

(UR)UNDO_RETENTIONinseconds(UPS)Numberofundodatablocksgeneratedpersecond(DBS)Overheadvariesbasedonexte

(UR) UNDO_RETENTION in seconds (UPS) Number of undo data blocks generated per second (DBS) Overhead varies based on exte

(UR) UNDO_RETENTION in seconds
(UPS) Number of undo data blocks generated per second
(DBS) Overhead varies based on extent and file size (db_block_size)

UndoSpace = [UR * (UPS * DBS)] + (DBS * 24)


上面的公式中,,第1、3个参数都可以轻松的从参数文件中得到:
SQL> show parameter undo_retention

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_retention integer 5400
SQL> show parameter db_block_size

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_block_size integer 8192

现在重要的是要确定第2个参数:每秒钟生成undo block的总数,可以从 V$UNDOSTAT 中得到。

每秒生成的UNDO量:
SQL> SELECT (SUM(undoblks))/ SUM((end_time - begin_time) * 86400) FROM v$undostat;

(SUM(UNDOBLKS))/SUM((END_TIME-BEGIN_TIME)*86400)
--------------------------------------------------------------
117.97590055

正常估算值:
SELECT (UR * (UPS * DBS)) + (DBS * 24) AS "Bytes"
FROM (SELECT value AS UR FROM v$parameter WHERE name = 'undo_retention'),
(SELECT (SUM(undoblks)/SUM(((end_time - begin_time)*86400))) AS UPS FROM v$undostat),
(select block_size as DBS from dba_tablespaces where tablespace_name=
(select upper(value) from v$parameter where name = 'undo_tablespace'));

最大值估算:
SELECT (UR * UPS * DBS + DBS * 24) / 1024 / 1024 AS "undo size(M)"
FROM (SELECT value AS UR FROM v$parameter WHERE name = 'undo_retention'),
(SELECT max(undoblks / ((end_time - begin_time) * 24 * 3600)) AS UPS FROM v$undostat),
(SELECT value AS DBS FROM v$parameter WHERE name = 'db_block_size');

建议在业务量繁重的那一天进行统计,而将UNDO表空间大小设为最大估算值以上。

说明:本文整理于How To Size UNDO Tablespace For Automatic Undo Management [ID 262066.1]


推荐阅读
author-avatar
hashico_983
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有