[OCA]042-Managing Undo Data

The process of committing entails a verification that the changes in the transaction have been written to the redo log file, which is persistent storage on the disk, as opposed to memory. In addition, it is typically multiplexed. So, there are multiple copies of the redo data on the disk. Even though the changes may not have yet been written to the data files where the table’s blocks are actually stored, guaranteeing that the changes have been written to the redo log file is enough.

做commit时需要验证在事物处理中做的更改是否已经写入重做日志文件。redo log file保存在磁盘上而不是内存。 
因此即使更改的数据未能及时的写入数据文件(例如数据库不正常的关闭等情况),只要事物提交了(即已经写入了重做日志文件),那么当系统再次启动时,进行一次redo就可以了。

undo 通常来说会遇到2种情况的困难
1.insufficient space for undo。空间不足
当delete,update巨大数据量的数据时,可能导致undo空间不足。(insert操作只需要很少的空间,因为insert之前的数据是一个null值)
用户会收到如下报错信息:
ora 01650 unable to extend rollback segment。
解决办法:正确调整还原包空间的大小;确保周期性的提交大型的事务。

2.ora 01555 snapshot too old
这其实是一个读取不一致的问题。
当你在进行一个很长的查询的同时,对表进行了DML操作,这时候,查询操作读取的是还原数据,当DML操作已经commit,而查询还未结束,undo数据已经被释放,那么查询就会出错。
解决办法:配置还原保留期应满足长时间查询的需要。


guaranteeing undo retention
当undo retention设为10mins时,任何运行未超过15mins的SQL都能正常运行。但是当一个事务产生的undo data超过undo空间时,那么这个事务会失败。
当指定retention guarantee时(这个是tablespace的属性,而不是参数)即使可能因为积累undo data量太大而导致事务失败,那么undo data还是会保留下来。

oracle建议不要为undo表空间设置自动扩展。这是为了防止某个用户因忽略提交事务而无意间占用大量的磁盘空间。

parctice:
1.calculating undo tablespace sizing to support a 48-hour retention interval.

ALTER  SYSTEM  SET   UNDO_RETENTION = 172800;
在EM里可以直接调整,然后点查看SQL.



2.modifying an undo tablespace to support a 48-hour retention interval.

ALTER  DATABASE  DATAFILE 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\DTSPROD\UNDOTBS01.DBF'  AUTOEXTEND  OFF;
ALTER  TABLESPACE  "UNDOTBS1"  RETENTION  GUARANTEE;


1. Which three pieces of information are considered while deciding the size of the undo tablespace in your database? (Choose three.)
A) the size of an undo block
B) the size of the redo log files
C) undo blocks generated per second
D) the size of the database buffer cache
E) the value of the UNDO_RETENTION parameter

显然a是正确的。
redo log file跟undo不搭界,b passed。
配置undo表空间时,显然要考虑undo数据量的产生速度。c.
database buffer cache跟undo表空间有关系么?d pass
课后习题第一题,给定undo_retention ,要你计算undo表空间的大小,e,right

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16591471/viewspace-630124/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/16591471/viewspace-630124/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值