http://storing.tistory.com/56

 

'DataBase > SQL' 카테고리의 다른 글

flashback  (0) 2016.12.09

출처 : http://webdir.tistory.com/341

 

CSS 속성중 테두리를 둥글게 하거나 색상, 모양을 설정하는 border 속성에 대하여 알아봅니다.

border

축약 속성으로, border-width, border-style, border-color 순서로 작성한다. 몇몇 값을 생략해도 상관없다.

CSS
p {border: 5px solid red;} 

속성값

  • border-width : border의 width 값을 지정
  • border-style : border의 style 값을 지정
  • border-color : border의 color 값을 지정
  • inherit : 부모 요소로부터 값을 상속 받는다.

자바스크립트 문법

JAVASCRIPT
object.style.border="3px solid blue" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
지원 지원 지원 지원 지원

inherit 값은 IE7 이하는 지원하지 않는다. IE8은 !DOCTYPE이 필요하다. IE9부터 정상 지원한다.

border-top, border-right, border-bottom, border-left

축약 속성.

CSS
p {border-top: thick solid #ff0000;} p {border-right: thick dashed #ff0000;} p {border-bottom: thick dotted #ff0000;} p {border-left: thick double #ff0000;} 

속성값

  • border-[top | right | bottom | left]-width : border의 width 값을 지정
  • border-[top | right | bottom | left]-style : border의 style 값을 지정
  • border-[top | right | bottom | left]-color : border의 color 값을 지정
  • inherit : 부모 요소로부터 값을 상속 받는다.

자바스크립트 문법

JAVASCRIPT
object.style.borderTop="3px solid blue" object.style.borderRight="3px solid blue" object.style.borderBottom="3px solid blue" object.style.borderLeft="3px solid blue" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
지원 지원 지원 지원 지원

inherit 값은 IE7 이하는 지원하지 않는다. IE8은 !DOCTYPE이 필요하다. IE9부터 정상 지원한다.

border-color

4방향의 테두리에 적용될 색상을 지정한다. top, right, bottom, left 순서로 작성한다.

CSS
h1, h2, h3, h4 {border-style: solid;} h1 {border-color: red green blue pink;} /* top-red, right-green, bottom-blue, left-pink */ h2 {border-color: red green blue;} /* top-red, right & left-green, bottom-blue */ h3 {border-color: red green;} /* top & bottom-red, right & left-green */ h4 {border-color: red;} /* all four borders are red */ 

항상 border-color 속성을 지정하기 전에 border-style을 선언해야 한다. 요소는 반드시 색상을 바꾸기전에 borders가 존재해야 한다.

속성값

  • css 컬러 값 : 색상 키워드, 16진수 값, rgb 값등의 css 컬러 속성 값을 지정한다.
  • transparent : 투명을 지정한다.
  • inherit : 부모 요소로부터 값을 상속 받는다.

border-color 데모 보기

자바스크립트 문법

JAVASCRIPT
object.style.borderColor="#FF0000 blue" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
지원 지원 지원 지원 지원

IE6 이하 버전들은 transparent 속성값을 지원하지 않는다. inherit 값은 IE7 이하는 지원하지 않는다. IE8은 !DOCTYPE이 필요하다. IE9부터 정상 지원한다.

border-style

4방향의 테두리에 적용될 선의 스타일을 지정한다.

CSS
h1 {border-style: dotted solid double dashed;} /* top-dotted, right-solid, bottom-double, left-dashed */ h2 {border-style: dotted solid double;} /* top-dotted, right & left-solid, bottom-double */ h3 {border-style: dotted solid;} /* top & bottom-dotted, right & left-solid */ h4 {border-style: dotted;} /* all four borders are dotted */ 

속성값

  • none : border 스타일을 지정하지 않는다.
  • hidden : none 속성값과 같다.
  • dotted, dashed, solid, double, groove, ridge, inset, outset : 각각의 속성값들은 아래의 그림과 데모를 참고한다.
  • inherit : 부모 요소로부터 값을 상속 받는다.

border-style 데모 보기

자바스크립트 문법

JAVASCRIPT
object.style.borderStyle="dotted double" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
지원 지원 지원 지원 지원

inherit 값과 hidden 값은 IE7 이하는 지원하지 않는다. IE8은 !DOCTYPE이 필요하다. IE9부터 정상 지원한다.

border-width

4방향의 테두리에 적용될 선의 두께를 지정한다. 숫자는 px, pt, em 단위가 될 수 있다.

CSS
h1, h2, h3, h4 {border-style: solid;} h1 {border-width: thin medium thick 10px;} /* top-thin, right-medium, bottom-thick, left-10px */ h2 {border-width: thin medium thick;} /* top-thin, right & left-medium, bottom-thick */ h3 {border-width: thin medium;} /* top & bottom-thin, right & left-medium */ h4 {border-width: thin;} /* all four borders are thin */ 

항상 border-width 속성을 사용하기 전에 border-style 속성을 선언해야 한다.

속성값

  • thin, medium, thick : 이 속성값들은 아래의 예제 링크를 참고하자.
  • length : 부동 소수점 숫자 뒤에 절대 단위 지정자( cm , mm , in , pt , pc ) 또는 상대 단위 지정자( em , ex , px )가 오는 값을 지정한다.
  • inherit : 부모 요소로부터 값을 상속 받는다.

border-width 데모 보기

자바스크립트 문법

JAVASCRIPT
object.style.borderWidth="thin thick" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
지원 지원 지원 지원 지원

inherit 값과 hidden 값은 IE7 이하는 지원하지 않는다. IE8은 !DOCTYPE이 필요하다. IE9부터 정상 지원한다.

border-radius

CSS3에 추가된 속성으로 축약 속성이며 4방향의 모서리에 지정될 반지름을 지정한다.

CSS
h1 {border-radius: 25px;} h2 {   border-top-left-radius: 2em;   border-top-right-radius: 2em;   border-bottom-right-radius: 2em;   border-bottom-left-radius: 2em; }  h3 {border-radius: 2em 1em 4em / 0.5em 3em;} h4 {   border-top-left-radius: 2em 0.5em;   border-top-right-radius: 1em 3em;   border-bottom-right-radius: 4em 0.5em;   border-bottom-left-radius: 1em 3em; }  
  • top-left, top-right, bottom-right. bottom-left 순서로 값이 지정한다.
  • div 태그의 모서리를 둥글게 하고 배경 이미지를 지정하면 모서리가 둥근 이미지도 만들어 낼 수 있다. 선택적으로 투명한 gif 파일도 포함할 수 있다.

속성값

  • px, pt, em, % : 반지름의 길이를 지정한다.

border-radius 데모 보기

자바스크립트 문법

JAVASCRIPT
object.style.borderRadius="5px" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
IE9+ FF4 SF5, iOS3 CH10, An2 O10.6

border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius

각 모서리에 개별적으로 반지름을 지정한다.

CSS
h1 {   border-top-left-radius:2em;   border-top-right-radius:2em;   border-bottom-right-radius:2em;   border-bottom-left-radius:2em; }  h2 {   border-top-left-radius: 2em 0.5em;   border-top-right-radius: 1em 3em;   border-bottom-right-radius: 4em 0.5em;   border-bottom-left-radius: 1em 3em; }  

속성값

  • px, pt, em, % : 반지름의 길이를 지정한다.

자바스크립트 문법

JAVASCRIPT
object.style.borderBottomLeftRadius="5px" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
IE9+ 지원 지원 지원 지원

border-collapse

표의 칸 종류를 조정한다.

CSS
table {border-collapse: collapse;} 

속성값

  • collapse : 테두리가 축소(합쳐)된다.
  • separate : 테두리가 분리된다.
  • inherit : 부모 요소로부터 값을 상속 받는다.

자바스크립트 문법

JAVASCRIPT
object.style.borderCollapse="collapse" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
지원 지원 지원 지원 지원

border-collapse 속성의 inherit 속성값은 IE9 이하 버전에서는 지원하지 않는다. !DOCTYPE이 지정되지 않았다면 border-collapse는 기대하지 않은 결과를 초래한다.

border-image

CSS3에 추가된 속성이고 축약 속성이며 border-style 속성에 지정된 스타일을 덮어쓸 이미지를 지정하고 추가적인 배경 레이어를 생성한다.

CSS
div {   -webkit-border-image:url(border.png) 30 30 round; /* Safari 5 */   -o-border-image:url(border.png) 30 30 round; /* Opera */   border-image:url(border.png) 30 30 round; } 
  • border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat 의 축약속성이다. 생략된 값은 기본값으로 설정된다.

속성값

속성값들의 자세한 설명은 아래에 따로 다룬다.

  • border-image-source : 테두리로 사용할 이미지를 지정한다.
  • border-image-slice : 테두리로 사용될 이미지의 위치를 지정한다.
  • border-image-width : 테두리로 사용될 이미지의 너비를 지정한다.
  • border-image-outset : border box를 넘어서 확장되는 테두리 이미지 영역의 양을 지정한다.
  • border-image-repeat : 테두리 이미지의 스케일을 조정하는 방법을 지정한다.

border-image 데모 보기

자바스크립트 문법

JAVASCRIPT
object.style.borderImage="url(border.png) 30 30 round" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
IE11+ FF4 SF3, iOS3 CH9, An2 O11

오페라는 -o-border-image 속성을 대안으로 제공한다. 사파리 5는 -webkit-border-image 속성을 대안으로 제공하여 사파리 6부터 정식지원한다.

border-image-slice

CSS3에 추가된 속성으로 보더 이미지를 9등분 하도록 각 변으로부터의 offset 거리를 지정한다. 1~4개의 값을 지정할 수 있으며, 윗쪽 방향에서의 offset 거리부터 시계방향으로 지정된다. 기본값은 100%이다.

CSS
div {   border: 30px solid transparent;   border-image-source: url(border.png);   border-image-slice: 30; } 
  • 4개의 값은 각각 위, 오른쪽, 아래 및 왼쪽 가장자리의 여백을 의미하며 이로 인해 이미지는 4개의 모서리와 4개의 가장자리 및 가운데 영역등 총 9가지 영역으로 구분된다.
  • 가운데 이미지 영역은 fill 키워드를 지정하지 않는 한(투명처리) 무시된다.

속성값

  • number(숫자) : 래스터(raster) 이미지의 경우 픽셀 거리를 지정하고, 벡터(vector) 이미지인 경우에는 좌표를 지정한다.
  • %(퍼센트) : 이미지의 크기에 대한 상대적인 크기를 지정한다.
  • fill : 선택적으로 적용가능한 fill 키워드는 테두리 이미지의 가운데 영역을 위한 예약어이다.

자바스크립트 문법

JAVASCRIPT
object.style.borderImageSlice="50% 10%" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
IE11+ 지원 SF6+ 지원 미지원

border-image-source

CSS3에 추가된 속성으로 추가로 배경 이미지 레이어를 만들어 border-style 속성을 덮어쓸 이미지를 정의한다.

CSS
div {border-image-source: url(border.png);} 

속성값

  • none : 이미지를 사용하지 않는다.
  • url(이미지경로) : 이미지 경로를 지정한다.

자바스크립트 문법

JAVASCRIPT
object.style.borderImageSource="url(border.png)" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
IE11+ 지원 SF6+ 지원 미지원

border-image-width

CSS3에 추가된 속성으로 테두리 이미지의 width 값을 지정한다.

CSS
div {   border-image-source: url(border.png);   border-image-width: 10px; } 

속성값

  • length(길이) : 테두리 이미지 영역의 크기를 px로 지정한다.
  • number(숫자) : 기본값은 1이고 border-width 속성값에 대한 배수이다.
  • %(퍼센트) : 테두리 이미지 영역의 수평 offset의 너비와 수직 offset의 높이로 사용된다.
  • auto : 테두리 이미지의 너비는 해당 이미지 슬라이스의 원래 너비 또는 높이가 된다.

border-image-width 데모 보기

자바스크립트 문법

JAVASCRIPT
object.style.borderImageWidth="20px 30px" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
IE11+ 지원 SF6+ 지원 미지원

border-image-outset

CSS3에 추가된 속성으로 border box를 넘어서 확장되는 테두리 이미지 영역의 양을 지정한다.

CSS
div {   border-image-source: url(border.png);   border-image-outset: 5px; } 

속성값

  • length(길이) : 기본 값은 0이며, 테두리 박스 뒤쪽의 테두리 이미지에 대한 위, 오른쪽, 아래, 왼쪽 값을 지정한다.
  • number(숫자) : 해당 border-width 속성 값의 배수이다.

border-image-outset 데모 보기

자바스크립트 문법

JAVASCRIPT
object.style.borderImageOutset="5px 10px 20px 15px" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
IE11+ 지원 SF6+ 지원 미지원

border-image-repeat

CSS3에 추가된 속성으로 테두리 이미지의 스케일을 조정하는 방법을 지정한다.

CSS
div {   border-image-source: url(border.png);   border-image-repeat: stretch; } 

속성값

  • stretch : 기본값으로 영역을 채우기 위해 이미지가 늘어난다.
  • repeat : 영역을 채우기 위해 이미지를 반복해서 노출한다.
  • round : 타일 형태로 영역을 채운다. 만일 영역이 올바르게 채워지지 않으면 이미지의 크기를 재조정한다.
  • space : 타일 형태로 영역을 채운다. 만일 영역이 올바르게 채워지지 않으면 이미지 사이의 공간을 조정한다.

border-image-repeat 데모 보기

자바스크립트 문법

JAVASCRIPT
object.style.borderImageRepeat="round" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
IE11+ 지원 SF6+ 지원 미지원

border-spacing

테두리와 셀사이의 거리를 지정한다.

CSS
table {   border-collapse: separate;   border-spacing: 10px 50px; } 

속성값

  • length length : 부동 소수점 숫자 뒤에 절대 단위 지정자( cm , mm , in , pt , pc ) 또는 상대 단위 지정자( em , ex , px )가 오는 값을 지정한다. 첫 번째 값은 수평, 두 번째 수직값이며 만일 하나의 길이가 지정되지 않는다면 수평, 수직 둘다 하나의 값으로 적용된다.
  • inherit : 부모 요소로부터 값을 상속 받는다.

자바스크립트 문법

JAVASCRIPT
object.style.borderSpacing="15px" 

지원 현황

인터넷익스플로우 파이어폭스 사파리 크롬 오페라
지원 지원 지원 지원 지원

IE8은 !DOCTYPE이 지정되어 있어야만 border-spacing 속성을 지원한다.

 

출처 : http://webdir.tistory.com/341

'Script > JavaScript' 카테고리의 다른 글

Blob(블랍) 이해하기  (0) 2020.10.19

http://www.jigi.net/4247 참고

 

 

 

1. Flashback
  가. 개요 : 사용자의 논리적인 장애(DDL, DML)를 빠르게 복구해내는 방법, undo segment 사용
  나. 종류
    - Row Level Flashback : 특정 row만 과거시점으로 되돌리는 기능, commit된 데이터만 flashback 할 수 있음
    - Table Level Flashback : 특정 table만 과거시점으로 되될리는 기능
    - Database Level Falshback : 데이터베이스 전체를 특정 시점으로 되돌리는 기능, 불완전 복구와 유사한 기능

2. Row Level Flashback 예제

1
2
3
4
5
6
7
8
9
10
select versions_startscn startscn, verstions_endscn endscn,
versions_xid, versions_operation operation, 컬럼명
from 테이블명 versions between scn minvalue and maxvalue
where 조건내용;
 
select undo_sql
from flashback_transaction_query
where talbe_name='테이블이름'
and commit_scn between 시작scn and 종료scn
order by start_timestamp desc;



3. Table Level Flashback 예제
  가. scn 번호로 flashback

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
conn / as sysdba
 
grant dba to scott;
 
conn scott/tiger
 
create table test01 (no number);
 
insert into test01 values (1);
 
commit;
 
insert into test01 values (2);
 
commit;
 
insert into test01 values (3);
 
commit;
 
select from test01;
 
-- 현재 scn 메모
select current_scn from v$database;
 
-- 잘못된 업데이트 문장 수행
update test01 set no=10;
 
commit;
 
select from test01;
 
-- 앞서 scn 메모한 곳으로 flashback
flashback table test01 to scn 'scn번호';
 
alter table test01 enable row movement;
 
flashback table test01 to scn 'scn번호';
 
select from test01;



  나. timestamp로 flashback

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
conn scott/tiger
 
create table test02 (no number(3));
 
insert into test02 values (1);
 
commit;
 
insert into test02 values (2);
 
commit;
 
insert into test02 values (3);
 
commit;
 
select from test02;
 
-- 잘못된 업데이트 문장 수행
update test02 set no=10;
 
commit;
 
select from test02;
 
-- 5분전으로 flashback
flashback table test02 to timestamp (systimestamp - interval '5' minute);
 
alter table test02 enable row movement;
 
-- 테이블이 생성되기 이전시점이라서 오류발생
flashback table test02 to timestamp (systimestamp - interval '5' minute);
                *
ERROR at line 1:
ORA-01466: unable to read data - table definition has changed
 
-- 1분전으로 flashback
flashback table test02 to timestamp (systimestamp - interval '1' minute);
 
-- 원하는 데이터가 아님
select from test02;
 
        NO
----------
        10
        10
        10
 
-- 200초 이전으로 되돌아감
flashback table test02 to timestamp (systimestamp - interval '200' second);
 
-- 원하는 데이터 발견
select from test02;
 
        NO
----------
         1
         2
         3



  다. drop 된 테이블 복구

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
conn scott/tiger
 
-- 테이블 생성
create table test01 (no number);
 
desc test01
 
-- 테이블 삭제
drop table test01;
 
select from test01;
 
-- 테이블 복구
flashback table test01 to before drop;
 
select from test01;
 
-- 테이블 완전 삭제
drop table test01 purge;
 
-- 테이블 생성
create table test02 (no number);
 
-- 테이블 삭제
drop table test02;
 
-- 휴지통 확인
 show recyclebin;
 
-- 테이블 확인(BIN$ 로 시작하는 테이블 존재 확인가능)
select from tab;
 
-- 휴지통에서 원하는 테이블만 삭제
purge table test02;
 
-- 휴지통에서 삭제됐는지 확인
show recyclebin
 
-- 휴지통에 있는 모든 테이블 삭제
purge recyclebin;
 
-- 휴지통 확인
show recyclebin
 
-- 현재 세션에서 휴지통 기능 비활성화
alter session set recyclebin=off;

 

참고 : 휴지통(recyclebin)은 사용자마다 할당되며, 다른사용자의 휴지통은 접근 할 수 없다.


  라. foreign key 제약조건(consraint)으로 묶인 테이블의 삭제 및 복구
     foreign key로 묶인 테이블을 drop 후 flashback 하게 되면, 수동으로 다시 제약조건을 생성해 줘야 한다.


4. Database Level Flashback 예제
  가. 필요시점
    - truncate table 장애 복구 시
    - 특정 시점으로 전체 데이터베이스 되돌릴 때
  나. 전통방식의 백업/복구와의 비교
    - 전통방식에 비해 복구 속도가 빠름(datafile을 restore 하는 과정이 없음)
    - 전통방식이 백업데이터, archivelog, redolog 파일을 이용하지만, flashback는 flashback log 사용
    - 전통방식의 복구의 경우 특정시점으로 복구하였으나 원하는 결과가 나타나지 않아 다른시점으로 변경해야 하는 경우 모든 작업을 처음부터 다시해줘야 했으나, flashback 방식은 언제라도 원하는 시점으로 되돌아 갈 수 있음  
  다. 사전 환경설정
    - parameter 파일에 db_flashback_retention_target 설정
    - mount 단계에서 flashback on 설정

$ vi $ORACLE_HOME/dbs/inittest.ora

db_flashback_retention_target=30

 

1
2
3
4
5
6
7
8
9
startup mount
 
alter database archivelog;
 
alter database flashback on;
 
select flashback_on from v$database;
 
alter database open;



  라. truncate table 된 데이터 복구

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
conn scott/tiger
 
create table test03 (no number);
 
insert into test03 values (1);
 
commit;
 
insert into test03 values (2);
 
commit;
 
insert into test03 values (3);
 
commit;
 
select from test03;
 
-- 잘못된 truncate 명령어 발생
truncate table test03;
 
select from test03;
 
-- 복구시작
conn /as sysdba
 
shutdown immediate
 
startup mount
 
flashback database to timestamp (systimestamp - interval '5' minute);
 
alter database open;
 
alter database open resetlogs;
 
select from scott.test03;
 
-- 원하는 데이터가 없어 다른 시점으로 재시도
shutdown immediate;
 
startup mount
 
flashback database to timestamp (systimestamp - interval '10' minute);
 
alter database open resetlogs;
 
select from scott.test03;



  마. 업데이트를 통한 복구

1
2
3
4
5
6
7
8
9
10
11
-- 업데이트 전 시간을 지정하여 변경 전 데이터를 확인
SELECT *
  FROM TABLE_NAME
       VERSIONS BETWEEN TIMESTAMP TO_TIMESTAMP('2015-02-25 16:10:00''YYYY-MM-DD HH24:MI:SS')
                              AND TO_TIMESTAMP('2015-02-25 16:11:00''YYYY-MM-DD HH24:MI:SS')
 WHERE ID = 'test';
 
-- 변경 전 데이터로 업데이트
UPDATE TABLE_NAME
      SET COL1= '변경전 데이터'
 WHERE ID = 'test';

 

참고 :Flashback Data Archive
11g의 새로운 기능으로 Undo segment의 commit 데이터를 특정 테이블스페이스에 archive한다. 10g이하 버전에서는 다른사용자에 의해 undo segment가 덮어 쓰여지면 flashback 할 수 없는 상황이 발생하였으나, 11g에서는 이 기능을 통해 undo segment가 덮어 쓰여지기전 해당 undo segment를 별도의 파일에 archive 함으로써, 복구를 원하는 시점으로 데이터를 flashback 할 수 있게 되었다.


5. 추가정보

The following script creates a new tablespace, then creates two flashback data archives using the CREATE FLASHBACK ARCHIVE command. The first is limited in size to 10Gig with a retention period of 1 year, while the second has an unlimited quota and a retention period of 2 years.

CREATE TABLESPACE fda_ts   DATAFILE '/u01/app/oracle/oradata/DB11G/fda1_01.dbf'   SIZE 1M AUTOEXTEND ON NEXT 1M;  CREATE FLASHBACK ARCHIVE DEFAULT fda_1year TABLESPACE fda_ts   QUOTA 10G RETENTION 1 YEAR;  CREATE FLASHBACK ARCHIVE fda_2year TABLESPACE fda_ts   RETENTION 2 YEAR;

Management of flashback archives falls into three distinct categories.

  • Tablespace management.
    -- Set as default FBA ALTER FLASHBACK ARCHIVE fba_name SET DEFAULT;  -- Add up to 10G of the specified tablespace to the specified flashback archive. ALTER FLASHBACK ARCHIVE fba_name ADD TABLESPACE ts_name QUOTA 10G;  -- Add an unlimited quota of the specified tablespace to the specified flashback archive. ALTER FLASHBACK ARCHIVE fba_name ADD TABLESPACE ts_name;  -- Change the tablespace quota to 20G. ALTER FLASHBACK ARCHIVE fba_name MODIFY TABLESPACE ts_name QUOTA 20G;  -- Change the tablespace quota to unlimited. ALTER FLASHBACK ARCHIVE fba_name MODIFY TABLESPACE ts_name;  -- Remove the specified tablespace from the archive. ALTER FLASHBACK ARCHIVE fba_name REMOVE TABLESPACE ts_name;
  • Modifying the retention period.
    ALTER FLASHBACK ARCHIVE fba_name MODIFY RETENTION 2 YEAR;
  • Purging data.
    -- Remove all historical data. ALTER FLASHBACK ARCHIVE fba_name PURGE ALL;  -- Remove all data before the specified time. ALTER FLASHBACK ARCHIVE fba_name PURGE BEFORE TIMESTAMP (SYSTIMESTAMP - INTERVAL '1' DAY);  -- Remove all data before the specified SCN. ALTER FLASHBACK ARCHIVE fba_name PURGE BEFORE SCN 728969;

Archives are removed using the DROP FLASHBACK ARCHIVE command, which drops the archive and all its historical data, but doesn't drop the associated tablespace.

DROP FLASHBACK ARCHIVE fba_name;

To enable flashback archiving on a specific table the user must have the FLASHBACK ARCHIVE object privilege on the specific flashback archive used. To try this out create a test user and grant the object privilege on the first flashback archive created earlier.

CONN sys/password AS SYSDBA  CREATE USER fda_test_user IDENTIFIED BY fda_test_user QUOTA UNLIMITED ON users;  GRANT CONNECT, CREATE TABLE TO fda_test_user; GRANT FLASHBACK ARCHIVE ON fda_1year TO fda_test_user;

If we connect to the test user we are able to create a table and associate it with the default flashback archive as follows.

CONN fda_test_user/fda_test_user  CREATE TABLE test_tab_1 (   id          NUMBER,   desription  VARCHAR2(50),   CONSTRAINT test_tab_1_pk PRIMARY KEY (id) ) FLASHBACK ARCHIVE;

If we try to create a similar table, but point it at the second archive it fails, as we have no privileges on it.

CONN fda_test_user/fda_test_user  CREATE TABLE test_tab_2 (   id          NUMBER,   desription  VARCHAR2(50),   CONSTRAINT test_tab_2_pk PRIMARY KEY (id) ) FLASHBACK ARCHIVE fda_2year; CREATE TABLE test_tab_2 ( * ERROR at line 1: ORA-55620: No privilege to use Flashback Archive   SQL>

The ALTER TABLE command allows existing tables to have flashback archiving switched on or off.

-- Enable using the default FBDA. ALTER TABLE table_name FLASHBACK ARCHIVE;  -- Enable using specific FBDA. ALTER TABLE table_name FLASHBACK ARCHIVE fda_name;  -- Disable flashback archiving. ALTER TABLE table_name NO FLASHBACK ARCHIVE;
 

 

 

출처 : http://www.jigi.net/4247 참고

'DataBase > SQL' 카테고리의 다른 글

DB LINK  (0) 2017.01.03

+ Recent posts