UNDO表空间


UNDO表空间

将的DML操作前的数据都快照到这个表空间中,以防止误操作

可以将一定之间内所执行的DML操作进行回滚

undo_retention参数  撤销段的最短保留时间,默认情况下,oracle将自动结合undo表空间和和使用情况来自动调整这个值


设置undo_retention参数的值

alter system set undo_retention = 86400;

查看undo_retention参数的值

show parameter undo_retention;

例子:

SQL> show parameter undo_retention;
NAME                                 TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
undo_retention                       integer
900
SQL> alter system set undo_retention=1000;
系统已更改。
SQL> show parameter undo_retention;
NAME                                 TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
undo_retention                       integer
1000


undo_retention的guarantee 特性 如果启用这个特性是强制设定undo_retention这个值,启用设置如下

alter tablespace undotp retention guarantee;

查看状态如下:

select tablespace_name,retention from dba_tablespaces where tablespace_name='UNDOTP';


启用undo_retention的guarantee 特性例子:

SQL> alter tablespace undotp retention guarantee;
表空间已更改。
SQL> select tablespace_name,retention from dba_tablespaces where tablespace_name='UNDOTP';
TABLESPACE_NAME
--------------------------------------------------------------------------------
RETENTION
---------------------------------
UNDOTP
GUARANTEE
SQL> alter tablespace undotp retention noguarantee;
表空间已更改。
SQL> select tablespace_name,retention from dba_tablespaces where tablespace_name='UNDOTP';
TABLESPACE_NAME
--------------------------------------------------------------------------------
RETENTION
---------------------------------
UNDOTP
NOGUARANTEE


创建undo表空间

create undo tablespace undo datafile '/oracle/oradata/aaa/aaa_undo.dbf' size 100m reuse autoextend on next 50m maxsize 30720m;

将undo表空间切换到新建的undo表空间
alter system set undo_tablespace=adunion_undo;

查看undo表空间
select tablespace_name from dba_tablespaces where contents='UNDO';

更改undo表空间的保留时间
alter system set undo_retention = 86400;

删除掉旧的undo表空间
drop tablespace undotbs1;


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值