如果设置了guarantee,意味着所有undo在undo retention指定的时间范围内都不能被覆盖,如果在此时间段内有大量的小事务,虽然每个事务使用的undo不大,但总量是巨大的,那么undo tablespace 将很快的被耗光,具体测试如下:
SQL> create undo tablespace undotbs1 datafile '/ora10g/oradata/ebank/undotbs1_01.dbf'
size 100m retention guarantee;
Tablespace created.
SQL> alter system set undo_tablespace=undotbs1 scope=both;
System altered.
SQL> drop tablespace undotbs including contents and datafiles;
Tablespace dropped.
SQL> select status ,sum(bytes)/1024/1024 from dba_undo_extents group by status;
STATUS SUM(BYTES)/1024/1024
--------- --------------------
EXPIRED 1.25
SQL> conn scott/tiger
Connected.
SQL> set timing on
SQL>
SQL> begin
2 for i in 1 .. 100000 loop
3 delete from test where rownum<=10;
4 insert into test select * from emp where rownum<=10;
5 commit;
6 end loop;
7 end;
8 /
begin
*
ERROR at line 1:
ORA-30036: unable to extend segment by 8 in undo tablespace 'UNDOTBS1'
ORA-06512: at line 3
Elapsed: 00:01:17.83
SQL> conn /as sysdba
Connected.
SQL> select status ,sum(bytes)/1024/1024 from dba_undo_extents group by status;
STATUS SUM(BYTES)/1024/1024
--------- --------------------
UNEXPIRED 95.875
EXPIRED 4
Elapsed: 00:00:00.09
因此,对于guarantee的设置一定要慎重。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10972173/viewspace-589051/ ,如需转载,请注明出处,否则将追究法律责任。