Oracle基础 03 回滚表空间 undo

--查询默认的undo表空间

select name,value from v$parameter
where name like '%undo%';


--创建 undotbs2 表空间

create undo tablespace undotbs2
datafile '/u01/app/oracle/oradata/test10g/undotbs02.dbf' size 50m  autoextend on next 10m maxsize 100m;


--将undotbs2 设为默认undo表空间

alter system set undo_tablespace=undotbs2 scope=both;


--如果在创建一个新数据库时想选用AUM,则需要配置下列3个初始化参数:
undo_management:
    undo_management=auto
undo_tablespace:
    alter system set undo_tablespace=undotbs_02;
undo_retention:
    alter system set undo_retention=7200 (两个小时)

撤销表空间必须能容纳撤销保留时间段内的任何增加,如果撤销表空间不能保存所需要时间的记录,就会出现查询的快照太旧错误。
不存在完美的 undo_retention 时间设置。保留时间间隔取决于估计最长的事务可能运行的时间长度。根据数据库中最长事务长度的信息,可以给 undo_retention 分配一个大致的时间。
select max(maxquerylen) from v$undostat;

原文地址:https://www.cnblogs.com/john2017/p/6364430.html