- 이 문서는 구루비에서 작성하였습니다.
- 이 문서를 다른 블로그나 홈페이지에 게재하실 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 출처 : http://wiki.gurubee.net/display/CORE/13.TOTAL+RECALL+FLASHBACK+DATA+ARCHIVE?
- 구루비 지식창고의 모든 문서는 크리에이티브 커먼즈의 저작자표시-비영리-동일조건변경허락(BY-NC-SA) 라이선스에 따라 자유롭게 사용할 수 있습니다.
13. TOTAL RECALL : FLASHBACK DATA ARCHIVE
: Flashback 기능 (Flashback Version Query, Flashback Transaction Query, Flashback Table ) 을 위해
과거 Oracle Database 10g 에서는 Undo Tablespace 를 사용했던 반면,
11g 의 Flashback Data Archive 는 임의의 Tablespace 에 히스토리
데이터를 저장함으로써 보존 기간에 관련한 불필요한 제약 사항을 제거 하였습니다.
Flashback Data Archive 의 장점
- 쉬운용이한 설정
: 간단한 'enable archive' 커맨드만으로 특정 테이블 또는 전체 테이블에 대한 히스토리 데이터 캡처를 활성화할 수 있습니다.
애플리케이션 변경 작업은 전혀 불필요합니다.
- 성능 및 저장 효율성
: 캡처 프로세스는 성능 오버헤드를 최소화할 수 있도록 구현되어 있습니다. 또 스토리지 용량의 절감을
위해 히스토리 데이터는 압축된 형태로 저장됩니다.
- 실수 또는 악의 에 의한 데이터 변조로부터의 보호
: 아무도(심지어 관리자라 하더라도) 히스토리 데이터를 직접적으로 변경할 수 없습니다.
- "AS OF" 플래시백 SQL 구문을 이용하면 과거 특정 시점에 아카이브된 과거 특정
시점의 테이블 데이터를 쉽게 조회할 수 있습니다.
- 히스토리 데이터 관리 작업의 자동화
: Oracle Database 11g는 자동으로 룰을 적용하고 경고를 발생시킴으로써
관리자의 업무 오버헤드를 최소화 합니다.
Flashback Data Archive 활용안
- 장기간 데이터 변화에 대한 관리 및 추적
- Information Life Cycle 관리
- 중요 데이터에 대한 감사
Flashback Data Archive 절차
1. Create the flashback data archive
SQL> create smallfile tablespace fla_tbs1 datafile '/u01/data/IIGNF/fla_tbs01.dbf' size 10m reuse autoextend on
2 next 640k maxsize 32767m nologging extent management local segment space management auto ;
Tablespace created.
SQL> alter user hr identified by hr account unlock ;
User altered.
SQL> grant flashback archive administer to hr ;
Grant succeeded.
2. FDA 생성
SQL> conn hr/hr Connected. SQL> create flashback archive fla1 tablespace fla_tbs1 quota 10m retention 1 year ; Flashback archive created.
3. Table 의 FDA 활성화
SQL> alter table hr.employees flashback archive fla1 ; Table altered.
4. FDA 확인
SQL> select employee_id, last_name, salary from hr.employees where last_name ='Fox'; EMPLOYEE_ID LAST_NAME SALARY ----------- --------------------------------------------------------------------------- ---------- 170 Fox 9600 SQL> update hr.employees set salary = salary + 1000 where last_name ='Fox'; 1 row updated. SQL> commit ; Commit complete. SQL> update hr.employees set salary = salary + 1000 where last_name ='Fox'; 1 row updated. SQL> commit ; Commit complete. SQL> update hr.employees set salary = salary + 1000 where last_name ='Fox'; 1 row updated. SQL> commit ; Commit complete. SQL> select employee_id, last_name, salary from hr.employees where last_name ='Fox'; EMPLOYEE_ID LAST_NAME SALARY ----------- --------------------------------------------------------------------------- ---------- 170 Fox 12600 -- 9600 + 1000 + 1000 + 1000 = 12600 SQL> select employee_id, last_name, salary 2 from hr.employees 3 as of timestamp 4 ( systimestamp - interval '10' minute ) 5 where last_name ='Fox'; EMPLOYEE_ID LAST_NAME SALARY ----------- --------------------------------------------------------------------------- ---------- 170 Fox 9600 SQL> update hr.employees 2 set salary = 3 ( select salary from hr.employees 4 as of timestamp ( systimestamp - interval '10' minute ) where last_name ='Fox') 5 where last_name ='Fox' 6 / 1 row updated.
FDA 관련 뷰 확인
SQL> col FLASHBACK_ARCHIVE_NAME for a30 SQL> select flashback_archive_name, create_time, status from dba_flashback_archive ; FLASHBACK_ARCHIVE_NAME CREATE_TIME STATUS ------------------------------ --------------------------------------------------------------------------- --------------------- FLA1 30-SEP-11 10.10.29.000000000 AM SQL> col QUOTA_IN_MB for a20 SQL> col TABLESPACE_NAME for a30 SQL> select * from dba_flashback_archive_ts ; FLASHBACK_ARCHIVE_NAME FLASHBACK_ARCHIVE# TABLESPACE_NAME QUOTA_IN_MB ------------------------------ ------------------ ------------------------------ -------------------- FLA1 1 FLA_TBS1 10 SQL> col table_name for a30 SQL> col OWNER_NAME for a20 SQL> col FLASHBACK_ARCHIVE_NAME for a20 SQL> col ARCHIVE_TABLE_NAME for a30 SQL> select * from dba_flashback_archive_tables ; TABLE_NAME OWNER_NAME FLASHBACK_ARCHIVE_NA ARCHIVE_TABLE_NAME STATUS ------------------------------ -------------------- -------------------- ------------------------------ ------------------------ EMPLOYEES HR FLA1 SYS_FBA_HIST_73933 ENABLED
FDA Purge
SQL> alter flashback archive fla1 purge before timestamp (systimestamp - interval '2' minute ) ; Flashback archive altered.
FDA Retention 조정
SQL> alter flashback archive fla1 modify retention 2 year ; Flashback archive altered.
Table FDA 해제
SQL> alter table hr.employees no flashback archive ; Table altered.
FDA 해제
SQL> drop flashback archive fla1 ; Flashback archive dropped.
FDA 활성화 방법(요약)
1. FDA 생성
-- SQL> create flashback archive fla1 tablespace tbs1 retention 2 year ;
( 2개 이상 생성 가능, Quota 설정 가능(1시간마다 체크함) )
2. FDA 권한 부여
SQL> grant flashback archive administer to scott ; or SQL> grant flashback archive on fla1 to scott ;
3. TABLE 의 FDA 지정
SQL> conn scott/tiger SQL> alter table emp flashback archive fla1 ;
FLASHBACK ARCHIVE ADMINISTER 권한
- CREATE FLASHBACK ARCHIVE
- ALTER FLASHBACK ARCHIVE
- DROP FLASHBACK ARCHIVE
FBDA Backugrond Process 역할 ( DB 기동 시 시작됨 )
- Data Bufer Cache 에 Undo 를 다룬다.(operate)
- Undo Data 가 이미 Aging Out 시에는 Undo Segment 로 부터 읽는다.
- Flashback Archive 가 활성화된 테이블의 변경 Row를 취합하여, 이력관리 테이블에 저장한다.
출처 : http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/process.htm#CNCPT1259
- FBDA (flashback data archiver process) archives the historical rows of tracked tables into flashback data archives.
Tracked tables are tables which are enabled for flashback archive.
When a transaction containing DML on a tracked table commits, this process stores the pre-image of the rows into the flashback archive.
It also keeps metadata on the current rows.
FBDA is also responsible for automatically managing the flashback data archive for space, organization,
and retention and keeps track of how far the archiving of tracked transactions has occurred.
FBDA 프로세스 체크 ( FDA가 활성화 되어 있어야 관찰 )
SQL> !ps -ef |grep fbda |grep -v grep oracle 8716 1 0 10:10 ? 00:00:00 ora_fbda_IIGNF
관련 뷰
*_FLASHBACK_ARCHIVE_TABLES
이력관리 테이블
- 압축되고(compressed) 내부적으로 Partitioned 된다.
- 보존기한 지난 데이타는 자동으로 Purge 된다.
문서정보
- 이 문서는 구루비에서 작성하였습니다.
- 이 문서를 다른 블로그나 홈페이지에 게재하실 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 출처 : http://wiki.gurubee.net/display/CORE/13.TOTAL+RECALL+FLASHBACK+DATA+ARCHIVE?
- 구루비 지식창고의 모든 문서는 크리에이티브 커먼즈의 저작자표시-비영리-동일조건변경허락(BY-NC-SA) 라이선스에 따라 자유롭게 사용할 수 있습니다.