畅享博客 > 闲庭信步 > 如何规划Undo表空间
2006-11-2 9:22:00

如何规划Undo表空间

   解释Undo Size = Undo_retention * UPS

    最近Oracle8i频频在exp的时候发生ora-1555,才深感oracle9i的undo 表空间自动管理模式好处;

    oracle9i使用参数undo_retention 设置undo 的保留时间;

SQL> show parameters undo

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

undo_management                      string      AUTO

undo_retention                       integer     10800

undo_suppress_errors                 boolean     FALSE

undo_tablespace                      string      UNDOTBS1

    通过在undo segment header中引入extent commit time,记录每个区间涉及到的事务最近一次commit的时间。

  Extent Map

  -----------------------------------------------------------------

   0x0080005a  length: 7

   0x00800061  length: 8

   0x00800989  length: 128

   0x00800a89  length: 128


 Retention Table

  -----------------------------------------------------------

 Extent Number:0  Commit Time: 1113807175

 Extent Number:1  Commit Time: 1113809908

 Extent Number:2  Commit Time: 1113965650

 Extent Number:3  Commit Time: 1114067240

    如何设置undo表空间的大小才能保证undo_retention   ?使用公式

          Undo Size = Undo_retention * UPS

UPS是undo block per second, 我们可以通过V$UNDOSTAT. UNDOBLKS获得       .

SQL> select avg(undoblks)/(10*60) UPS from v$undostat;

 UPS

-------------

   0.03

    则undo_retention=10800,至少需要  10800*0.03=324个数据块。

 

Undo表空间数据释放后无法缩小表空间容量
有趣 Undo表空间数据释放后无法缩小表空间容量

Undo表空间数据释放后无法缩小表空间容量。已经从另一分区新建Undo表空间文件,数据也自动转移到此新建表空间文件上,原超大的表空间文件无法缩小其容量(10803M),求救!困惑

我也遇到同样的问题

新建一个UNDO TABLESPACE并设为默认的undo tablespace,
SQL>alter system set undo_tablespace=newundotbsname;
等过段时间(undo_retention所限定的时间之后)原来的undotbs没有数据后直接删掉即可。


__________________
My Skype : coohoo
My Msn : sungnie@hotmail.com
my blog : http://blog.itpub.net/coohoo

由 coohoo 于 05-10-15 15:35 最后编辑

SQL> create undo tablespace undots2
2 datafile '/oracle/oradata/test/undots2.dbf'
3 size 10M autoextend on;

Tablespace created.

SQL>

SQL> show parameter undo

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string AUTO
undo_retention integer 900
undo_tablespace string UNDOTBS1
SQL> alter system set undo_tablespace='UNDOTS2';

System altered.
SQL> drop tablespace undotbs1 including contents and datafiles;

Tablespace dropped.

SQL>
原先表空间可能无法马上删除,最简单的方法就是重启。如果不能重启的话,就等吧。

 


推荐到鲜果:

评论

您正在以 匿名用户 的身份发表评论  快速登录
(不得超过 50 个汉字)
       看不清,换一个
提示消息
(输入完内容可以直接按Ctrl+Enter提交)