11G Undo使用率很高问题

http://blog.itpub.net/12679300/viewspace-1164916/
原创 Oracle 作者:wzq609 时间:2014-05-20 10:23:29  2623  0

事件背景:

公司的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使用率很高问题的更多相关文章

  1. 空循环导致CPU使用率很高

    业务背景 业务背景就是需要将多张业务表中的数据增量同步到一张大宽表中,后台系统基于这张大宽表开展业务,所以就开发了一个数据同步工具,由中间件采集binlog消息到kafka里,然后我去消费,实现增量同 ...

  2. 06 案例篇:系统的 CPU 使用率很高,但为啥却找不到高 CPU 的应用?

    上一节我讲了 CPU 使用率是什么,并通过一个案例教你使用 top.vmstat.pidstat 等工具,排查高 CPU 使用率的进程,然后再使用 perf top 工具,定位应用内部函数的问题.不过 ...

  3. 06讲案例篇:系统的CPU使用率很高,但为啥却找不到高CPU的应用

    小结 碰到常规问题无法解释的 CPU 使用率情况时,首先要想到有可能是短时应用导致的问题,比如有可能是下面这两种情况. 第一,应用里直接调用了其他二进制程序,这些程序通常运行时间比较短,通过 top ...

  4. 4 系统的 CPU 使用率很高,但为啥却找不到高 CPU的应用?

    上一节讲了 CPU 使用率是什么,并通过一个案例教你使用 top.vmstat.pidstat 等工具,排查高 CPU 使用率的进程,然后再使用 perf top 工具,定位应用内部函数的问题.不过就 ...

  5. 记录一次mysql查询速度慢造成CPU使用率很高情况

    1.某日zabbix告警,某台机器CPU使用率过高. 查看慢查询日志,看到很多sql语句都超过10秒 把sql语句拿出来放在查询窗口执行.前面加上explain就可以查看详细查询信息 playcode ...

  6. 解决linux中Kipmi0进程对CPU使用率很高问题

    kipmi is supposed to run with low priority. When you say it consumes 70-90% of the CPUs, is that con ...

  7. 线上cpu使用率过高解决方案

    一个应用占用CPU很高,除了确实是计算密集型应用之外,通常原因都是出现了死循环. 下面我们将一步步定位问题,详尽的介绍每一步骤的相关知识. 一.通过top命令定位占用cpu高的进程 执行top命令得到 ...

  8. 性能分析(3)- 短时进程导致用户 CPU 使用率过高案例

    性能分析小案例系列,可以通过下面链接查看哦 https://www.cnblogs.com/poloyy/category/1814570.html 系统架构背景 VM1:用作 Web 服务器,来模拟 ...

  9. oracle11g UNDO使用率高,且unexpire过高

    1.查看使用率: col USED_PER for a60 SELECT A.TABLESPACE_NAME AS TABLESPACE_NAME, ,) AS TOTAL_GB, ,) AS FRE ...

随机推荐

  1. css实现保持div的等宽高比

    这篇文章主要为回答这个问题:“做响应式网页,如何让一个div的高和宽保持比例放大或是缩小?”,这里不介绍媒体查询的实现. 那么css如何实现高度height随宽度width变化保持比例不变呢?即给定可 ...

  2. 前端H5知识总结

    两年大专生活匆匆而过,身边的朋友也都各奔东西,9月份开始实习感觉自己的前端功底有所欠缺,这个暑假除了打工我还有一个半月的学习时间希望自己能够充分利用这段时间.7月3号所学知识在此做以下总结以便自己复习 ...

  3. VMWare15.0手动为Mac OS10.14虚拟机安装VMWare Tools

    安装完客户机虚拟机后,无法在虚拟机和本机之间拖拽传输文件,开启虚拟机后,底部提示安装VMWare Tools,但是这里无法安装. 虽然可以联网后使用局域网工具(如FeiQ)来传输,但是老感觉不是太方便 ...

  4. Centos7安装pip或pip3

    1.使用Python2安装pip wget wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip- ...

  5. docker 网络模式 和 端口映射

    docker 的 网络模式 docker 自带 3 种 网络模式:分别是bridge网络,host网络,none网络,可以使用  docker network ls  命令查看. 1.none网络 这 ...

  6. Mysql数据库之调整最大连接数

    .查看最大连接数 show variables like '%max_connections%'; 2.修改最大连接数 set GLOBAL max_connections = 200; 以下的文章主 ...

  7. LVS (Linux虚拟服务器)模型及算法

    LVS(Linux Virtual Server)Linux虚拟服务器 LVS集群采用IP负载均衡技术和基于内容请求分发技术. 用户请求发给负载均衡调度器,由负载均衡调度器根据设定的调度算法将请求发给 ...

  8. 目标检测论文解读12——RetinaNet

    引言 这篇论文深刻分析了one-stage的模型精度比two-stage更差的原因,并提出Focal Loss提高精度. 思路 在论文中,作者指出,造成one-stage模型精度差的原因主要是:正负样 ...

  9. nginx上传大文件,413错误解决

    在nginx里增加了配置. client_max_body_size 500m; proxy_connect_timeout 600; proxy_read_timeout 600; proxy_se ...

  10. Cantor表-(模拟)

    链接:https://ac.nowcoder.com/acm/contest/1069/I来源:牛客网 题目描述 现代数学的著名证明之一是Georg Cantor证明了有理数是可枚举的.他是用下面这一 ...