[Oracle] Undo retention guarantee (flashback 골든타임 보장)

·2025년 9월 4일
0

오라클 관리

목록 보기
96/163

기본적으로는 flashback 골든 타임 15분을 보장하지 않음

--> 가능하게 하려면 undo tablespace의 retention을 guarantee 해줘야함


[실습1] 현재 사용중인 undo tablespace가 무엇인지 확인합니다.

SYS @ ORA19 > show parameter undo_tablespace

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_tablespace                      string      UNDOTBS1

[실습2] undotbs1의 retention이 어떻게 셋팅되어있는지 확인합니다.

SYS @ ORA19 > select tablespace_name, retention
              from dba_tablespaces
              where tablespace_name='UNDOTBS1';

TABLESPACE_NAME                RETENTION
------------------------------ -----------
UNDOTBS1                       NOGUARANTEE

SYS @ ORA19 >

[실습3] 15분을 보장할 수 있도록 retention을 guarantee 해줍니다.

alter tablespace 테이블스페이스_이름 retention guarantee;

SYS @ ORA19 > alter tablespace undotbs1 retention guarantee;

테이블스페이스가 변경되었습니다.

SYS @ ORA19 > select tablespace_name, retention
                 from dba_tablespaces
                 where tablespace_name='UNDOTBS1';

TABLESPACE_NAME                RETENTION
------------------------------ -----------
UNDOTBS1                       GUARANTEE

SYS @ ORA19 >

--> GUARANTEE로 변경됨

  • update가 더 중요하면 --> noguarantee로 해줘야됨
  • flashback이 더 중요하면 --> guarantee로 해줘야합니다.

문제1. 다시 noguarantee 로 변경하시오

SYS @ ORA19 > alter tablespace UNDOTBS1 retention noguarantee;

테이블스페이스가 변경되었습니다.

SYS @ ORA19 > select tablespace_name, retention
  2  from dba_tablespaces
  3  where tablespace_name='UNDOTBS1';

TABLESPACE_NAME                RETENTION
------------------------------ -----------
UNDOTBS1                       NOGUARANTEE

SYS @ ORA19 >

🔸 문제2. 골든타임을 지정하는 undo_retention을 1시간으로 변경하고, 1시간을 무조건 지킬 수 있도록 undotbs1 의 retention 설정을 gurantee 하시오. 그리고 undo tablespace 의 공간도 2배 더 늘리시오

3600초 = 1시간

-- undo_retention을 1시간으로 변경
SYS @ ORA19 > alter system set undo_retention=3600;

시스템이 변경되었습니다.


-- 잘 변경되었는지 확인
SYS @ ORA19 > select name, value
  2           from v$parameter
  3           where name='undo_retention';

NAME
------------------------------------------------------------------------------                                        --
VALUE
------------------------------------------------------------------------------                                        --
undo_retention
3600


-- undotbs1의 retention 설정을 gurantee로 설정
SYS @ ORA19 > alter tablespace undotbs1 retention guarantee;

테이블스페이스가 변경되었습니다.


-- 혹시 ts.sql이 저장되어있지 않으면 설정하기
SYS @ ORA19 > !cat ts.sql
col tablespace_name for a10
col file_name for a55
col mb_size for 9999

select tablespace_name, file_name, bytes/1024/1024 mb_size
 from dba_data_files
 order by tablespace_name asc;


-- UNDOTBS1의 size 확인: 340m
SYS @ ORA19 > @ts

TABLESPACE FILE_NAME                                               MB_SIZE
---------- ------------------------------------------------------- -------
HR_DATA_TS /u01/app/oracle/oradata/ORA19/hr_data_ts01.dbf             1024
HR_INDEX_T /u01/app/oracle/oradata/ORA19/hr_index_ts01.dbf            1024
S

OWI_TBS    /home/oracle/owi01.dbf                                      330
SYSAUX     /u01/app/oracle/oradata/ORA19/sysaux01.dbf                  710
SYSAUX     /u01/app/oracle/oradata/ORA19/sysaux02.dbf                  100
SYSTEM     /u01/app/oracle/oradata/ORA19/system01.dbf                  900
TEST_BIG   /u01/app/oracle/oradata/ORA19/test_big.dbf                   20
TS300      /u01/app/oracle/oradata/ORA19/ts300.dbf                      10
TS7000     /u01/app/oracle/oradata/ORA19/ts7000.dbf                     10

TABLESPACE FILE_NAME                                               MB_SIZE
---------- ------------------------------------------------------- -------
UNDOTBS1   /u01/app/oracle/oradata/ORA19/undotbs01.dbf                 340
USERS      /u01/app/oracle/oradata/ORA19/users01.dbf                     5

11 행이 선택되었습니다.


-- undo tablespace의 공간 2배(680m)로 늘리기
SYS @ ORA19 > alter database datafile '/u01/app/oracle/oradata/ORA19/undotbs01.dbf' resize 680m;

데이타베이스가 변경되었습니다.


-- 잘 변경되었는지 확인
SYS @ ORA19 > @ts

TABLESPACE FILE_NAME                                               MB_SIZE
---------- ------------------------------------------------------- -------
HR_DATA_TS /u01/app/oracle/oradata/ORA19/hr_data_ts01.dbf             1024
HR_INDEX_T /u01/app/oracle/oradata/ORA19/hr_index_ts01.dbf            1024
S

OWI_TBS    /home/oracle/owi01.dbf                                      330
SYSAUX     /u01/app/oracle/oradata/ORA19/sysaux01.dbf                  710
SYSAUX     /u01/app/oracle/oradata/ORA19/sysaux02.dbf                  100
SYSTEM     /u01/app/oracle/oradata/ORA19/system01.dbf                  900
TEST_BIG   /u01/app/oracle/oradata/ORA19/test_big.dbf                   20
TS300      /u01/app/oracle/oradata/ORA19/ts300.dbf                      10
TS7000     /u01/app/oracle/oradata/ORA19/ts7000.dbf                     10

TABLESPACE FILE_NAME                                               MB_SIZE
---------- ------------------------------------------------------- -------
UNDOTBS1   /u01/app/oracle/oradata/ORA19/undotbs01.dbf                 680
USERS      /u01/app/oracle/oradata/ORA19/users01.dbf                     5

11 행이 선택되었습니다.

SYS @ ORA19 >

0개의 댓글