千家信息网

sql中retention guarantee使用场景和作用有哪些

发表于:2024-10-01 作者:千家信息网编辑
千家信息网最后更新 2024年10月01日,小编给大家分享一下sql中retention guarantee使用场景和作用有哪些,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!SQL>alter tablespace undo_
千家信息网最后更新 2024年10月01日sql中retention guarantee使用场景和作用有哪些

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

SQL>alter tablespace undo_samll retention guarantee; 表空间已更改。

SQL> select tablespace_name,block_size,extent_management segment_space_management,contents,retention from dba_tablespaces;

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

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



10gRETENTION GUARANTEE 的作用

1、先解释下undo_retention

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

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

ORA-30036: unable to extend segment by 8 in undo tablespace 'UNDOTBS2'

3、设置该参数

alter tablespace undotbs2 retention guarantee;

撤销该参数

alter tablespace undotbs2 retention noguarantee;

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

0