小编给大家分享一下sql中retention guarantee使用场景和作用有哪些,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

SQL>altertablespaceundo_samllretentionguarantee;表空间已更改。

SQL>selecttablespace_name,block_size,extent_management segment_space_management,contents,retentionfromdba_tablespaces;

需要注意的是这种guarantee模式只针对undotablespace别的表空间是不适用的。

在Oracle10g中我们还可以设置undo_retention=0来让Oracle自动调整保留提交后undo信息的时间。



10g中RETENTIONGUARANTEE的作用

1、先解释下undo_retention

设置undo_retention,保证commit后的数据在undosegment中保留多长时间。但是并不能保证commit后的undo信息在undo_retention的时间内一定不被覆写,当undosegment不够时,还是会覆盖已commit的undo信息。

2、如果需要保证在undo_retention时间内undo信息一定不被覆写的话,可以对undosegment设置RETENTIONGUARANTEE。但是这个参数受到undo_retention和undosize的限制。如果undosize太小,undo_retention设置太久,设置retentionguarantee时就会报错:

ORA-30036:unabletoextendsegmentby8inundotablespace'UNDOTBS2'

3、设置该参数

altertablespaceundotbs2retentionguarantee;

撤销该参数

altertablespaceundotbs2retentionnoguarantee;

看完了这篇文章,相信你对“sql中retention guarantee使用场景和作用有哪些”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!