zoukankan      html  css  js  c++  java
  • undo 管理

    insert
    insert 表是最常见的,也可以插入VIEW,除了下列情况:
    1)distinct 操作
    2)set 操作(如UNION,MINUS等等)
    3)一些计数操作(SUM,count,avg等等)
    4)group by ,order by , connect by 要点
    5)在select中的子查询

    update
    update 表  set

    delete
    delete from 表 where 条件
    undo 管理
    undo的优点:
    可以允许用户rollback
    查询读一致性
    支持flashback 查询,看表在过去如何被lock的

    在oracle 9i 10g时候undo管理默认为自动

    参数undo_management可以指定是自动管理还是手工管理
    但是这个是非动态,所以要重新启动数据库才能生效
    sql>alter system set undo_management=manual;
    会报错
    sql>alter system set undo_management=manual scope=spfile;

    undo_retention
    这个参数是指定undo信息保持的时间长度在commit之后。

    监控undo

    利用v$undostat视图 和EM

    定义undo表空间大小(利用em中的 undo advisor)
    undo_tablespace_size = UR * UPS
    UR就是undo_retention中undo retention
    UPS就是在v$undostat中每秒undoblks最大的块数。
    undo_tablespace_size = 43200 * 626 * 8192 = 221537894400 = 206GB


    保证Undo Retention
    默认的,当事务提交了,undo信息被覆盖。当你需要长时间保持undo信息的话就利用rentention guarentee参数
    SQL>alter tablespace undotbs1 retention gurantee;
    取消
    sql>alter tableapace undotbs1 retention nogurantee;

    查询状态:
    sql>select tablespace_name,contents,retention from dba_tablespaces;

  • 相关阅读:
    BZOJ 2956: 模积和
    BZOJ 1113: [Poi2008]海报PLA
    停课刷题总结-给自己一点鼓励吧
    BZOJ 2751: [HAOI2012]容易题(easy)
    Vijos 1100 加分二叉树
    BZOJ 1756: Vijos1083 小白逛公园
    BZOJ 1709: [Usaco2007 Oct]Super Paintball超级弹珠
    BZOJ 1652: [Usaco2006 Feb]Treats for the Cows
    BZOJ 1651: [Usaco2006 Feb]Stall Reservations 专用牛棚
    BZOJ 1631: [Usaco2007 Feb]Cow Party
  • 原文地址:https://www.cnblogs.com/lovewife/p/1427882.html
Copyright © 2011-2022 走看看