[转帖]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 ...
随机推荐
- 【开发笔记】- 输出String字符串使其文本对齐
需求 一段文本做每64个字节换行处理,并添加对应的头尾注释 代码实现 public static String certFormat(String code, String beginTitle, S ...
- token安全之任意密码重置
前言 偶然间挖了一个漏洞是密码重置,挖掘过程很有趣,可以参考下. 挖掘过程 在说明之前我们可以先走下正常流程,这样才方便查漏~ 正常流程 第一步骤: 正常填写完,点击下一步发送请求: POST /[U ...
- maven 学习---如何从Maven远程存储库下载?
根据 Apache Maven 的说明: Downloading in Maven is triggered by a project declaring a dependency that is n ...
- Linux发展史与安装-Linux从入门到精通第一天(非原创)
文章大纲 一.Linux发展史二.Linux系统的安装三.Linux系统的文件四.学习资料下载五.参考文章 一.Linux发展史 1. Linux前身-Unix 1968年 Multics项目MI ...
- ssh免密登录(公钥私钥)指令
1.在.ssh目录中执行ssh-keygen -t rsa命令生成两个秘钥,公钥(id_rsa.pub)和私钥(id_rsa) 2.ssh-copy-id -i id_rsa.pub 对方用户名@对方 ...
- Django框架(九)-- 多表操作:一对一、一对多、多对多的增删改,基于对象/双下划线的跨表查询、聚合查询、分组查询、F查询与Q查询
一.创建多表模型 一对一:OneToOneField 一对多:ForeignKey 多对多:ManyToManyField 创建表时,会自动添加一个nid字段,并且自增,所以id可以不用手动创建 On ...
- jq node.js bootstrap
1.node.js 网址:https://nodejs.org/en/ 用来通过下载node.js 来引用里面的npm 来实现对外部项目的下载 1.安装nodejs 自带了npm npm instal ...
- echars配置案例-reactnative
option = { backgroundColor:'#fff', grid: { left: '3%', right: '4%', top:, bottom: '6%', containLabel ...
- Pandas | 27 注意事项&窍门
警告和疑难意味着一个看不见的问题.在使用Pandas过程中,需要特别注意的地方. 与Pandas一起使用If/Truth语句 当尝试将某些东西转换成布尔值时,Pandas遵循了一个错误的惯例. 这种情 ...
- Linux修复小技巧
在重启时不能进入系统,出现以下提示符时.此时输入root密码进入紧急模式,将/etc/fstab文件中除 “/”(根)以外的挂载点全部注释,进系统后在修复排错