[转帖]11G Undo使用率很高问题
11G Undo使用率很高问题
http://blog.itpub.net/12679300/viewspace-1164916/
事件背景:
公司的ERP数据库是11.2.0.3的版本,最近观察到一个奇怪的现象就是数据库的UNDO表空间的使用率一直居高不下;UNDO表空间的大小为76G,但是使用率一直保持着70%以上。
趁此机会又重新学习了一遍Undo的知识,最终解决了这个问题,以下是解决过程中整理的文档。(以下都是从Oracle联机文档里面找到的)
一、What Is Undo?Oracle Database creates and manages information that is used to roll back, or undo, changes to the database. Such information consists of records of the actions of transactions, primarily before they are committed. These records are collectively referred to as undo.Undo records are used to:Roll back transactions when a ROLLBACK statement is issued ------用于事务的回滚Recover the database ------用于数据库的恢复Provide read consistency -------提供读一致性Analyze data as of an earlier point in time by using Oracle Flashback Query -----用于数据库的闪回查询Recover from logical corruptions using Oracle Flashback features -----通过闪回恢复数据库的逻辑错误When a ROLLBACK statement is issued, undo records are used to undo changes that were made to the database by the uncommitted transaction. During database recovery, undo records are used to undo any uncommitted changes applied from the redo log to the data files. Undo records provide read consistency by maintaining the before image of the data for users who are accessing the data at the same time that another user is changing it.
二、影响UNDO的几个参数
通过语句show parameter undo,可以找到影响Undo表空间的三个参数 1、_in_memory_undo
了解ORACLE参数设计的高手一看就知道_in_memory_undo,前面有"_"参数是ORACLE的隐藏参数;
参考链接:http://www.hellodba.com/reader.php?ID=31&lang=CN
有兴趣的朋友可以深入研究。
2、undo_management
Property |
Description |
Parameter type |
String |
Syntax |
UNDO_MANAGEMENT = { MANUAL | AUTO } |
Default value |
AUTO |
Modifiable |
No |
Basic |
No |
Oracle RAC |
Multiple instances must have the same value. |
UNDO_MANAGEMENT specifies which undo space management mode the system should use. When set to AUTO, the instance starts in automatic undo management mode. In manual undo management mode, undo space is allocated externally as rollback segments
undo的管理其实也是Oracle数据库管理进步的一个见证,早期的oracle的undo的管理都是手动的,随着软件的发展undo的管理变成自动,专业名词 AUM(Automatic UndoManagement),该技术为DBA又减轻了不少工作(DBA的工作越来越少了,也不知道是好事还是坏事)。
3、 AUM(Automatic UndoManagement)说明
Oracle providesa fully automated mechanism, referred to as automatic undo management, formanaging undo information and space. With automatic undo management, thedatabase manages undo segments in an undo tablespace. Beginning with Release11g, automatic undo management is the default mode for a newly installeddatabase. An auto-extending undo tablespace named UNDOTBS1 isautomatically created when you create the database with Database ConfigurationAssistant (DBCA). Oracle 使用了一个完全自动的机制:AUM 来管理undo 的信息和空间。使用AUM之后,数据库在undo表空间里管理undo segments。从Oracle 11g开始,新建的数据库默认就是用AUM。在使用DBCA 创建实例时,会自动创建一个自动扩展的UNDO表空间:UNDOTBS1. When theinstance starts, the database automatically selects the first available undotablespace. If no undo tablespace is available, the instance starts without anundo tablespace and stores undo records in the SYSTEM tablespace.This is not recommended, and an alert message is written to the alert log fileto warn that the system is running without an undo tablespace. 当启动实例时,db 会自动选择第一个可用的undo 表空间,如果没有undo 表空间可用,那么实例也会启动,但这种情况undo 记录是存在SYSTEM 表空间的rollback segment里,这种情况是不推荐使用,并且在使用SYSTEM 表空间时,alert log里也会出现警告信息,说没有使用undo 表空间。 如果undo 表空间是自动扩展的,那么数据会尝试使用UNDO_RETENTION 参数,如果表空间不足时,不会去重写没有过期(仅仅是没有过期的committed的数据)的undo数据,而是会自动扩展undo 表空间。当undo 表空间扩展达到MAXSIZE值时,数据库开始重写没有过期的undo 数据。
4.Undo Retention Period 说明
After atransaction is committed, undo data is no longer needed for rollback ortransaction recovery purposes. However, for consistent read purposes,long-running queries may require this old undo information for producing olderimages of data blocks. Furthermore, the success of several Oracle Flashbackfeatures can also depend upon the availability of older undo information. Forthese reasons, it is desirable to retain the old undo information for as longas possible. 事务提交之后,UNDO 数据就不需要用来rollback 或者事务恢复,但是为了一致性读,比如long-runing的查询可能还是需要这些旧的undo 数据来获取block的前镜像。此外,Flashback的特性也会受undo信息的影响,因为这些原因,旧的undo 信息还是需要尽可能的长。 When automaticundo management is enabled, there is always a current undo retention period, which is the minimum amount of time that Oracle Database attempts toretain old undo information before overwriting it. Old (committed) undoinformation that is older than the current undo retention period is said to be expired andits space is available to be overwritten by new transactions. Old undoinformation with an age that is less than the current undo retention period issaid to be unexpired and is retained for consistent read and OracleFlashback operations. 当启用AUM后,就会涉及到undo retention period,其是保存最小的undo信息的时间。 Old undo 信息(已经committed)如果超过了这个retentionperiod,那么其就会被标记为expiered,对应的空间也可以被其他的事务重写。 Oracle Databaseautomatically tunes the undo retention period based on undo tablespace size andsystem activity. You can optionally specify a minimum undo retention period (inseconds) by setting the UNDO_RETENTION initialization parameter. Oracle 会根据undo 表空间的大小和系统的活动情况自动调整undoretention period的时间。我们也可以手动在初始化参数里修改UNDO_RETENTION参数,该参数单位是秒。 Theexact impact this parameter on undo retention is as follows:--关于这个参数的2点说明:(1) The UNDO_RETENTION parameteris ignored for a fixed size undo tablespace. The database always tunes the undoretention period for the best possible retention, based on system activity andundo tablespace size.--如果UNDO 表空间的大小是固定的,即不可自动扩展,那么在这种情况下,UNDO_RETENTION参数是会自动忽略,不会生效,数据库根据系统活动情况和undo表空间大小来调整undo retention period为最佳值。 (2) For an undo tablespace with the AUTOEXTEND optionenabled, the database attempts to honor the minimum retention period specifiedby UNDO_RETENTION. When space is low, instead of overwriting unexpired undoinformation, the tablespace auto-extends. If the MAXSIZE clause isspecified for an auto-extending undo tablespace, when the maximum size isreached, the database may begin to overwrite unexpired undo information. The UNDOTBS1 tablespacethat is automatically created by DBCA is auto-extending.--如果undo 表空间是自动扩展的,那么数据会尝试使用UNDO_RETENTION 参数,如果表空间不足时,不会去重写没有过期(仅仅是没有过期的committed的数据)的undo数据,而是会自动扩展undo 表空间。当undo 表空间扩展达到MAXSIZE值时,数据库开始重写没有过期的undo 数据。 (3) Undo Retention Tuning and Alert ThresholdsFor a fixed-sizeundo tablespace, the database calculates the best possible retention based ondatabase statistics and on the size of the undo tablespace. For optimal undomanagement, rather than tuning based on 100% of the tablespace size, thedatabase tunes the undo retention period based on 85% of the tablespace size,or on the warning alert threshold percentage for space used, whichever islower. (The warning alert threshold defaults to 85%, but can be changed.)Therefore, if you set the warning alert threshold of the undo tablespace below85%, this may reduce the tuned size of the undo retention period.--对于固定大小的undo tablespace,数据库根据统计信息和undo 表空间的大小来计算最佳的retention. 管理undo最理想的情况,不是根据100%的undo表空间来计算,而是根据undo 表空间的85%来计算,或者设置的空间警告值来计算,默认情况下空间警告值是85%。
总结:从ORACLE 11G开始数据库Undo表空间都是通过自动管理的方式进行的,影响Undo表空间的使用率会有Undo Retention和数据文件的管理方式,当数据文件设置成不可扩展的时候UNDO_RETENTION参数是会自动忽略,数据库根据系统活动情况和undo表空间大小来调整undo retention period为最佳值,一般会在50%以上;
当数据文件的参数是可扩展的时候,会根据UNDO_RETENTION设置的时间去决定数据是否过期,当数据的保留时间超过了该参数那么这些在undo里面就失效了,会被重写;
在本系统中打开数据文件的自动扩展功能,并把数据文件的扩展大小和数据文件本身的大小设置成一样,经过一天时间的运行发现数据库的undo表空间的使用率明显的降下来了,在10%以下;
...............................................................................................................................................................................................................
ORACLE技术博客:ORACLE 猎人笔记 数据库技术群:367875324 (请备注ORACLE管理 )
...............................................................................................................................................................................................................................
[转帖]11G Undo使用率很高问题的更多相关文章
- 空循环导致CPU使用率很高
业务背景 业务背景就是需要将多张业务表中的数据增量同步到一张大宽表中,后台系统基于这张大宽表开展业务,所以就开发了一个数据同步工具,由中间件采集binlog消息到kafka里,然后我去消费,实现增量同 ...
- 06 案例篇:系统的 CPU 使用率很高,但为啥却找不到高 CPU 的应用?
上一节我讲了 CPU 使用率是什么,并通过一个案例教你使用 top.vmstat.pidstat 等工具,排查高 CPU 使用率的进程,然后再使用 perf top 工具,定位应用内部函数的问题.不过 ...
- 06讲案例篇:系统的CPU使用率很高,但为啥却找不到高CPU的应用
小结 碰到常规问题无法解释的 CPU 使用率情况时,首先要想到有可能是短时应用导致的问题,比如有可能是下面这两种情况. 第一,应用里直接调用了其他二进制程序,这些程序通常运行时间比较短,通过 top ...
- 4 系统的 CPU 使用率很高,但为啥却找不到高 CPU的应用?
上一节讲了 CPU 使用率是什么,并通过一个案例教你使用 top.vmstat.pidstat 等工具,排查高 CPU 使用率的进程,然后再使用 perf top 工具,定位应用内部函数的问题.不过就 ...
- 记录一次mysql查询速度慢造成CPU使用率很高情况
1.某日zabbix告警,某台机器CPU使用率过高. 查看慢查询日志,看到很多sql语句都超过10秒 把sql语句拿出来放在查询窗口执行.前面加上explain就可以查看详细查询信息 playcode ...
- 解决linux中Kipmi0进程对CPU使用率很高问题
kipmi is supposed to run with low priority. When you say it consumes 70-90% of the CPUs, is that con ...
- 线上cpu使用率过高解决方案
一个应用占用CPU很高,除了确实是计算密集型应用之外,通常原因都是出现了死循环. 下面我们将一步步定位问题,详尽的介绍每一步骤的相关知识. 一.通过top命令定位占用cpu高的进程 执行top命令得到 ...
- 性能分析(3)- 短时进程导致用户 CPU 使用率过高案例
性能分析小案例系列,可以通过下面链接查看哦 https://www.cnblogs.com/poloyy/category/1814570.html 系统架构背景 VM1:用作 Web 服务器,来模拟 ...
- oracle11g UNDO使用率高,且unexpire过高
1.查看使用率: col USED_PER for a60 SELECT A.TABLESPACE_NAME AS TABLESPACE_NAME, ,) AS TOTAL_GB, ,) AS FRE ...
随机推荐
- CSP复赛day2模拟题
没错,我又爆零了.....先让我自闭一分钟.....so 当你忘记努力的时候,现实会用一记响亮的耳光告诉你东西南北在哪. 好了,现在重归正题: 全国信息学奥林匹克联赛(NOIP2014) 复赛模拟题 ...
- Flask简介及使用
目录 Flask简介 wsgiref wsgiref简单应用 两个依赖 werkzeug Jinja2 简单使用 安装 flask快速使用 Django与Flask返回值的对比 Flask简介 F ...
- maven 镜像仓库 setting.xml修改 & 手动导入的包如何加到maven里面
如果不知道maven安装路径IDEA中打File->Settings 再点Build->Maven右边看maven安装路径,打开这个路径,再打开conf/settings.xml文件 ...
- IDEA Mac 快捷键
智能提示 ⌘ -> command ⇧ -> shift ⌥ -> option ⬆ -> 上箭头 ⬇ -> 下箭头 ⌃ -> Control 编辑 快捷键 说明 ...
- Django 中的缓存问题
Django 中的缓存问题 简单介绍 在动态网站中,用户所有的请求,服务器都会去数据库中进行相应的增,删,查,改,渲染模板,执行业务逻辑,最后生成用户看到的页面. 当一个网站的用户访问量很大的 ...
- HAProxy的调度算法
HAProxy通过固定参数balance指明对后端服务器的调度算法,该参数可以配置在listen或backend选项中. HAProxy的调度算法分为静态和动态调度算法,但是有些算法可以根据参 ...
- WTL 9.0的变化 - atlapp.h
忽然发现WTL更新到9.0.4140了,便对比了一下 8.1.12085. 先看看atlapp.h中有什么大的变动. 第61行: #if defined(_SYSINFOAPI_H_) &&a ...
- 201871020225-牟星源 《面向对象程序设计(java)》课程学习进度条
<2019面向对象程序设计(java)课程学习进度条> 周次 (阅读/编写)代码行数 发布博客量/评论他人博客数量 课余学习时间(小时) 学习收获最大的程序 阅读或编译让我 第一周 25/ ...
- 20180610模拟赛T1——脱离地牢
Description 在一个神秘的国度里,年轻的王子Paris与美丽的公主Helen在一起过着幸福的生活.他们都随身带有一块带磁性的阴阳魔法石,身居地狱的魔王Satan早就想着得到这两块石头了,只要 ...
- python nose测试框架全面介绍十三 ---怎么写nose插件
之前有一篇文章介绍了自己写的插件 nose进度插件,但最近有朋友问我,看着nose的官方文档写的插件没用,下面再详细介绍一下 一.准备 1.新建一个文件夹,随便文件夹的名字,假设文件夹放在f://aa ...