\- Undo Usage Check
select s.username, s.sid, s.serial#, rn.name, rs.curext
,rs.curblk, t.used_ublk, t.used_urec
from v$transaction t
,v$session s
,v$rollname rn
,v$rollstat rs
where t.addr = s.taddr
and t.xidusn = rn.usn
and rn.usn = rs.usn
sys@ARTDOM> create undo tablespace undo_big datafile size 1m
autoextend on next 1m maxsize 2048M ;
Tablespace created.
sys@ARTDOM> create undo tablespace undo_small datafile size 1m
autoextend off ;
Tablespace created.
sys@ARTDOM>show parameter undo_retention
NAME TYPE VALUE
\-----------------------------------\- \----------\- \-----------------------------\-
undo_retention integer 900
sys@ARTDOM>alter system set undo_tablespace = undo_big scope = memory ;
System altered.
sys@ARTDOM>create table t ( x char(2000), y char(2000), z char(2000));
Table created.
sys@ARTDOM>insert into t values ( 'x','x','x');
1 row created.
sys@ARTDOM>begin
2 for i in 1 .. 500
3 loop
4 update t set x=i, y=i, z=i ;
5 commit ;
6 end loop ;
7 end ;
8 /
PL/SQL procedure successfully completed.
sys@ARTDOM>select bytes, maxbytes from dba_data_files where tablespace_name = 'UNDO_BIG';
BYTES MAXBYTES
\---------\- \---------\-
5242880 2147483648
\- 1M \--> 5M
sys@ARTDOM>alter system set undo_tablespace = undo_small scope = memory ;
System altered.
sys@ARTDOM>show parameter undo_tablespace
NAME TYPE VALUE
\-----------------------------------\- \----------\- \-----------------------------\-
undo_tablespace string UNDO_SMALL
sys@ARTDOM>drop table t ;
Table dropped.
sys@ARTDOM>create table t ( x char(2000), y char(2000), z char(2000)) ;
Table created.
sys@ARTDOM>insert into t values ( 'x','x','x');
1 row created.
sys@ARTDOM>begin
for i in 1 .. 500
loop
update t set x=i,y=i,z=i ;
commit ;
end loop ;
end ;
/
PL/SQL procedure successfully completed.
sys@ARTDOM>select bytes,maxbytes from dba_data_files where tablespace_name ='UNDO_SMALL';
BYTES MAXBYTES
\---------\- \---------\-
1048576 0
CREATE UNDO TABLESPACE UNDO_NEW DATAFILE SIZE <N>
ALTER SYSTEM SET UNDO_TABLESPACE=UNDO_NEW SCOPE=BOTH
DROP TABLESPACE OLD_UNDO TABLESPACE
- 강좌 URL : http://www.gurubee.net/lecture/3545
- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.