SlideShare a Scribd company logo
1 of 107
New Features for
Administrators
(Oracle8)




       Oct, 2000



       CloudBox


    Jang Kyung Sang
Oracle8 New Features                                   http://www.ggola.com




Oracle Server Position


Understanding the figure



  * ORACLE8 특징
  VLDB           Solution             :      Operating
    - partition, rman                        / System
  OLTP           Solution             :
                                                   Oracle8
    - Advanced Queuing, Net8
  Object         Solution             :
                                                 SQL, PL/SQL
    - method                                                              Too
                                                  ls

                                                                          Application


                  Clie
                  nt

                                                                                                  Clie
                                 Clie                                                             nt
                                 nt               Clie                                  Clie
                                                  nt                 Clie               nt
                                                                     nt



Course

                                  1. Using Partitioning
                                  2. Implementing Partitioned Indexes
                                  3. Commands and Guidelines for Partitioned Tables and Indexes
                                  4. Parallelizing Insert, Update and Delete Operations
                                  5. Identifying New Rowid Structure
                                  6. Defining Object Relational Features
                                  7. Managing Large Objects
                                  8. Implementing Oracle Advanced Queuing
                                  9. Using Additional New Features
                                  10. Introduction to Recovery Manager (RMAN)
                                  11. Advanced RMAN
                                  12. Enhancements to Networking
                                  13. Implementing Password Management
                                  14. Migration Server and Applications




                       jkspark@hanafos.com                -2-                    장 경상
Oracle8 New Features                               http://www.ggola.com




1. Using Partitioning


Why?

                                      VLDB for very large database (수백 기가에서 테라까지)

                                  Availability

                                  Management

                                  Scalability



What is Partition?

                             Sample script

                                 create table order
                                 (ord_year number(4), ord_month number(2), ord_day
                                 number(2), ord_id number(10))
                                 partition by range (ord_year, ord_month, ord_day)
                                 (partition p1 values less than (1997, 07, 01) tablespace data01,
                                 partition p2 values less than (1997, 08, 01) tablespace data02,
                                 partition p3 values less than (1997, 09, 01) tablespace data03 )
                                 partition p4 values less than
                                 (MAXVALUE,MAXVALUE,MAXVALUE) tablespace data04)



                             Partitioned tables and indexes
                             -       They can be decomposed into smaller pieces called partitions.

                             -       A range of key values를 기반으로 partition

                             -       VLDB 환경에 유용하다.

                             -       Supports up to 64,000 partitions per single table or index
                                     (1개의 table or index가 64,000개까지의 segment로 구성될 수
                                     있다)


                             Attribute

                             -       동일 table or index의 partition별 columns, datatypes등
                                     partition의 logical attribute는 항상 일치 해야 한다..

                             -       But partition별 storage는 다양하고 서로 다르게 설정할 수 있
                                     다.




                  jkspark@hanafos.com                  -3-                  장 경상
Oracle8 New Features                            http://www.ggola.com




                             Components

                             -   partition key : partition을 구분할 key가 되는 column으로
                                 최대 16개 까지 composite key 가능하지만 나중에 alter로
                                 column modify할 수는 없다.

                             -   values less than : 상수만 사용이 가능하며 유일한 사용가능
                                 function은 TO_DATE, RPAD 뿐이다.
                                 (value 중간에 빠지는 값은 안된다. 예를 들어 1~3, 5~6, 8~9 처
                                 럼 중간에 4나 7을 임의로 뺄수는 없다)

                             -   physical attributes : partition별 storage를 다르게 설정할 수 있
                                 다.
                                 CF. table partition과 index partition은 별개의 문제이므로
                                 partition 구성은 서로 영향을 주지 않는다.

                             -   Long, Long Raw, LOB Type은 partition table을 지원하지 않는
                                 다. (ORA-14085 error 발생)



Using Partition

                             Values less than

                             -   values less than 에서 지정한 value는 자기 값을 포함하지 않는
                                 다.
                                 CF. values less than (5) 라면 5보다 작은 값을 지정한다.

                             -   Insert하려는 value가 가장 큰 값의 partition bound와 동일하거
                                 나 크면 실패한다.
                                 CF. last partition에 지정된 value에는 사실 implicit check
                                 constraint가 적용된다. (Data Dictionary에는 기록되지 않음)

                             -   Last Partition에 value 대신 MAXVALUE Key word를 사용하
                                 여 이전 partition value를 제외한 나머지 모든 값에 대한 insert
                                 를 허용할 수 있다. (NULL을 포함할 수 있다)
                                 CF. NULL value는 모든 values보다 큰 sort값을 갖으므로
                                 maxvalue key word를 사용해야만 insert가 가능하다.
                                 CF. maxvalue key word를 사용하면 implicit check constraint를
                                 사용하지 않는다.
                                 CF. 2개 이상의 columns로 partition key가 이루어 져도
                                 maxvalue key word를 사용할 수 있지만, last partition이 아니
                                 라면 첫번째 key column에는 사용할 수 없다.

                             -   update를 통해 partition key에 해당하는 data를 수정시 그 변경
                                 된 값이 partition을 이동해야 한다면 ORA-14402 error를 받을
                                 것이다. 즉, 이런 경우에는 해당 data를 delete한 후 다른
                                 partition으로 insert를 해야한다. (Oracle8i부터 해결)




                  jkspark@hanafos.com              -4-                 장 경상
Oracle8 New Features                            http://www.ggola.com




                              Multicolumn partitioning

                              -   2개 이상의 column들로 partition key를 구성할 수 있으며 최대
                                  16개까지 가능하다.
                                  CF. Date를 나타내기 위해 년, 월, 일로 column을 나누어 정하
                                  여 partition key로 사용하는 경우도 있다.


                              Equipartitioned Tables and Indexes

                              -   동일한 logical partitioning attributes를 갖는 두개 이상의
                                  objects에 대해 equipartition이 가능하다.

                              -   Prerequisite :
                                  1. Same number of partitions
                                  2. Same values less than boundaries
                                  3. Same number, datatype(length, precision, scale)

                              -   Consideration point :
                                  1. Using equipartitioning reduces the downtime and the
                                  amount of data that is unavailable during partition
                                  maintenance operations and tablespace recovery operations.
                                  2. Data-management time is relative to partition sizes.
                                  3. Other unaffected partitions can be accessed at the same time.
                                  4. table과 그 index들이 equipartition 되면, the effect of move
                                  PARTITION can be limited to one table partition and the
                                  corresponding index partitions

                              -   Generally PK 대 FK tables 혹은 Table 대 PK Index로
                                  equipartition구성할 때 효과적이다.




                  Account_no
  Account

             PK


                       Same Partition




             FK

                  Acct_no
    Check

                                             Acct < 100 Acct < 200 Acct < 300 Acct < …n




                   jkspark@hanafos.com              -5-                   장 경상
Oracle8 New Features                           http://www.ggola.com




Using Advanced Partition

                             Partition Extended Table Names

                             -   partition으로 구성된 table을 사용할 때 그 table의 특정
                                 partition만을 지정해서 사용할 수 있다. 즉, DML을 구사할 때
                                 에 table name 옆에 partition을 지정함으로써 특정 partition에
                                 서만 select, insert, update, delete가 가능해 진다.
                                  select * from account PARTITION(PART03) where …. ;

                             -   단, 이러한 특정 partition을 지정하는 DML은 PL/SQL이나 DB
                                 Link와 같이 remote access를 하는 경우 인식할 수 없다.
                                  따라서 이런 경우에는 partition별로 view를 만듦으로써 원
                                 하는 작업결과를 얻을 수 있다. 이들 view는 partition별로 지정
                                 이 가능할 뿐만 아니라 각각의 단위 별로 grant도 다르게 줄 수
                                 있다.


                             Parallel DDL

                             -   partition을 다루는 다음과 같은 command들도 Parallel 처리를
                                 지원한다.
                                  CREATE (partition) INDEX
                                  CREATE (partition) TABLE AS SELECT
                                  ALTER TABLE MOVE PARTITION
                                  ALTER TABLE SPLIT PARTITION
                                  ALTER INDEX REBUILD PARTITION

                             -   일반적으로 different operation마다 different parallelism이 사
                                 용되는데, create table as select 와 create index는 partition별 동
                                 일한 a degree of parallelism을 사용한다.


                             DML Partition Locks

                             -   DDL이나 partition별 operation의 원할한 사용을 위해서
                                 Oracle8은 partition independence를 지원하다. 즉, partition별
                                 Locking처리가 가능하다.

                             -   Partition Lock은 Table Lock 과 Row Lock 사이의 중간단계에
                                 위치하는 Lock으로 정의될 수 있고, 이는 동일 table에 여러
                                 user들이 concurrently access시 partition data를 보호 하는데
                                 그 목적이 있다.
                                 CF. partition lock은 table처럼 S, X, SS, SX, SSX Lock mode가
                                 있다.

                             -   Table and Partition Locks are acquired at different times.
                                 1. Table Lock은 parsing에서 결정되고 execution시(cursor




                  jkspark@hanafos.com              -6-                  장 경상
Oracle8 New Features                             http://www.ggola.com




                                  start) 획득된다.
                                  2. Partition Lock은 execution시 결정되고 획득된다.
                                  (bind variable은 실행 시 결정되기 때문이고, 또한 partition key
                                  이외의 값으로 SQL문이 생성되는 경우가 많기 때문이다. 물론,
                                  명시적으로 partition key 값을 비교하도록 구성한다면 그 경우
                                  partition lock도 parsing시 결정되고 execution시 획득될 것이
                                  다.
                                  3. OPS(Oracle Parallel Server)에서는 table locks 이나 partition
                                  locks 모두 performance에 영향을 줄 수 있기 때문에
                                  'DML_LOKCS=0' parameter를 사용하거나 특정 table에 대하여
                                  'ALTER TABLE table_name DISABLE TABLE LOCK' command
                                  를 사용 함으로써 performance 향상을 꾀 할 수 있다. 단, 이런
                                  경우 DDL command를 사용할 수 없다.



Operations

                             One-step Operation

                             1.   ALL DDL은 one-step operation이지만, ' CREATE INDEX' or
                                  'ALTER TABLE REBUILD INDEX'의 경우는 예외다.

                             2.   Alter table add column 같은 dictionary operation은 매우 빠르
                                  게 진행되고 exclusive dictionary lock과 함께 DML Lock을 잡
                                  고 other operation을 허용하지 않는다.
                                  CF. queries can be run simultaneously


                             Three-step Operation
                             1.   Read dictionary while holding share dictionary locks

                             2.   Acquire share lock on a table or partition, release the dictionary
                                  locks, and scan and update the table partition or index
                                  partition

                             3.   Acquire exclusive dictionary locks and update the dictionary
                                  while holding exclusive locks

                             CF. long running operation이지만, less restrictive DML locks이어
                             서 running중 other operation이 가능하다. Affected partition만
                             exclusive mode로 잡힌다, Table is locked in shared mode.

                             CF. 이들 operation을 일으키는 command는 :
                              'Alter Table: Drop/Modify/Move/Split/Exchange Partition'
                              'Rebuild Unusable (local indexes)'
                              ' Create Index (global indexes)'
                              'Alter Index Rebuild Partition(global indexes)'
                              'Direct Path Load Table Partitions'




                  jkspark@hanafos.com                -7-                   장 경상
Oracle8 New Features                             http://www.ggola.com




Benefits of Partitioning

                             High Availability

                             -   backup and restore operation을 비롯하여 query나 DML시 동
                                 일 table이나 index를 사용하는 다른 partition에 영향을 주지
                                 않는다. 즉, Partition별로 management 된다.

                              one partition이 unavailable이어도 other partitions can be used.


                             Ease of Administration (Manageability)

                             -   tablespace간에 partition move가 가능하고 partition별 drop,
                                 add, truncate도 할 수 있다.

                             -   partition은 a user-defined value로 나누어질 수 있다.

                             -   DML을 table level 대신에 partition level로 사용할 수 있다.

                             -   partitions을 다루기 위한 a variety command를 제공한다.

                              commands :
                             Alter Table (Add/Drop/Truncate/Move/Split/Exchange) Partition


                             Improved Performance

                             -   Optimizer는 scan에 필요하지 않는 partition은 작업하지 않는
                                 다.

                             -   Partition은 parallel로 scan될 수 있고 또한 parallel로 insert,
                                 update, delete될 수 있다.

                             -   sort를 위한 temporary area size가 감소한다.

                             -   partition을 physical devices에 나눔으로써 load-balance가 가능
                                 하다.

                             -   MPP 환경에서 CPU-disk affinity control이 가능하다.

                             -   OPS에서 특정노드에 대해 data의 ownership을 강제할 수 있
                                 다.




                  jkspark@hanafos.com               -8-                 장 경상
Oracle8 New Features                               http://www.ggola.com




2. Implementing Partitioned Indexes


Partitioned Indexes

                             Index Strategy

                             -       Index는 partitioned index 와 non-partitioned index 로 나누어
                                     지며 DBA와 개발자의 요구에 맞도록 선택해야 한다.
                                     (단, cluster index는 partition될 수 없다)

                             -       Index strategy를 위한 고려대상
                                     1. Type of access to data through the applications
                                     2. Performance in accessing data
                                     3. Availability in case of disk failure
                                     4. Are parallel operations possible ?



Types of Indexes

                                      Oracle8 supports four types of indexes.

                                      Availability, Performance, Manageability


                             Prefixed Indexes

                                     create index glob_orders on orders
                                      (ord_year, ord_month, ord_day)
                                      global partition by range (ord_year, ord_month, ord_day)
                                      ( partition p1 values less than (1997,08,16) tablespace index01,
                                       partition p2 values less than (maxvalue,maxvalue,maxvalue)
                                      tablespace index02 ) ;

                             -       Partition Key의 columns들과 Index의 leftmost columns은
                                     same order and number of columns 가 되어야 한다.

                             -       이 Index가 Unique Index로 구성된다면 이 data를 가져오기 위
                                     해선 하나의 partition만 access할 것이다. 물론, nonunique
                                     index라도 where절의 조건에 partition key에 해당되는 column
                                     이 모두 기술된다면 역시 하나의 partition만 access할 것이다.


                             Nonprefixed Indexes


                                     create index loc_nonpre_orders on order (ord_id) local ;




                  jkspark@hanafos.com                   -9-                   장 경상
Oracle8 New Features                            http://www.ggola.com




                             -    partition key와 동일한 columns을 leftmost columns으로 하지
                                  않는 Index는 모두 nonprefixed index다.

                             -    Unique nonprefixed index는 index key부분으로 partition key
                                  를 포함해야 하며, data를 가져오기 위해선 하나의 partition만
                                  access할 것을 보장해야 한다.

                             -    Nonunique nonprefixed indexes는 data를 가져오기 위해서 all
                                  partitions을 scan해야 한다.



Global / Local Indexes

                             1. Nonpartitioned indexes : Just Global Index

                             2. Global prefixed indexes : Index Key Column과 Partition Key의
                                leftmost가 같지만 underlying table과는 별개이다. 물론
                                underlying table과 key를 동일하게 만들 수도 있지만
                                equipartition 되지 않는다. 즉, global은 global이다.

                             3. Local prefixed indexes : Partition Key의 columns이 Index의
                                leftmost columns 과 일치한다.

                             4. Local nonprefixed indexes : Partition Key의 columns이 Index의
                                leftmost columns 과 일치하지 않는다.


                             Global Prefixed Indexes

                                  create index glob_orders on orders
                                   (ord_year, ord_month, ord_day)
                                   global partition by range (ord_year, ord_month, ord_day)
                                   ( partition p1 values less than (1997,08,16) tablespace index01,
                                    partition p2 values less than (maxvalue,maxvalue,maxvalue)
                                   tablespace index02 ) ;

                             -    Normally, 기초 table partition과 동일한 equipartitioned index
                                  가 아니다. 물론, 강제로 equipartitioned index로 만들 수는 있
                                  으나 Oracle은 이러한 경우 equipartitioning 관리를 자동으로
                                  해주지 않으며 SQL plan 설정할 때에도 무시되므로
                                  equipartitioned index는 반드시 Local로 만들자. 즉, 강제로 key
                                  를 일치시켜도 global index이므로 partition independence를
                                  지원하지 않는다.

                             -    Unique or Nonunique 모두 가능하며, The highest partition은
                                  maxvalue를 partition bound로 가져야 한다. 즉, 'MAXVALUE'
                                  가 꼭 지정되어야 한다.




                  jkspark@hanafos.com               - 10 -                 장 경상
Oracle8 New Features                            http://www.ggola.com




                             -    일반적으로 global index는 local index보다 관리가 더 어렵다.
                                  왜냐하면, 대상 table의 partition이 수정되면 global index는 전
                                  partition이 영향을 받기 때문이다.


                             Local Prefixed Indexes

                                  create unique index loc_pre_orders on orders
                                   (ord_year, ord_month, ord_day, ord_id)
                                  local
                                   ( partition p1 tablespace index01,
                                    partition p2 tablespace index02,
                                    partition p3 tablespace index03 ) ;

                             -    All rows in a table partition have a corresponding index entry
                                  in the index partition. (partition key의 leftmost columns는
                                  index 되어야 한다)
                                  CF. 만일, name and location을 지정하지 않으면 대상 table의
                                  partition name과 똑같이 만들어지고 default tablespace에
                                  index data가 생성될 것이다.

                             -    Local Index는 각 partition별 maintenance operation이 가능하
                                  므로 maintenance operation 동안 다른 partition에 대한
                                  concurrently SELECT and DML이 가능하다.

                             -    MPP platforms에서의 parallel processing의 강점을 갖는다.

                             -    Unique or Nonunique 모두 가능하다.


                             Local Nonprefixed Indexes


                                  create index loc_nonpre_orders on orders (ord_id)
                                  local
                                  ( partition p1 tablespace index01,
                                   partition p2 tablespace index02,
                                   partition p3 tablespace index03 );


                             -    Nonunique일 수 있다.

                             -    Partition key가 index key의 subset일 때에만 unique가 가능하
                                  다.

                             ※ table partition key에 포함 되지않은 columns에 대한 query의
                             fast access가 필요한 경우 유용하다.

                              prefixed VS nonprefixed indexes : prefixed index는 queries and
                             DML시 access할 only one partition에 대해 작업을 진행하지만,
                             nonprefixed index는 n개의 partition 즉, 몇 개가 될지 모르는




                  jkspark@hanafos.com              - 11 -                 장 경상
Oracle8 New Features                            http://www.ggola.com




                                           partition에 대해 작업을 진행하므로 prefixed index의 효율이 더 좋
                                           다.




              Partition index

                                                global과 local을 어떻게 결정할 것인가?

                PREFIXED                        local에서 prefixed 와 nonprefixed를 어떻게 결정할 것인가?

                      Unique data 유용       CF. local prefixed index : best performance, availability,
                                           manageability
         OLTP            GOOD
                                           1. Table partition key 와 index partition key의 leftmost columns이
GLOBAL                          LOCAL
                                              일치 하는가 ?  local prefixed index

          X              DSS               2. 그렇지 않다면, unique index on a nonpartitioning column ? 
                                              Global prefixed index
                      PQ option 유용

                                           3. 그렇지 않다면, manageability의 효율보다 higher availability를
           NONPREFIXED                        위해 performance overhead를 감수할 것인가 ?  Local
                                              nonprefixed index

                                           4. 그렇지 않다면, DSS system 인가?  Local nonprefixed index

                                           5. OLTP 인가?  Global Prefixed index



              Index Unusable(IU)

                                           -    Import partition or conventional path SQL*Loader는 local
                                                index maintenance를 bypass할 수 있는 option을 제공한다. 이
                                                런 경우 import가 끝나면 관련된 local index partition은 IU로
                                                mark된다. 즉, index unusable로 설정된다.

                                           -    Direct path SQL*Loader 또한 작업이 complete successfully 되
                                                지 않으면 local index partitions and global indexes도 IU가 된
                                                다.

                                           -    ROWID에 변경을 주는 alter table move partition command도
                                                관련 local and global index partition을 IU로 만든다.

                                           CF. 기타 :
                                           alter table truncate partition  global index partition  IU
                                           alter table split partition  local index partition  IU
                                           alter index split partition  index partition  IU




                                jkspark@hanafos.com              - 12 -                 장 경상
Oracle8 New Features                           http://www.ggola.com




                             -    IU상태가 된 partitions은 그 partition을 사용하는 queries or
                                  DML이 execute 되기 전에 rebuild 하라. (IU가 아닌 다른
                                  partition index data는 여전히 유효하므로 IU partition외의
                                  data를 scan하는 작업은 이상이 없을 것이다.

                             -    IU 상태가 된 nonpartitioned indexes는 drop 후 re-create 해야
                                  사용할 수 있다.



Parallel scan

                             Parallel table scan
                             SQL> select /*+ PARALLEL(EMP, 9) */ * from emp ;

                             -    ROWID에는 partition numbers가 기록되므로 parallel table
                                  scan은 rowid를 통해서 이루어진다.

                             -    기존 버전에 존재하던 Parallel Query를 위한 process들은 이제
                                  rowid에 의해 각 partition별로 나누어져서 작업을 처리하게 될
                                  것이다.


                             Parallel index scan
                             SQL> select /*+ PARALLEL (I2, 3) */ *
                               from emp where person = 'a' ;

                             -    Index partition별로 different slaves를 사용하여 index scan이
                                  parallel로 가능해진다. (위의 예는 I2라는 index가 3개의
                                  partition으로 구성된 partitioned index라는 예측을 가능케 한
                                  다.)

                             -    Parallel query slaves는 partitions 수만큼 지정할 수 있다. 즉, 하
                                  나의 partition에는 maximum 하나의 slave만 가능하다.




                  jkspark@hanafos.com              - 13 -             장 경상
Oracle8 New Features                           http://www.ggola.com




3. Commands and Guidelines for Partitioned Tables and Indexes


Alter command for partitions

                             Alter table drop partition
                             SQL> alter table order drop partition p1 ;

                             -    this command는 table order에서 partition p1을 remove하고 그
                                  안에 존재하던 data까지 동시에 삭제한다.

                             -    이런 명령은 주기적으로 없어지는 old data를 가지는 historical
                                  data 관리에 유용하다.
                                  CF. if partition을 drop하고 그 안의 data는 살리고 싶다면 해당
                                  partition을 adjacent partition에 merge함으로써 해결할 수 있
                                  다.
                                  CF. if data를 dropped partition에 insert하려하면, dropped
                                  partition보다 바로 높은 value의 partition에 자동으로 저장되
                                  겠지만, 만일 dropped partition이 해당 table의 highest
                                  partition이면 거기에 해당되는 insert는 fail될 것이다.

                             -    또한, this command는 해당 local index의 partition도 함께
                                  drop시킬 것이다. (해당 index의 status가 IU 이건 아니건 상관
                                  없이)

                             -    if global index가 정의되어 있는 table의 data가 들어있는
                                  partition을 drop하는 경우, all global indexes partition은 IU 상
                                  태가 될 것이다. 따라서 이런 경우 index rebuild를 해야 하는데
                                  만일 rebuild하기가 싫다면 partition을 drop하기 전에 drop할
                                  partition에 있는 모든 data를 delete로 일일이 제거하고 나서
                                  그때 partition을 drop해야 한다.


                             Partition drop or Row delete

                             partition을 drop할 것인가 row를 delete할 것인가.

                             -    global index의 지속적인 사용 즉, availability가 가장 중요하다
                                  면 partition drop보다는 rows를 delete하라.

                             -    table에 global index가 많거나, drop되는 partition의 row수가
                                  전체 total row수에 비해 적은 portion을 차지한다면, Row
                                  delete가 global index rebuild 보다 cost가 적을 것이므로
                                  partition drop보다는 row delete를 선택하라.




                  jkspark@hanafos.com              - 14 -                 장 경상
Oracle8 New Features                           http://www.ggola.com




                             -    위와 반대의 경우 즉, global index의 수가 적거나 delete할 data
                                  가 상당히 많다면 오히려 partition drop후 global index rebuild
                                  가 더 적은 cost를 발생시킬 것이다.

                             -    table의 FK가 enable되어 있고 partition에 data가 있다면 drop
                                  partition은 error가 날 것이다. 이런 경우 FK를 delete하던가 아
                                  니면 row delete 후 partition을 drop해야한다. 또한 table이 하
                                  나의 partition으로 구성되어 있을 때에도 partition drop은 할
                                  수 없고 table을 drop해야 한다.


                             Alter index drop partition (allowed for global indexes only)
                             SQL> alter index order_idx drop partition p1 ;

                             -    this command는 partition을 remove하고 partitioned global
                                  indexes로부터 그 안에 존재하는 index entries를 모두 삭제한
                                  다. 이 작업은 index I/O load를 rebalance하는데 사용될 수 있
                                  다.

                             -    This command는 global index에만 유효하며 local index
                                  partition은 explicitly drop할 수 없다. 또한 the highest
                                  partition은 drop할 수 없다.

                             -    partition을 drop하면 value boundaries는 the next highest
                                  partition에 merge된다. 또한 dropped partition에 해당되는
                                  data가 insert되면 바로 the next higher partition에 저장된다. 만
                                  일 data를 가진 partition을 drop했으면 the next highest
                                  partition은 IU status가 되고 반드시 rebuild해줘야 사용할 수
                                  있다.
                                  CF. IU status의 partition도 drop될 수 있다.

                              table or index partition의 name을 바꿀 수 있다. 물론, index의
                             경우 IU status partition도 name change에는 아무 상관이 없다.
                             SQL> Alter table order rename partition p1 to old_p1 ;
                             SQL> Alter index order_idx rename partition IX_p1 to old_IX_p1 ;


                             Alter table add partition
                             SQL> alter table order add partition p4 values less than
                               (1998, 09, 01) tablespace data04 ;

                             -    this command는 오직 the high end of the table에 partition을
                                  add할 때에만 사용될 수 있다. 따라서 partitioning key columns
                                  value가 단조롭게 증가하는 형태에 유용하다.
                                  CF. table의 시작이나 중간에 partition을 추가하고 싶으면
                                  'SPLIT PARTITION' command를 사용하라.

                             -    만일, 가장 마지막 partition즉 high partition의 the first element
                                  가 'MAXVALUE'를 사용했으면 이 때에도 add partition은 할




                  jkspark@hanafos.com              - 15 -                장 경상
Oracle8 New Features                           http://www.ggola.com




                                  수가 없다. 이런 경우에도 split partition을 이용하여야 한다.
                                  CF. 물론, the high partition의 첫번째가 아닌 the second
                                  element 이상의 값에서 'MAXVALUE'를 사용한 경우는 add
                                  partition은 문제없이 수행이 된다.

                             -    이런 add partition은 관련 local index에 a matching partition
                                  또한 추가하는데 그 이름은 table partition의 그것과 동일하다.
                                  Physical storage는 the base index의 것을 default로 사용하며
                                  또한 added partition of the underlying table 과 동일한
                                  tablespace에 위치한다.
                                  CF. 위 내용은 Global Index에는 적용되지 않으며 Index
                                  Partition의 status가 IU라도 상관없이 add partition은 가능하
                                  다.

                              table or index partition을 modify 할 수 있다.
                             SQL> Alter table order modify partition p1
                                 storage (maxextents 512) ;
                             partition별 table의 physical storage를 변경할 수 있다.
                             (move partition command로 partition을 다른 tablespace로 옮길 수
                             있다)
                             SQL> Alter index order_idx modify partition IU_p1
                                storage (maxextents 512) ;
                             SQL> Alter index order_idx modify partition IU_p1 unusable ;
                             global or local partitioned index에 대하여 partition별 physical
                             storage를 변경할 수 있다.
                             (rebuild partition command로 partition을 다른 tablespace로 옮길
                             수 있다)
                             (UNUSABLE Index는 rebuild나 drop and re-create로 USABLE로
                             만들 수 있다)



                             Alter table/index modify physical attributes
                             SQL> alter table order pctfree 0 pctused 20 ;

                             -    partitioned and nonpartitioned table 모두 적용할 수 있다.

                             -    modified attributes는 existing partition의 attributes을 modify
                                  하기위해 사용되지 않는다. partitioned table의 default physical
                                  attributes의 변경은 add partition으로 추가되는 partition에만
                                  적용된다.

                             SQL> alter index order_idx maxtrans 20 storage ( next 10M ) ;

                             -    partitioned and nonpartitioned index 모두 적용할 수 있다.

                             -    modified attributes는 existing partition의 attributes을 modify
                                  하기위해 사용되지 않는다. partitioned index의 default




                  jkspark@hanafos.com              - 16 -                    장 경상
Oracle8 New Features                            http://www.ggola.com




                                  physical attributes의 변경은 미래에 new partition이 새로 만들
                                  어 질 때에만 적용된다.

                             -    Modified attributes가 global index에 대한 변경 이라면 alter
                                  index split partition을 통해 생성된 new partition에 적용된다.
                                  하지만 만일 local index라면 new partition이 created implicitly
                                  by 'alter table add partition, split partition'될 때 적용된다.
                                  CF. nonpartitioned index로서 IU status인 경우 이러한 alter
                                  operations is not allowed 이다.


                             Unusable Index Operations
                             SQL> alter table order modify partition p4 unusable local indexes ;

                             -    This command는 table partition과 matching되는 all local
                                  index partitions을 UNUSABLE로 만든다. 대량 insert후 추후
                                  index생성 등 인덱스 관리가 DML operation이 완전히 종료된
                                  후에 이루어져도 되는 상황에서 유용하게 사용될 수 있다.

                             -    다음 command를 사용하여 unusable local index partitions 을
                                  usable로 만들 수 있다.
                                   alter index rebuild partition
                                   alter table modify partition rebuild unusable local indexes :
                                  이 명령은 해당 partition에 연관된 all the unusable local index
                                  를 rebuild 한다.

                             -    Index IU status를 판단하기 위해
                                  'DBA_/ALL_/USER_IND_PARTITIONS' data dictionary 확인
                                  하라

                             -    Table partition에 연관된 모든 unusable local index partitions
                                  을 rebuild 하기
                                   alter table order partition p1 rebuild unusable local indexes ;

                             -    index를 unusable 시키기
                                   alter index order_idx unusable ;
                                   > 해당 index는 partition되어 있던 아니던 모두 가능하다.
                                   > this command는 a nonpartitioned index는 index를,
                                  partitioned index는 해당 index의 all partitions를 'INDEX
                                  UNUSABLE'로 만든다.
                                   > nonpartitioned index를 사용하기 위해선 rebuild하거나 재
                                  생성을 해야 하지만 partitioned index는 한번에 한 partition씩
                                  rebuild 해야 한다. 물론, partitioned index도 drop후 re-creation
                                  을 해서 사용할 수 있다.
                                   CF. 일반적으로 global partitioned indexes는 partition별
                                  rebuild보다는 drop and re-creation이 더 효과적이다.




                  jkspark@hanafos.com               - 17 -                장 경상
Oracle8 New Features                            http://www.ggola.com




                             Index Rebuild Partition
                             SQL> alter index order_idx rebuild partition p1 tablespace
                             index02 ;

                             -    alter index command는 한번에 하나의 partition을 rebuild할
                                  수 있다. 이런 형태는 대량의 큰 index 전체를 다시 만들지 않고
                                  문제된 partition만 repairing하는데 매우 유용하다.
                                  CF. 이 명령은 index partition을 다른 tablespace로 옮기거나
                                  physical attribute를 바꾸는데 사용될 수도 있고 또한 split
                                  operation같은 작업의 final step으로 사용되기도 한다.
                                  즉, 대개의 경우 index maintenance operation중 마지막 작업에
                                  사용된다.

                             -    Rebuild partition은 parallelism을 지원하며 우선순위는 다음과
                                  같다.
                                  1. 직접 지정한 parallel clause
                                  2. Default parallel attributes of the index
                                  3. Default parallel attributes of the underlying table
                                  4. Without using parallelism


                             SKIP_UNUSABLE_INDEXES
                             SQL> alter table modify partition p1 unusable local index ;
                             SQL> alter session set skip_unusable_indexes = TRUE ;

                             -    위 명령은 local index를 unusable로 하였지만 그 후에 발생하
                                  는 insert,update,delete 작업을 가능케 한다.
                                  즉, insert나 update, delete시 나타날 수 있는 index 관련 errors
                                  는 override된다.
                                  CF. 일반적으로 bulk modification or load of a table partition을
                                  위한 deferring index maintenance 에 사용된다.

                             -    The default value for "SKIP_UNUSABLE_INDEXES"
                                  parameter는 "FALSE"이다.
                                  CF. It is not possible to skip index maintenance on UNUSABLE
                                  unique indexes.


                             Table Split Partition
                             SQL> alter table orders split partition p1 at (1997, 06, 16) into
                             (partition p1, partition p4) ;

                             -    이 명령을 통해 하나의 partition을 새로운 두개의 partition으로
                                  나눌 수 있다. split 이전의 old partition은 discard 된다. 즉, split
                                  을 통해 new partition생성시 new segment 가 만들어 지는데
                                  new physical attributes and initial extents를 지정하여 사용할
                                  수 있고 split하기 이전의 partition name을 그대로 지정함으로
                                  써 기존의 partition name을 살릴 수도 있다.




                  jkspark@hanafos.com                - 18 -                장 경상
Oracle8 New Features                            http://www.ggola.com




                             -    Generally this command can be used when 하나의 partition이
                                  너무 커져서 backup, recovery등 partition maintenance 작업이
                                  to take too long 인 경우에 사용된다. 이 작업을 통해 우리는
                                  redistribute the I/O load를 할 수도 있다.

                             -    partition이 split되면 해당 table의 corresponding partition in
                                  each local index defined on table 또한 matching split을 수행한
                                  다. 해당 index가 INDEX UNUSABLE이어도 상관없이 진행된
                                  다.
                                  CF. 앞서 이야기 했듯이 기존 partition name을 지정해서 재사
                                  용하면 index도 마찬가지로 기존 name을 재사용하고 다만 새
                                  로 추가되는 partition만 "SYS_Pn"의 이름으로 generation된다.
                                  물론, 재사용을 하지 않고 새로운 이름을 지정하여 split 작업을
                                  하면 새로 생기는 index partition은 모두 "SYS_Pn"의 형식을 따
                                  른다.
                                  CF. 새로 생성되는 index partition은 parent local index의
                                  physical attributes를 따르고 tablespace가 index 전체를 위해
                                  define되지 않았다면, New local index partitions reside in the
                                  same tablespace as the corresponding newly created partitions
                                  of the underlying table.

                             -    Table Split partition시 해당 partition에 data가 없었다면 split
                                  complete과 동시에 Local Index는 valid partition이 된다. If
                                  data가 있었다면 split partition은 data를 가지는 partition을
                                  INDEX UNUSABLE로 mark할 것이다. 이 경우 하나의
                                  partition만 data가 존재하면 하나의 partition만 IU상태가 되고
                                  나머지 다른 partition에 data가 없다면 그 partition만 valid될
                                  수 있다.
                                  CF. Split partition중 fail이 발생하면 new segment는 drop되고
                                  모든 작업은 rollback 된다.

                             -    위 작업이 실행되면 대개의 경우 final step으로 하게되는 것이
                                  INDEX UNUSABLE에 대한 처리이다.
                                  SQL> alter index rebuild partition ~~~~ ;


                             Index Split Partition
                             SQL> alter index order_idx split partition p1 at (1997, 06, 16) into
                             (partition p1, partition p4) ;

                             -    일반적인 속성은 table split partition과 같다. 다만, underlying
                                  table partition과 관계가 없다.

                             -    즉, 이 명령은 global index에만 적용되며 설사 INDEX
                                  UNUSABLE 상태의 index라도 가능하다. 물론, 이런 경우나
                                  data를 가진 index split의 경우엔 모두 INDEX UNUSABLE이
                                  되므로 Index를 VALID로 만든 후 사용해야 한다.
                                  SQL> alter index rebuild partition ~~~ ;




                  jkspark@hanafos.com                - 19 -                장 경상
Oracle8 New Features                           http://www.ggola.com




                             -    global index는 아무리 split을 통해 underlying table의
                                  partition처럼 만들어도 equipartitioned local index는 될 수 없
                                  다. 만일, 그러하길 원한다면 index drop 후 local index를 만들
                                  어야 한다.




                             Move Partition
                             SQL> alter table order move partition p1 tablespace data05 ;

                             -    old partition's segment를 drop하고 new segment를 만든다.
                                  (move할 new tablespace지정하면 그곳으로 만일 tablespace를
                                  지정하지 않는다면 단순한 recreation 즉, drop and create 절차
                                  만을 진행한다)
                                   partition을 다른 tablespace로 옮기기 위해
                                   partition recreation으로 de-fragmentation 하기위해
                                   change a physical attribute 하기 위해
                                  CF. parallel clause 사용이 가능하다.

                             -    move할 partition이 not empty면 all affected index partitions은
                                  INDEX UNUSABLE로 mark한다.


                             Exchange Partition
                             SQL> alter table order move exchange partition p1 ( source table)
                               with table order_new (  target table)
                               ( excluding indexes, including indexes)
                               (with validation, without validation) ;

                             -    이 명령은 두개의 table간에 partition은 nonpartitioned table로
                                  table은 partitioned table의 한 partition으로 exchange할 수 있
                                  도록 해준다. (by exchanging their data (and optionally index)
                                  segments)

                             -    대상 table은 partitioned table 이거나 cluster 이어서는 안되며
                                  exchange하려는 두 table에 대한 alter privileges 가 있는 user만
                                  이 작업을 할 수 있다.
                                  CF. 어떤 constraint도 enable 되어서는 안된다. (exchange
                                  partition은 triggers에 영향을 주지 않는다.)
                                  CF. 작업하려는 tables은 두 table간에 columns 수 및 size and
                                  datatype이 모두 일치해야 한다.

                             -    this operation이 진행되면 partitioned table의 global index와
                                  대상 table의 partitioned global indexes는 UNUSABLE로 mark
                                  된다.




                  jkspark@hanafos.com             - 20 -                장 경상
Oracle8 New Features                            http://www.ggola.com




                             -    With validation을 지정하고, 대상 table에 row가 not collate
                                  properly되면 error가 return된다.
                                  Without validation이 지정되면, 대상 table의 proper collation
                                  을 확인하지 않으며, exchange partition을 analyze하고 invalid
                                  rows를 delete하여 작업결과가 logically correct되도록 한다.

                             -    Including indexes를 사용하면 source table의 모든 local index
                                  는 target table의 regular index of the same type 이어야 하고
                                  local index partition은 exchanged with the corresponding
                                  regular indexes.

                             -    Excluding index는 all the local index partitions 과 target table
                                  의 all the regular indexes 을 UNUSABLE로 mark한다.

                             -    다음의 예를 통해 exchange partition의 작업 흐름을 알아보자.
                                  다음은 partitioned table 'order'에서 95년 data partition과 85년
                                  data partition을 한 partition으로 묶어서 10년 비교를 하고자
                                  함이다.
                                  1) create table order_merge85 (..) tablespace ….. ;
                                    옮기고 싶은 data를 가질 temporary용 table 생성
                                  2) alter table order exchange partition order_85 with table
                                  order_merge85 without validation ;
                                    exchange를 통해 table과 partition 교환
                                     (table과 partition이 바뀌었으므로 data dictionary가 수정된
                                  다)
                                  3) alter table order drop partition order_85 ;
                                    table로 변해버린 partition을 drop
                                     (free the segment originally order_merge85)
                                  4) insert into order partition (order_95) select * from
                                  order_merge85 ;
                                    move data to target partition
                                  5) drop table order_merge85 ;
                                    partition으로 변한 table을 drop
                                     (free the segment originally order_85)
                                  6) alter table order rename partition order_95 to order_85-95 ;
                                    필요하면 작업이 끝난 partition의 name 수정


                             Modify Logical Attributes
                             SQL> alter table order add ( new_type varchar2(2)) ;

                             -    일반적인 table modify와 동일하지만 partitioned table에 대해
                                  서는 몇가지 제약이 따른다.
                                  1. Table 이나 index partition에 사용된 column의 length or
                                  datatype은 바꿀 수 없다.
                                  2. Long or long raw datatype column은 add할 수 없으며 이미
                                  존재하는 long or long raw column의 datatype도 바꿀 수 없다.
                                  3. Table partition중 하나이상이 read-only tablespace에 존재한
                                  다면




                  jkspark@hanafos.com              - 21 -                장 경상
Oracle8 New Features                            http://www.ggola.com




                                    user-specified default value를 갖는 column을 add할 수 없
                                  다.
                                    varchar2(or varchar) column은 char(or character)로 변경할
                                  수 없다.
                                    char(or character) column의 length를 증가시킬 수 없다.

                             -    Alter command 로 Unique or primary key를 add하거나 enable
                                  하면
                                  1. 해당 column에 index가 존재하면
                                    unique index이면 oracle은 그 index를 사용할 것이며 그
                                  index는 global nonpartitioned, global partitioned, local
                                  prefixed, local nonprefixed index등 모든 index가 대상이 될 수
                                  있으나 nonprefixed index의 경우엔 partitioning key를 가져야
                                  한다.
                                    unique index가 아니면 alter statement는 error를 return할
                                  것이다.
                                    unique index이지만 index가 IU 상태거나 index의 partition
                                  이 IU 상태이면 역시 alter statement는 error를 return할 것이
                                  다.
                                  2. Index가 존재하지 않는다면 oracle은 global nonpartitioned
                                  index를 만들 것이다.


                             Truncate Partition
                             SQL> alter table order truncate partition p3 (drop storage) ;

                             -    truncate partition은 지정된 partition에 존재하는 모든 rows를
                                  remove한다. (faster than using 'delete statement')

                             -    partition이 truncate되면 corresponding local index partition도
                                  같이 truncate된다. (IU 상태라도)
                                  Freed index space는 drop storage를 통해 deallocated 되거나
                                  reuse storage를 통해 재사용될 수 있다.
                                  CF. the local index partitions that were marked INDEX
                                  UNUSABLE are marked VALID, resetting the INDEX
                                  UNUSABLE indicator.

                             -    Global index에 대해 not empty partition이 truncated되면 all
                                  global index partitions가 INDEX UNUSABLE 된다.
                                  (이런 경우 rebuild가 필요하므로 만일 rebuild를 원하지 않는
                                  다면 truncate하지 말고 manually sql delete 하라)

                             -    FK를 가진 not empty partition을 truncate 하면 error가 return
                                  된다. 이런 경우는 FK를 먼저 disable하던지 아니면 manually
                                  sql delete한 후 truncate해야 한다.
                                  CF. truncate partition does not fire the table's DELETE triggers.




                  jkspark@hanafos.com               - 22 -                장 경상
Oracle8 New Features                            http://www.ggola.com




                             Index Parallel
                             SQL> alter index order_idx parallel (degree 5 instances 2) ;

                             -    this command로 partitioned index의 parallel attributes를 정할
                                  수 있다.
                                  CF. index scan시 one slave가 one partition에 작업을 할 수 있
                                  다. 위의 예는 5개의 index partitions에 partition당 one slave가
                                  할당될 수 있다.

                             -    parallel create index에서 default parallelism을 위해 사용된다.


                             Privileges for Partitioned Tables and Indexes

                             -    nonpartitioned tables and indexes 에 대한 privileges는
                                  partitioned tables and indexes에도 동일한 privilege를 갖는다.
                                  CF. 단, table owner가 아닌 user가 ‘alter table drop partition,
                                  alter table truncate partition’ operation을 하려면 ‘alter’
                                  privilege와 함께 'Drop any table' privilege가 있어야 한다.

                             -    다음의 명령들은 privilege외에 a space quota in tablespace를
                                  요구한다.
                                  Alter index modify/rebuild/ split partition
                                  Alter table add/modify/move/split partition



an additional portion for partition features

                             Data Dictionary Lists (USER/ALL/DBA prefixed dictionary)
                             -    _PART_TABLES, INDEXES, KEY_COLUMNS

                             -    _TAB/IND_PARTITIONS

                             -    _PART/TAB/_COL_STATISTICS

                             -    _PART/TAB/_HISTOGRAMS

                             -    _OBJECTS, _TABLES, _TAB_COLUMNS


                             New Columns of the PLAN Table
                              PARTITION_START, PARTITION_STOP

                             -    PARTITION_START, PARTITION_STOP : how oracle
                                  computes the partitions to be accessed and provide the range
                                  of accessible partitions

                             -    Values : number(n), key, row location, invalid




                  jkspark@hanafos.com              - 23 -                 장 경상
Oracle8 New Features                             http://www.ggola.com




                             -    NUMBER(n) : indicates that the start partition has been
                                  identified by the SQL compiler. Its partition number is given
                                  by n

                             -    KEY : indicates that the start partition will be identified at
                                  execution time from partitioning key values.

                             -    ROW LOCATION : indicates that the start partition(same as
                                  the stop partition) will be computed at execution time from the
                                  location of each record being retrieved. The record location is
                                  obtained by a user or from a global index.

                             -    INVALID : indicates that the range of accessed partitions is
                                  empty

                              PARTITION_ID

                             -    this column identifies the step that has computed a pair of
                                  values PARTIONT_START and PARTITION_STOP columns.

                              OPTIONS column for PARTITION Step
                                (newly added execution step)

                             -    values : concatenated, single, empty

                             -    CONCATENATED : 2개 이상의 partitions에서 returned result
                                  sets를 concatenation

                             -    SINGLE : accessed partition이 execution time에 a single
                                  partition 이다.

                             -    EMPTY : accessed partition이 empty

                             CF. table access and index step : can contain the values 'by user
                             rowid, by index rowid, by global index rowid, by local index
                             rowid'


                             SQL*Loader

                             -    conventional path : partition table에 대한 load도 가능하다.
                                  1. SQL insert statement를 사용한다.
                                  2. Same table에 대하여 concurrently하게 can run multi load
                                  and can load different partitions
                                  3. Must specify the table and partition name is the load control
                                  file
                                  4. 지정된 partition에 속하지 않는 rows는 'BADFILE'로 쓰여진
                                  다.

                             -    Direct path sequential loads :
                                  1. Index are build automatically.
                                  2. Must specify the table and the partition name and set
                                  DIRECT=TRUE.




                  jkspark@hanafos.com                - 24 -                 장 경상
Oracle8 New Features                             http://www.ggola.com




                                  3. If you are loading for the whole table, you cannot run any
                                  other loads on the same table concurrently
                                  4. If there are no global indexes, you can run sequential direct
                                  path loads on different partitions of the same table
                                  concurrently

                             -    Direct path parallel loads
                                  1. Must specify the table name and the partition name and set
                                  DIRECT=TRUE and PARALLEL=TRUE
                                  2. Local index는 IU 상태가 되므로 loading이 끝나면 rebuild해
                                  야 한다. (rebuild the partitions explicitly)
                                  3. Global index가 있어서는 안된다. 꼭 필요하다면 global index
                                  drop and direct path parallel loading and re-create the index 해
                                  야 한다.
                                  4. Can run parallel direct path loads on different partitions of
                                  the same table concurrently


                             Export / Import

                             -    Export : table mode에서만 partition export가 가능하다.
                                  CF. 다음과 같은 형식을 사용한다. table_name:partition_name

                             -    Import : partitioned table에 대한 import시 values less than in
                                  the highest partition에 해당되지않는 그 이상의 값을 갖는
                                  rows는 모두 reject한다.
                                  CF. 다음과 같은 형식을 사용한다. table_name:partition_name
                                  CF. SKIP_UNUSABLE_INDEXES를 설정하여 UNUSUABLE
                                  maintenance를 skip할 수 있다.


                             Analyze

                             -    partitions는 개별적으로 모든 analyze를 할 수 있다.
                                  CF. 물론 whole table and index애 대한 analyze는 자동으로 해
                                  당 partition전체에 적용된다.

                             -    analyze generates 'combined' table, index and column statistics
                                  for a partitioned table or index by merging the statistics from
                                  the partitions. 하지만 analyze는 combined histogram을 생성하
                                  지는 않는다.

                             -    optimizer 가 아직 analyzed되지 않은 partition을 발견한다면
                                  그때는 each partition에 table/index defaults를 사용한다.




                  jkspark@hanafos.com               - 25 -                 장 경상
Oracle8 New Features                            http://www.ggola.com




4. Parallelizing Insert, Update and Delete Operations


Parallel Operation

                                  대략 megabytes or gigabytes급 table or index에 대하여 적어
                                   도 1%이상의 변경을 일으키는 Large DML operations에 대하
                                   여 speed up을 기대할 만 하다.

                                  일반적으로 DSS or DW 같은 large objects access시
                                   performance and scalability가 중요한 시스템에서 주로 사용된
                                   다. (some OLTP operation에서도 효과를 기대할 수 있다)

                                  parallel DML compliments the parallel query architecture by
                                   providing parallel support for Insert, Update, Delete
                                   operations.

                                  대개의 경우 parallelism은 partitioned tables and indexes에 대
                                   하여 적용이 된다. 단, 예외적으로 'Insert .. as select … ' on a
                                   nonpartitioned table에 대해선 허용한다.



Benefits of Parallel

                                  parallel DML의 목적은 performance의 많은 향상이나 반드시
                                   hardware support가 필요하다.

                                  The performance of parallelism is not only based on number
                                   of processes spawned. The number of CPU's, the number of
                                   disk drives on which the data is located, and some other
                                   factors all have an impact


                             Automatic parallelization

                             -    여러 session에서 parallel update를 수행할 필요가 없이 자동으
                                  로 parallel DML operations을 사용할 수 있다.
                                  (조건별로 나누어 여러 session에서 동일 DML을 할 필요가 없
                                  다)

                             -    여러 session에서 처리할 필요가 없으므로 level of work를 나누
                                  기 위한 key value or ROWID ranges를 알아야 할 필요가 없다.
                                  (따라서 transaction control에 대한 부담이 없이 완전하게 하나
                                  의 transaction으로 처리가 되어진다)




                  jkspark@hanafos.com              - 26 -                장 경상
Oracle8 New Features                             http://www.ggola.com




                             Affinity
                             -    Oracle uses partition-to-device mapping. A process can be
                                  allocated to specific device for a given partition.

                             -    Users는 DML 실행 시 node/device/file/table/partition
                                  affinity를 알아야 할 필요가 없다.


                             Oracle Parallel Server

                             -    OPS환경에서 parallel operations을 수행할 때 manual
                                  parallelism을 사용기 위해선 instance별 degree of affinity에 따
                                  라 결정해야 한다.

                             -    Parallel DML은 implicitly managed되고 slave processes는
                                  allocated to a given partition on an individual devices



Supported Parallel Operations

                             Parallel DML

                             -    Parallel Query : Oracle7 과 same architecture

                             -    Parallel Insert .. Select direct load on partitioned tables or
                                  nonpartitioned tables

                             -    Parallel Delete on partitioned tables, parallelize by partition

                             -    Parallel Update on partitioned tables, parallelize by partition


                             Types of Parallelism

                             -    하나의 master process가 slave processes를 coordinate한다.

                             -    세가지 방식의 parallel operations이 있다.
                                  1. Parallelize by rowid ranges (for parallel query only)
                                  2. Parallelize by slave processes (for inserts into unpartitioned
                                  tables only)
                                  3. Parallelize by partitions (for partitioned tables only)


                             Parallelize by rowid

                             -    parallel query를 위해 사용되며 partitioned and nonpartitioned
                                  tables에 대하여 구분이 없이 모두 사용할 수 있다.

                             -    provide parallelism within a partition, 1개의 process는 1개의
                                  partition만 담당한다. (동시에 여러 process가 1개의 partition을
                                  select할 수 있다)




                  jkspark@hanafos.com                - 27 -                  장 경상
Oracle8 New Features                            http://www.ggola.com




                             Parallelize by slave processes
                             -    insert into table select from table operation for nonpartitioned
                                  tables에 대해서만 사용이 가능하다. (parallel degree는 insert하
                                  려는 대상 table에 준다)

                             -    Multiple slaves can insert after the high water mark(HWMK)
                                  of the table.


                             Parallelize by partitions

                             -    partitioned table만을 대상으로 하는 INSERT .. SELECT,
                                  UPDATE, DELETE Command만 적용된다.

                             -    cannot provide parallelism within a partition .

                             -    resource의 sharing and use를 위해 1개의 process는 1개 이상의
                                  partition에 assigned될 수 있다. 그러나 1개의 partition에 1개
                                  이상의 process가 할당될 수는 없다.

                             -    Parallel Insert for partitioned table은 temporary segments를 사
                                  용하여 insert를 진행하고 생성된 segment를 대상 table의
                                  HWMK 위에 add한다.

                             -    segment가 1개씩 add될 때 HWMK가 이동하고 newly inserted
                                  rows에 대하여 ROWIDS가 assigned 된다.
                                  CF. 이후의 원칙은 Direct Path mode in SQL*Loader와 같다.


                             Enabling Parallel DML

                             -    default Parallel DML mode는 FALSE로 되어있으므로 처음
                                  session을 맺어서는 parallel DML을 사용할 수 없다. 반드시 다
                                  음과 같이 alter session command를 사용하여 enable후 사용을
                                  해야 한다. 단, parallel query는 이와 무관하게 원래부터 사용할
                                  수 있으므로 유의하라.
                                  SQL> ALTER SESSION ENABLE PARALLEL DML ;
                                  (반대는 DISABLE)


                             Parallel DML Mode

                             -    Initial parameter에 설정되어 있지않고, Alter session command
                                  를 사용할 때는 사전에 commit or rollback을 통해 current
                                  transaction이 종료되어 있어야 한다. 그렇지 않으면 external
                                  error를 return할 것이다.

                             -    Each successful parallel DML operation후에는 다른 SQL
                                  command를 수행하기 이전에 반드시 commit or rollback이 수
                                  행되어야 한다. 그렇지 않으면 commit or rollback을 수행하라
                                  는 error (12830)가 return될 것이다.




                  jkspark@hanafos.com               - 28 -                장 경상
Oracle8 New Features                            http://www.ggola.com




                             -    한 transaction에서 first DML이 serially 수행되거나, Lock Table
                                  or Select for update 문장을 사용한 경우 그 이후에 사용되는 모
                                  든 parallel은 무시된다. 즉, 모두 serially 수행된다. (단순 select
                                  는 상관없다)
                                  CF. 이것은 Oracle 8.0.3까지의 제약 사항이다.

                             -    PL/SQL procedure or block이 Parallel DML enabled session에
                                  서 수행되면 each statement in the procedure or block에 모두
                                  같은 rule이 적용된다.



Using Parallel

                             Parallel Clause
                             SQL> create table table_name (column type ….) parallel (degree 4) ;

                             -    create or alter table command로 parallel clause을 사용하여
                                  default degree of parallelism을 설정할 수 있다.


                             Parallel Hints
                             SQL> Update, Delete /*+ parallel (table, n) */ ……
                             SQL> Insert /*+ append parallel (table, n) */ into….
                                   /*+ noappend parallel (table, n)*/

                             -    explicit hints를 지정하면 즉, hint를 사용하여 parallel DML을
                                  사용하면 parallel clause을 이용한 default setting은 override된
                                  다.

                             -    Insert hint에 사용된 parallel은 select operation에는 적용되지
                                  않으며 설사 insert와 동일 table에 select라도 적용되지 않는다.
                                  parallel hint가 없다면 parallel clause을 사용할 것이다.
                                  CF. Parallel DML enable상태에서 append는 append insert
                                  parallel로 진행될 것이고 disable상태면 append insert serial로
                                  진행될 것이다.
                                  CF. noappend hint는 conventional insert를 진행한다.


                             Determining the degree of parallelism
                             -    Parallel DML adds some new limits to the degree of
                                  parallelism to prevent deadlock situations.

                             -    The minimum number of transaction free lists for a partitioned
                                  global index is the minimum number across all index
                                  partitions. This is a requirement in order to prevent self-
                                  deadlock.

                             -    If a certain minimum fraction of the desired slave processes is
                                  not available(specified by PARALLEL_MIN_PERCENT), a user




                  jkspark@hanafos.com              - 29 -                장 경상
Oracle8 New Features                             http://www.ggola.com




                                  error is produced. You can retry the query with less
                                  parallelism.


                             Parallel select

                             -    parallel hint or table level의 parallelism에 따라 parallel select
                                  가 수행된다.

                             -    One parallel directive for degree of parallelism is chosen for the
                                  entire statement, following these precedence rules :
                                  1. Select hint directive
                                  2. Select clause directive
                                  3. Maximum select directive (join처럼 2 table 이상을 scan시 1,
                                  2중 제일 큰 값을 사용한다)


                             Parallel Insert .. Select

                             -    parallelizing에 영향을 주는 4대 요소
                                  1. select parallel hint (at the statement level)
                                  2. parallel clause (definition of the tables)
                                  3. insert parallel hint (at the statement level)
                                  4. parallel clause (definition of the table)
                                  CF. Oracle chooses one overall Parallel directive for the entire
                                  statement.

                             -    선택 순위
                                  1. Insert hint directive
                                  2. Insert clause directive
                                  3. Maximum select directive

                             EX) insert /*+ parallel (emp, 3) / into emp select /*+ parallel
                             (emp_src, 6) */ from emp_src ;

                              위의 예에서 선택되는 degree는 ?                             3


                             Parallel update and delete
                             -    Parallel hint is applied to both the implicit query portion of the
                                  statement and to the DML portion.

                             -    If the statement contains subqueries or updatable views, they
                                  may have their parallel hints or clauses.

                             -    만일 update중 발생하는 table scan이 serial 발생하더라도 즉,
                                  where clause 등에서 index scan이 serial로 발생하더라도
                                  update 자체의 parallel operation은 수행될 것이다.

                             -    선택 순위
                                  1. Update/Delete hints
                                  2. Update/Delete clause




                  jkspark@hanafos.com               - 30 -                 장 경상
Oracle8 New Features                           http://www.ggola.com




                             Parallel DML and the Data Dictionary

                             -    Parallel DML이 수행되면 V$PQ_SESSTAT, V$SESSION,
                                  V$PQ_SYSSTAT을 조합하여 적절한 정보를 찾을 수 있다.

                             -    Parallel DML이 enable인가?
                                  PDML_ENABLED column from V$SESSION

                             -    Parallel DML이 수행되고 있는가?
                                  Select * From V$PQ_SESSTAT;  current session parallel 정보
                                  Select * From V$PQ_SYSSTAT;  initialized parallel DML 수


                             Logging / Nologging
                             SQL> alter table table_name LOGGING ;

                             -    NOLOGGING Attribute는 statement level이 아니라 alter or
                                  create command 즉, object level에서 수행되어야 한다.

                             -    Tablespace level에서도 설정이 가능하며 이렇게 NOLOGGING
                                  을 설정하는 경우 all subsequent tables, indexes and partitions
                                  등 모두 do not generate redo logs entries.
                                  그러나 lower level에서 table, index등 object level에서의 설정
                                  이 우선한다.


                             Parallel DML and Rollback Segments

                             -    Parallel DML이 수행되면 개별적인 slave process별 transaction
                                  이 발생하므로 동시에 different rollback segments를 할당 받는
                                  다.

                             -    따라서 the coordinator는 내부적으로 slave process별 two-
                                  phase commit방식을 취하게 된다. 당연히 rollback segment를
                                  지정하는 set transaction use rollback segment command는 유
                                  효하지 않다.

                             -    Parallel DML을 수행하는 a query slave는 long-running
                                  transactions수가 가장 적은 것을 우선으로 하여 rollback
                                  segment를 할당 받는데 만일 in each rollback segment 동수의
                                  long-running transaction이 할당되어 있을 때는 regular DML
                                  수가 가장적은 것을 할당한다.

                             CF. 가급적 equally sized rollback segment를 가질 필요가 있다. 앞
                             서 언급했듯이 어떤 slave가 어떤 rollback segment에 할당될 지는
                             알 수가 없기 때문이다.


                             General Restrictions

                             -    아래와 같이 General Restrictions에 위반되는 parallel DML이
                                  수행되면 error를 return하지 않고 serially 수행될 것이다.




                  jkspark@hanafos.com               - 31 -            장 경상
Oracle8 New Features                            http://www.ggola.com




                             -    한 transaction에서는 단 1회의 parallel DML만 허용되며 사전
                                  에 다른 serial DML이 수행되면 안된다.
                                  (이런 제약사항은 Oracle V8.0.3이하 버전에서만 유효하고 이후
                                  의 버전에서는 이미 수정되어 그런 제약은 없어졌다.)

                             -    이후 버전에서도 parallel DML이 발생한 후 commit or rollback
                                  없이 동일 table에 대하여 select 나 또 다른 parallel DML은 허
                                  용되지 않는다. 하지만, 다른 table에 대한 작업(parallel DML을
                                  포함하여)은 여전히 유효하다.
                                  또한, LOB type이나 user defined object type을 포함하는 table
                                  에 대한 parallel DML은 허용되지 않고 무조건 serially 처리된
                                  다.

                             -    한 transaction에서 Lock table or Select for update를 사용하면
                                  이후의 작업은 모두 serially로 진행된다.

                             -    no parallel insert on global index (to avoid self-deadlock)
                                  no parallel update on global unique index
                                  no parallel DML operation on tables
                                          contains LOBs or object types
                                  no parallel DML operations for bitmap indexes
                                  no parallel DML operations on clustered tables

                             -    Parallel DML이 정상적으로 수행되어도 triggers는 enable되지
                                  않는다. 즉, trigger를 사용하는 replication을 사용할 수 없다.


                             Transaction and Process Recovery for Parallel DML
                             -    Transaction Recovery(for system and instance recovery)
                                  1. SMON에 의해서 수행된다. Parallel DML이 있는 transaction
                                  의 recovery는 serially 처리될 것이며 recovery가 완료될 때까
                                  지 all resources locked된다. 그러므로 forward transaction에서
                                  high degree를 사용한 경우 original(forward) transaction의
                                  rollback보다 recovery가 take much longer될 수 있다.
                                  2. 따라서 이렇게 instance가 비정상 종료로 인해 recovery할 때
                                  는 to speed up the recovery process, rerun 앞서 비정상 종료되
                                  었던 the parallel DML statement and return commit or rollback
                                  하라.
                                   a user-issued rollback does not require recovery.

                             -    Process Recovery
                                  1. Single slave가 fail되면 PMON이 그 작업을 rollback할 것이
                                  고 나머지 slave는 그들 자신의 작업을 rollback할 것이다.
                                  2. Multiple slave가 fail되면 PMON이 serially하게 rollback을
                                  대행할 것이다.
                                  3. Coordinator process가 fail되면 PMON이 coordinator를
                                  recover할 것이고 all slave processes는 parallel하게 자신들의
                                  작업을 rollback할 것이다.




                  jkspark@hanafos.com               - 32 -                 장 경상
Oracle8 New Features                         http://www.ggola.com




                                  4. 따라서 Process recovery time은 the forward work와 비슷하
                                  거나 더 오래 걸릴 것이다.




                  jkspark@hanafos.com           - 33 -              장 경상
Oracle8 New Features                                http://www.ggola.com




5. Identifying New ROWID Structure


Addressing formats

                                  Oracle8에서 새롭게 강화된 기능들은 결국 addressing format
                                   에 대한 변경을 요구하게 되었고 따라서 New
                                   ROWID(Extended ROWID)가 탄생하게 되었다.

                                  대표적으로 Larger Database, Many more datafiles, Many
                                   more tablespaces, Efficient access to partitioned objects 이러한
                                   것들을 예로 들 수 있다.



New ROWID(Extended ROWID)

                             Why is a new ROWID Format Needed ?

                             -    기존의 ROWID는 file, block, row number로 구성되어 있었으
                                  나 이제 Oracle8에서 datafile number는 보다 더 많은 의미를
                                  표현할 필요가 있게 되었다.

                             -    Because Oracle8은 partitioned table이 multiple segments를
                                  가질 수 있고 각 segment는 분리된 tablespace에 위치할 수
                                  있다라는 것을 지원하므로 segment를 표현해야 하는
                                  ROWID에는 부가적인 정보가 필요할 수 있게 되었다.

                             -    Oracle uses ROWID as a unique identifier for a row in B-tree
                                  indexes and in internal algorithms.

                             -    DBA_DATA_FILES의 FILE_ID는 database에서 unique하고,
                                  DBA_DATA_FILES의 RELATIVE_FNO는 tablespace에서
                                  unique하다. (because of PARTITON)


                             New ROWID Format
                             SQL> select rowid from table ;
                             ROWID
                             --------------------------------------
                             AAABeVAAEAAAATRAAA
                             …………….

                             -    64 encoding 방식으로 알파벳 대소문자 + 숫자 + '+', '-' 기호로
                                  표현된다. (A~Z, a~z, 0~9, +, -)

                           AAABeV (6자리)            AAE (3자리)          AAAATR (6자리)        AAA (3자리)

                             Data object #      Relative file #       Block #    Slot #




                  jkspark@hanafos.com                   - 34 -                  장 경상
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4
Oracle History #4

More Related Content

Viewers also liked

Viewers also liked (7)

Oracle History #9
Oracle History #9Oracle History #9
Oracle History #9
 
NO PARALLEL DML
NO PARALLEL DMLNO PARALLEL DML
NO PARALLEL DML
 
O10g security 12
O10g security 12O10g security 12
O10g security 12
 
O10g miscellaneous 17
O10g miscellaneous 17O10g miscellaneous 17
O10g miscellaneous 17
 
iron deficiency anemia
iron deficiency anemiairon deficiency anemia
iron deficiency anemia
 
clostridium diarrhea
clostridium diarrheaclostridium diarrhea
clostridium diarrhea
 
Oracle History #7
Oracle History #7Oracle History #7
Oracle History #7
 

Similar to Oracle History #4

Sql Server 2005 개요
Sql Server 2005 개요Sql Server 2005 개요
Sql Server 2005 개요beamofhope
 
[HaU] 신입 기술 면접 준비 java
[HaU] 신입 기술 면접 준비 java[HaU] 신입 기술 면접 준비 java
[HaU] 신입 기술 면접 준비 java유리 하
 
No sql survey report
No sql survey reportNo sql survey report
No sql survey reportGichan Lee
 
몽고디비교육1일차
몽고디비교육1일차몽고디비교육1일차
몽고디비교육1일차seung-hyun Park
 
Introduction to Apache Tajo
Introduction to Apache TajoIntroduction to Apache Tajo
Introduction to Apache TajoGruter
 
제프리 리처의 Windows via C/C++ : 8장 유저 모드에서의 스레드 동기화
제프리 리처의 Windows via C/C++ : 8장 유저 모드에서의 스레드 동기화제프리 리처의 Windows via C/C++ : 8장 유저 모드에서의 스레드 동기화
제프리 리처의 Windows via C/C++ : 8장 유저 모드에서의 스레드 동기화sung ki choi
 
Presto User & Admin Guide
Presto User & Admin GuidePresto User & Admin Guide
Presto User & Admin GuideJEONGPHIL HAN
 
Jpa 쿼리 포함 자료
Jpa 쿼리 포함 자료Jpa 쿼리 포함 자료
Jpa 쿼리 포함 자료Hyosang Hong
 
Jpa 쿼리 포함 자료
Jpa 쿼리 포함 자료Jpa 쿼리 포함 자료
Jpa 쿼리 포함 자료Hyosang Hong
 
Sql 중심 코드 탈피 발표자료
Sql 중심 코드 탈피 발표자료Sql 중심 코드 탈피 발표자료
Sql 중심 코드 탈피 발표자료ssuser776e2d
 
NoSQL 간단한 소개
NoSQL 간단한 소개NoSQL 간단한 소개
NoSQL 간단한 소개Wonchang Song
 
Java collections framework
Java collections frameworkJava collections framework
Java collections framework경주 전
 
Scala 기초 (3)
Scala 기초 (3)Scala 기초 (3)
Scala 기초 (3)명성 정
 
10장 클래스
10장 클래스10장 클래스
10장 클래스kidoki
 
Tajo and SQL-on-Hadoop in Tech Planet 2013
Tajo and SQL-on-Hadoop in Tech Planet 2013Tajo and SQL-on-Hadoop in Tech Planet 2013
Tajo and SQL-on-Hadoop in Tech Planet 2013Gruter
 
Fundamentals of Oracle SQL
Fundamentals of Oracle SQLFundamentals of Oracle SQL
Fundamentals of Oracle SQLJAEGEUN YU
 
Sql 중심 코드 탈피
Sql 중심 코드 탈피Sql 중심 코드 탈피
Sql 중심 코드 탈피ssuser776e2d
 
쿠버네티스의 이해 #1
쿠버네티스의 이해 #1쿠버네티스의 이해 #1
쿠버네티스의 이해 #1상욱 송
 

Similar to Oracle History #4 (20)

Sql Server 2005 개요
Sql Server 2005 개요Sql Server 2005 개요
Sql Server 2005 개요
 
[HaU] 신입 기술 면접 준비 java
[HaU] 신입 기술 면접 준비 java[HaU] 신입 기술 면접 준비 java
[HaU] 신입 기술 면접 준비 java
 
No sql survey report
No sql survey reportNo sql survey report
No sql survey report
 
Linq
LinqLinq
Linq
 
몽고디비교육1일차
몽고디비교육1일차몽고디비교육1일차
몽고디비교육1일차
 
Introduction to Apache Tajo
Introduction to Apache TajoIntroduction to Apache Tajo
Introduction to Apache Tajo
 
제프리 리처의 Windows via C/C++ : 8장 유저 모드에서의 스레드 동기화
제프리 리처의 Windows via C/C++ : 8장 유저 모드에서의 스레드 동기화제프리 리처의 Windows via C/C++ : 8장 유저 모드에서의 스레드 동기화
제프리 리처의 Windows via C/C++ : 8장 유저 모드에서의 스레드 동기화
 
Presto User & Admin Guide
Presto User & Admin GuidePresto User & Admin Guide
Presto User & Admin Guide
 
Jpa 쿼리 포함 자료
Jpa 쿼리 포함 자료Jpa 쿼리 포함 자료
Jpa 쿼리 포함 자료
 
Jpa 쿼리 포함 자료
Jpa 쿼리 포함 자료Jpa 쿼리 포함 자료
Jpa 쿼리 포함 자료
 
Sql 중심 코드 탈피 발표자료
Sql 중심 코드 탈피 발표자료Sql 중심 코드 탈피 발표자료
Sql 중심 코드 탈피 발표자료
 
NoSQL 간단한 소개
NoSQL 간단한 소개NoSQL 간단한 소개
NoSQL 간단한 소개
 
Java collections framework
Java collections frameworkJava collections framework
Java collections framework
 
7 8 1
7 8 17 8 1
7 8 1
 
Scala 기초 (3)
Scala 기초 (3)Scala 기초 (3)
Scala 기초 (3)
 
10장 클래스
10장 클래스10장 클래스
10장 클래스
 
Tajo and SQL-on-Hadoop in Tech Planet 2013
Tajo and SQL-on-Hadoop in Tech Planet 2013Tajo and SQL-on-Hadoop in Tech Planet 2013
Tajo and SQL-on-Hadoop in Tech Planet 2013
 
Fundamentals of Oracle SQL
Fundamentals of Oracle SQLFundamentals of Oracle SQL
Fundamentals of Oracle SQL
 
Sql 중심 코드 탈피
Sql 중심 코드 탈피Sql 중심 코드 탈피
Sql 중심 코드 탈피
 
쿠버네티스의 이해 #1
쿠버네티스의 이해 #1쿠버네티스의 이해 #1
쿠버네티스의 이해 #1
 

More from Kyung Sang Jang (12)

Oracle History #14
Oracle History #14Oracle History #14
Oracle History #14
 
O10g flashback 13
O10g flashback 13O10g flashback 13
O10g flashback 13
 
O10g data control_10
O10g data control_10O10g data control_10
O10g data control_10
 
O10g bak rec_15
O10g bak rec_15O10g bak rec_15
O10g bak rec_15
 
O10g asm 16
O10g asm 16O10g asm 16
O10g asm 16
 
O10g app support_11
O10g app support_11O10g app support_11
O10g app support_11
 
Oracle History #8
Oracle History #8Oracle History #8
Oracle History #8
 
Oracle History #6
Oracle History #6Oracle History #6
Oracle History #6
 
Oracle History #5
Oracle History #5Oracle History #5
Oracle History #5
 
OracleHistory2
OracleHistory2OracleHistory2
OracleHistory2
 
OracleHistory1
OracleHistory1OracleHistory1
OracleHistory1
 
11g nf sql_anlz
11g nf sql_anlz11g nf sql_anlz
11g nf sql_anlz
 

Oracle History #4

  • 1. New Features for Administrators (Oracle8) Oct, 2000 CloudBox Jang Kyung Sang
  • 2. Oracle8 New Features http://www.ggola.com Oracle Server Position Understanding the figure * ORACLE8 특징 VLDB Solution : Operating - partition, rman / System OLTP Solution : Oracle8 - Advanced Queuing, Net8 Object Solution : SQL, PL/SQL - method Too ls Application Clie nt Clie Clie nt nt Clie Clie nt Clie nt nt Course 1. Using Partitioning 2. Implementing Partitioned Indexes 3. Commands and Guidelines for Partitioned Tables and Indexes 4. Parallelizing Insert, Update and Delete Operations 5. Identifying New Rowid Structure 6. Defining Object Relational Features 7. Managing Large Objects 8. Implementing Oracle Advanced Queuing 9. Using Additional New Features 10. Introduction to Recovery Manager (RMAN) 11. Advanced RMAN 12. Enhancements to Networking 13. Implementing Password Management 14. Migration Server and Applications jkspark@hanafos.com -2- 장 경상
  • 3. Oracle8 New Features http://www.ggola.com 1. Using Partitioning Why?  VLDB for very large database (수백 기가에서 테라까지)  Availability  Management  Scalability What is Partition? Sample script create table order (ord_year number(4), ord_month number(2), ord_day number(2), ord_id number(10)) partition by range (ord_year, ord_month, ord_day) (partition p1 values less than (1997, 07, 01) tablespace data01, partition p2 values less than (1997, 08, 01) tablespace data02, partition p3 values less than (1997, 09, 01) tablespace data03 ) partition p4 values less than (MAXVALUE,MAXVALUE,MAXVALUE) tablespace data04) Partitioned tables and indexes - They can be decomposed into smaller pieces called partitions. - A range of key values를 기반으로 partition - VLDB 환경에 유용하다. - Supports up to 64,000 partitions per single table or index (1개의 table or index가 64,000개까지의 segment로 구성될 수 있다) Attribute - 동일 table or index의 partition별 columns, datatypes등 partition의 logical attribute는 항상 일치 해야 한다.. - But partition별 storage는 다양하고 서로 다르게 설정할 수 있 다. jkspark@hanafos.com -3- 장 경상
  • 4. Oracle8 New Features http://www.ggola.com Components - partition key : partition을 구분할 key가 되는 column으로 최대 16개 까지 composite key 가능하지만 나중에 alter로 column modify할 수는 없다. - values less than : 상수만 사용이 가능하며 유일한 사용가능 function은 TO_DATE, RPAD 뿐이다. (value 중간에 빠지는 값은 안된다. 예를 들어 1~3, 5~6, 8~9 처 럼 중간에 4나 7을 임의로 뺄수는 없다) - physical attributes : partition별 storage를 다르게 설정할 수 있 다. CF. table partition과 index partition은 별개의 문제이므로 partition 구성은 서로 영향을 주지 않는다. - Long, Long Raw, LOB Type은 partition table을 지원하지 않는 다. (ORA-14085 error 발생) Using Partition Values less than - values less than 에서 지정한 value는 자기 값을 포함하지 않는 다. CF. values less than (5) 라면 5보다 작은 값을 지정한다. - Insert하려는 value가 가장 큰 값의 partition bound와 동일하거 나 크면 실패한다. CF. last partition에 지정된 value에는 사실 implicit check constraint가 적용된다. (Data Dictionary에는 기록되지 않음) - Last Partition에 value 대신 MAXVALUE Key word를 사용하 여 이전 partition value를 제외한 나머지 모든 값에 대한 insert 를 허용할 수 있다. (NULL을 포함할 수 있다) CF. NULL value는 모든 values보다 큰 sort값을 갖으므로 maxvalue key word를 사용해야만 insert가 가능하다. CF. maxvalue key word를 사용하면 implicit check constraint를 사용하지 않는다. CF. 2개 이상의 columns로 partition key가 이루어 져도 maxvalue key word를 사용할 수 있지만, last partition이 아니 라면 첫번째 key column에는 사용할 수 없다. - update를 통해 partition key에 해당하는 data를 수정시 그 변경 된 값이 partition을 이동해야 한다면 ORA-14402 error를 받을 것이다. 즉, 이런 경우에는 해당 data를 delete한 후 다른 partition으로 insert를 해야한다. (Oracle8i부터 해결) jkspark@hanafos.com -4- 장 경상
  • 5. Oracle8 New Features http://www.ggola.com Multicolumn partitioning - 2개 이상의 column들로 partition key를 구성할 수 있으며 최대 16개까지 가능하다. CF. Date를 나타내기 위해 년, 월, 일로 column을 나누어 정하 여 partition key로 사용하는 경우도 있다. Equipartitioned Tables and Indexes - 동일한 logical partitioning attributes를 갖는 두개 이상의 objects에 대해 equipartition이 가능하다. - Prerequisite : 1. Same number of partitions 2. Same values less than boundaries 3. Same number, datatype(length, precision, scale) - Consideration point : 1. Using equipartitioning reduces the downtime and the amount of data that is unavailable during partition maintenance operations and tablespace recovery operations. 2. Data-management time is relative to partition sizes. 3. Other unaffected partitions can be accessed at the same time. 4. table과 그 index들이 equipartition 되면, the effect of move PARTITION can be limited to one table partition and the corresponding index partitions - Generally PK 대 FK tables 혹은 Table 대 PK Index로 equipartition구성할 때 효과적이다. Account_no Account PK Same Partition FK Acct_no Check Acct < 100 Acct < 200 Acct < 300 Acct < …n jkspark@hanafos.com -5- 장 경상
  • 6. Oracle8 New Features http://www.ggola.com Using Advanced Partition Partition Extended Table Names - partition으로 구성된 table을 사용할 때 그 table의 특정 partition만을 지정해서 사용할 수 있다. 즉, DML을 구사할 때 에 table name 옆에 partition을 지정함으로써 특정 partition에 서만 select, insert, update, delete가 가능해 진다.  select * from account PARTITION(PART03) where …. ; - 단, 이러한 특정 partition을 지정하는 DML은 PL/SQL이나 DB Link와 같이 remote access를 하는 경우 인식할 수 없다.  따라서 이런 경우에는 partition별로 view를 만듦으로써 원 하는 작업결과를 얻을 수 있다. 이들 view는 partition별로 지정 이 가능할 뿐만 아니라 각각의 단위 별로 grant도 다르게 줄 수 있다. Parallel DDL - partition을 다루는 다음과 같은 command들도 Parallel 처리를 지원한다.  CREATE (partition) INDEX CREATE (partition) TABLE AS SELECT ALTER TABLE MOVE PARTITION ALTER TABLE SPLIT PARTITION ALTER INDEX REBUILD PARTITION - 일반적으로 different operation마다 different parallelism이 사 용되는데, create table as select 와 create index는 partition별 동 일한 a degree of parallelism을 사용한다. DML Partition Locks - DDL이나 partition별 operation의 원할한 사용을 위해서 Oracle8은 partition independence를 지원하다. 즉, partition별 Locking처리가 가능하다. - Partition Lock은 Table Lock 과 Row Lock 사이의 중간단계에 위치하는 Lock으로 정의될 수 있고, 이는 동일 table에 여러 user들이 concurrently access시 partition data를 보호 하는데 그 목적이 있다. CF. partition lock은 table처럼 S, X, SS, SX, SSX Lock mode가 있다. - Table and Partition Locks are acquired at different times. 1. Table Lock은 parsing에서 결정되고 execution시(cursor jkspark@hanafos.com -6- 장 경상
  • 7. Oracle8 New Features http://www.ggola.com start) 획득된다. 2. Partition Lock은 execution시 결정되고 획득된다. (bind variable은 실행 시 결정되기 때문이고, 또한 partition key 이외의 값으로 SQL문이 생성되는 경우가 많기 때문이다. 물론, 명시적으로 partition key 값을 비교하도록 구성한다면 그 경우 partition lock도 parsing시 결정되고 execution시 획득될 것이 다. 3. OPS(Oracle Parallel Server)에서는 table locks 이나 partition locks 모두 performance에 영향을 줄 수 있기 때문에 'DML_LOKCS=0' parameter를 사용하거나 특정 table에 대하여 'ALTER TABLE table_name DISABLE TABLE LOCK' command 를 사용 함으로써 performance 향상을 꾀 할 수 있다. 단, 이런 경우 DDL command를 사용할 수 없다. Operations One-step Operation 1. ALL DDL은 one-step operation이지만, ' CREATE INDEX' or 'ALTER TABLE REBUILD INDEX'의 경우는 예외다. 2. Alter table add column 같은 dictionary operation은 매우 빠르 게 진행되고 exclusive dictionary lock과 함께 DML Lock을 잡 고 other operation을 허용하지 않는다. CF. queries can be run simultaneously Three-step Operation 1. Read dictionary while holding share dictionary locks 2. Acquire share lock on a table or partition, release the dictionary locks, and scan and update the table partition or index partition 3. Acquire exclusive dictionary locks and update the dictionary while holding exclusive locks CF. long running operation이지만, less restrictive DML locks이어 서 running중 other operation이 가능하다. Affected partition만 exclusive mode로 잡힌다, Table is locked in shared mode. CF. 이들 operation을 일으키는 command는 : 'Alter Table: Drop/Modify/Move/Split/Exchange Partition' 'Rebuild Unusable (local indexes)' ' Create Index (global indexes)' 'Alter Index Rebuild Partition(global indexes)' 'Direct Path Load Table Partitions' jkspark@hanafos.com -7- 장 경상
  • 8. Oracle8 New Features http://www.ggola.com Benefits of Partitioning High Availability - backup and restore operation을 비롯하여 query나 DML시 동 일 table이나 index를 사용하는 다른 partition에 영향을 주지 않는다. 즉, Partition별로 management 된다.  one partition이 unavailable이어도 other partitions can be used. Ease of Administration (Manageability) - tablespace간에 partition move가 가능하고 partition별 drop, add, truncate도 할 수 있다. - partition은 a user-defined value로 나누어질 수 있다. - DML을 table level 대신에 partition level로 사용할 수 있다. - partitions을 다루기 위한 a variety command를 제공한다.  commands : Alter Table (Add/Drop/Truncate/Move/Split/Exchange) Partition Improved Performance - Optimizer는 scan에 필요하지 않는 partition은 작업하지 않는 다. - Partition은 parallel로 scan될 수 있고 또한 parallel로 insert, update, delete될 수 있다. - sort를 위한 temporary area size가 감소한다. - partition을 physical devices에 나눔으로써 load-balance가 가능 하다. - MPP 환경에서 CPU-disk affinity control이 가능하다. - OPS에서 특정노드에 대해 data의 ownership을 강제할 수 있 다. jkspark@hanafos.com -8- 장 경상
  • 9. Oracle8 New Features http://www.ggola.com 2. Implementing Partitioned Indexes Partitioned Indexes Index Strategy - Index는 partitioned index 와 non-partitioned index 로 나누어 지며 DBA와 개발자의 요구에 맞도록 선택해야 한다. (단, cluster index는 partition될 수 없다) - Index strategy를 위한 고려대상 1. Type of access to data through the applications 2. Performance in accessing data 3. Availability in case of disk failure 4. Are parallel operations possible ? Types of Indexes  Oracle8 supports four types of indexes.  Availability, Performance, Manageability Prefixed Indexes create index glob_orders on orders (ord_year, ord_month, ord_day) global partition by range (ord_year, ord_month, ord_day) ( partition p1 values less than (1997,08,16) tablespace index01, partition p2 values less than (maxvalue,maxvalue,maxvalue) tablespace index02 ) ; - Partition Key의 columns들과 Index의 leftmost columns은 same order and number of columns 가 되어야 한다. - 이 Index가 Unique Index로 구성된다면 이 data를 가져오기 위 해선 하나의 partition만 access할 것이다. 물론, nonunique index라도 where절의 조건에 partition key에 해당되는 column 이 모두 기술된다면 역시 하나의 partition만 access할 것이다. Nonprefixed Indexes create index loc_nonpre_orders on order (ord_id) local ; jkspark@hanafos.com -9- 장 경상
  • 10. Oracle8 New Features http://www.ggola.com - partition key와 동일한 columns을 leftmost columns으로 하지 않는 Index는 모두 nonprefixed index다. - Unique nonprefixed index는 index key부분으로 partition key 를 포함해야 하며, data를 가져오기 위해선 하나의 partition만 access할 것을 보장해야 한다. - Nonunique nonprefixed indexes는 data를 가져오기 위해서 all partitions을 scan해야 한다. Global / Local Indexes 1. Nonpartitioned indexes : Just Global Index 2. Global prefixed indexes : Index Key Column과 Partition Key의 leftmost가 같지만 underlying table과는 별개이다. 물론 underlying table과 key를 동일하게 만들 수도 있지만 equipartition 되지 않는다. 즉, global은 global이다. 3. Local prefixed indexes : Partition Key의 columns이 Index의 leftmost columns 과 일치한다. 4. Local nonprefixed indexes : Partition Key의 columns이 Index의 leftmost columns 과 일치하지 않는다. Global Prefixed Indexes create index glob_orders on orders (ord_year, ord_month, ord_day) global partition by range (ord_year, ord_month, ord_day) ( partition p1 values less than (1997,08,16) tablespace index01, partition p2 values less than (maxvalue,maxvalue,maxvalue) tablespace index02 ) ; - Normally, 기초 table partition과 동일한 equipartitioned index 가 아니다. 물론, 강제로 equipartitioned index로 만들 수는 있 으나 Oracle은 이러한 경우 equipartitioning 관리를 자동으로 해주지 않으며 SQL plan 설정할 때에도 무시되므로 equipartitioned index는 반드시 Local로 만들자. 즉, 강제로 key 를 일치시켜도 global index이므로 partition independence를 지원하지 않는다. - Unique or Nonunique 모두 가능하며, The highest partition은 maxvalue를 partition bound로 가져야 한다. 즉, 'MAXVALUE' 가 꼭 지정되어야 한다. jkspark@hanafos.com - 10 - 장 경상
  • 11. Oracle8 New Features http://www.ggola.com - 일반적으로 global index는 local index보다 관리가 더 어렵다. 왜냐하면, 대상 table의 partition이 수정되면 global index는 전 partition이 영향을 받기 때문이다. Local Prefixed Indexes create unique index loc_pre_orders on orders (ord_year, ord_month, ord_day, ord_id) local ( partition p1 tablespace index01, partition p2 tablespace index02, partition p3 tablespace index03 ) ; - All rows in a table partition have a corresponding index entry in the index partition. (partition key의 leftmost columns는 index 되어야 한다) CF. 만일, name and location을 지정하지 않으면 대상 table의 partition name과 똑같이 만들어지고 default tablespace에 index data가 생성될 것이다. - Local Index는 각 partition별 maintenance operation이 가능하 므로 maintenance operation 동안 다른 partition에 대한 concurrently SELECT and DML이 가능하다. - MPP platforms에서의 parallel processing의 강점을 갖는다. - Unique or Nonunique 모두 가능하다. Local Nonprefixed Indexes create index loc_nonpre_orders on orders (ord_id) local ( partition p1 tablespace index01, partition p2 tablespace index02, partition p3 tablespace index03 ); - Nonunique일 수 있다. - Partition key가 index key의 subset일 때에만 unique가 가능하 다. ※ table partition key에 포함 되지않은 columns에 대한 query의 fast access가 필요한 경우 유용하다.  prefixed VS nonprefixed indexes : prefixed index는 queries and DML시 access할 only one partition에 대해 작업을 진행하지만, nonprefixed index는 n개의 partition 즉, 몇 개가 될지 모르는 jkspark@hanafos.com - 11 - 장 경상
  • 12. Oracle8 New Features http://www.ggola.com partition에 대해 작업을 진행하므로 prefixed index의 효율이 더 좋 다. Partition index  global과 local을 어떻게 결정할 것인가? PREFIXED  local에서 prefixed 와 nonprefixed를 어떻게 결정할 것인가? Unique data 유용 CF. local prefixed index : best performance, availability, manageability OLTP GOOD 1. Table partition key 와 index partition key의 leftmost columns이 GLOBAL LOCAL 일치 하는가 ?  local prefixed index X DSS 2. 그렇지 않다면, unique index on a nonpartitioning column ?  Global prefixed index PQ option 유용 3. 그렇지 않다면, manageability의 효율보다 higher availability를 NONPREFIXED 위해 performance overhead를 감수할 것인가 ?  Local nonprefixed index 4. 그렇지 않다면, DSS system 인가?  Local nonprefixed index 5. OLTP 인가?  Global Prefixed index Index Unusable(IU) - Import partition or conventional path SQL*Loader는 local index maintenance를 bypass할 수 있는 option을 제공한다. 이 런 경우 import가 끝나면 관련된 local index partition은 IU로 mark된다. 즉, index unusable로 설정된다. - Direct path SQL*Loader 또한 작업이 complete successfully 되 지 않으면 local index partitions and global indexes도 IU가 된 다. - ROWID에 변경을 주는 alter table move partition command도 관련 local and global index partition을 IU로 만든다. CF. 기타 : alter table truncate partition  global index partition  IU alter table split partition  local index partition  IU alter index split partition  index partition  IU jkspark@hanafos.com - 12 - 장 경상
  • 13. Oracle8 New Features http://www.ggola.com - IU상태가 된 partitions은 그 partition을 사용하는 queries or DML이 execute 되기 전에 rebuild 하라. (IU가 아닌 다른 partition index data는 여전히 유효하므로 IU partition외의 data를 scan하는 작업은 이상이 없을 것이다. - IU 상태가 된 nonpartitioned indexes는 drop 후 re-create 해야 사용할 수 있다. Parallel scan Parallel table scan SQL> select /*+ PARALLEL(EMP, 9) */ * from emp ; - ROWID에는 partition numbers가 기록되므로 parallel table scan은 rowid를 통해서 이루어진다. - 기존 버전에 존재하던 Parallel Query를 위한 process들은 이제 rowid에 의해 각 partition별로 나누어져서 작업을 처리하게 될 것이다. Parallel index scan SQL> select /*+ PARALLEL (I2, 3) */ * from emp where person = 'a' ; - Index partition별로 different slaves를 사용하여 index scan이 parallel로 가능해진다. (위의 예는 I2라는 index가 3개의 partition으로 구성된 partitioned index라는 예측을 가능케 한 다.) - Parallel query slaves는 partitions 수만큼 지정할 수 있다. 즉, 하 나의 partition에는 maximum 하나의 slave만 가능하다. jkspark@hanafos.com - 13 - 장 경상
  • 14. Oracle8 New Features http://www.ggola.com 3. Commands and Guidelines for Partitioned Tables and Indexes Alter command for partitions Alter table drop partition SQL> alter table order drop partition p1 ; - this command는 table order에서 partition p1을 remove하고 그 안에 존재하던 data까지 동시에 삭제한다. - 이런 명령은 주기적으로 없어지는 old data를 가지는 historical data 관리에 유용하다. CF. if partition을 drop하고 그 안의 data는 살리고 싶다면 해당 partition을 adjacent partition에 merge함으로써 해결할 수 있 다. CF. if data를 dropped partition에 insert하려하면, dropped partition보다 바로 높은 value의 partition에 자동으로 저장되 겠지만, 만일 dropped partition이 해당 table의 highest partition이면 거기에 해당되는 insert는 fail될 것이다. - 또한, this command는 해당 local index의 partition도 함께 drop시킬 것이다. (해당 index의 status가 IU 이건 아니건 상관 없이) - if global index가 정의되어 있는 table의 data가 들어있는 partition을 drop하는 경우, all global indexes partition은 IU 상 태가 될 것이다. 따라서 이런 경우 index rebuild를 해야 하는데 만일 rebuild하기가 싫다면 partition을 drop하기 전에 drop할 partition에 있는 모든 data를 delete로 일일이 제거하고 나서 그때 partition을 drop해야 한다. Partition drop or Row delete partition을 drop할 것인가 row를 delete할 것인가. - global index의 지속적인 사용 즉, availability가 가장 중요하다 면 partition drop보다는 rows를 delete하라. - table에 global index가 많거나, drop되는 partition의 row수가 전체 total row수에 비해 적은 portion을 차지한다면, Row delete가 global index rebuild 보다 cost가 적을 것이므로 partition drop보다는 row delete를 선택하라. jkspark@hanafos.com - 14 - 장 경상
  • 15. Oracle8 New Features http://www.ggola.com - 위와 반대의 경우 즉, global index의 수가 적거나 delete할 data 가 상당히 많다면 오히려 partition drop후 global index rebuild 가 더 적은 cost를 발생시킬 것이다. - table의 FK가 enable되어 있고 partition에 data가 있다면 drop partition은 error가 날 것이다. 이런 경우 FK를 delete하던가 아 니면 row delete 후 partition을 drop해야한다. 또한 table이 하 나의 partition으로 구성되어 있을 때에도 partition drop은 할 수 없고 table을 drop해야 한다. Alter index drop partition (allowed for global indexes only) SQL> alter index order_idx drop partition p1 ; - this command는 partition을 remove하고 partitioned global indexes로부터 그 안에 존재하는 index entries를 모두 삭제한 다. 이 작업은 index I/O load를 rebalance하는데 사용될 수 있 다. - This command는 global index에만 유효하며 local index partition은 explicitly drop할 수 없다. 또한 the highest partition은 drop할 수 없다. - partition을 drop하면 value boundaries는 the next highest partition에 merge된다. 또한 dropped partition에 해당되는 data가 insert되면 바로 the next higher partition에 저장된다. 만 일 data를 가진 partition을 drop했으면 the next highest partition은 IU status가 되고 반드시 rebuild해줘야 사용할 수 있다. CF. IU status의 partition도 drop될 수 있다.  table or index partition의 name을 바꿀 수 있다. 물론, index의 경우 IU status partition도 name change에는 아무 상관이 없다. SQL> Alter table order rename partition p1 to old_p1 ; SQL> Alter index order_idx rename partition IX_p1 to old_IX_p1 ; Alter table add partition SQL> alter table order add partition p4 values less than (1998, 09, 01) tablespace data04 ; - this command는 오직 the high end of the table에 partition을 add할 때에만 사용될 수 있다. 따라서 partitioning key columns value가 단조롭게 증가하는 형태에 유용하다. CF. table의 시작이나 중간에 partition을 추가하고 싶으면 'SPLIT PARTITION' command를 사용하라. - 만일, 가장 마지막 partition즉 high partition의 the first element 가 'MAXVALUE'를 사용했으면 이 때에도 add partition은 할 jkspark@hanafos.com - 15 - 장 경상
  • 16. Oracle8 New Features http://www.ggola.com 수가 없다. 이런 경우에도 split partition을 이용하여야 한다. CF. 물론, the high partition의 첫번째가 아닌 the second element 이상의 값에서 'MAXVALUE'를 사용한 경우는 add partition은 문제없이 수행이 된다. - 이런 add partition은 관련 local index에 a matching partition 또한 추가하는데 그 이름은 table partition의 그것과 동일하다. Physical storage는 the base index의 것을 default로 사용하며 또한 added partition of the underlying table 과 동일한 tablespace에 위치한다. CF. 위 내용은 Global Index에는 적용되지 않으며 Index Partition의 status가 IU라도 상관없이 add partition은 가능하 다.  table or index partition을 modify 할 수 있다. SQL> Alter table order modify partition p1 storage (maxextents 512) ; partition별 table의 physical storage를 변경할 수 있다. (move partition command로 partition을 다른 tablespace로 옮길 수 있다) SQL> Alter index order_idx modify partition IU_p1 storage (maxextents 512) ; SQL> Alter index order_idx modify partition IU_p1 unusable ; global or local partitioned index에 대하여 partition별 physical storage를 변경할 수 있다. (rebuild partition command로 partition을 다른 tablespace로 옮길 수 있다) (UNUSABLE Index는 rebuild나 drop and re-create로 USABLE로 만들 수 있다) Alter table/index modify physical attributes SQL> alter table order pctfree 0 pctused 20 ; - partitioned and nonpartitioned table 모두 적용할 수 있다. - modified attributes는 existing partition의 attributes을 modify 하기위해 사용되지 않는다. partitioned table의 default physical attributes의 변경은 add partition으로 추가되는 partition에만 적용된다. SQL> alter index order_idx maxtrans 20 storage ( next 10M ) ; - partitioned and nonpartitioned index 모두 적용할 수 있다. - modified attributes는 existing partition의 attributes을 modify 하기위해 사용되지 않는다. partitioned index의 default jkspark@hanafos.com - 16 - 장 경상
  • 17. Oracle8 New Features http://www.ggola.com physical attributes의 변경은 미래에 new partition이 새로 만들 어 질 때에만 적용된다. - Modified attributes가 global index에 대한 변경 이라면 alter index split partition을 통해 생성된 new partition에 적용된다. 하지만 만일 local index라면 new partition이 created implicitly by 'alter table add partition, split partition'될 때 적용된다. CF. nonpartitioned index로서 IU status인 경우 이러한 alter operations is not allowed 이다. Unusable Index Operations SQL> alter table order modify partition p4 unusable local indexes ; - This command는 table partition과 matching되는 all local index partitions을 UNUSABLE로 만든다. 대량 insert후 추후 index생성 등 인덱스 관리가 DML operation이 완전히 종료된 후에 이루어져도 되는 상황에서 유용하게 사용될 수 있다. - 다음 command를 사용하여 unusable local index partitions 을 usable로 만들 수 있다.  alter index rebuild partition  alter table modify partition rebuild unusable local indexes : 이 명령은 해당 partition에 연관된 all the unusable local index 를 rebuild 한다. - Index IU status를 판단하기 위해 'DBA_/ALL_/USER_IND_PARTITIONS' data dictionary 확인 하라 - Table partition에 연관된 모든 unusable local index partitions 을 rebuild 하기  alter table order partition p1 rebuild unusable local indexes ; - index를 unusable 시키기  alter index order_idx unusable ; > 해당 index는 partition되어 있던 아니던 모두 가능하다. > this command는 a nonpartitioned index는 index를, partitioned index는 해당 index의 all partitions를 'INDEX UNUSABLE'로 만든다. > nonpartitioned index를 사용하기 위해선 rebuild하거나 재 생성을 해야 하지만 partitioned index는 한번에 한 partition씩 rebuild 해야 한다. 물론, partitioned index도 drop후 re-creation 을 해서 사용할 수 있다. CF. 일반적으로 global partitioned indexes는 partition별 rebuild보다는 drop and re-creation이 더 효과적이다. jkspark@hanafos.com - 17 - 장 경상
  • 18. Oracle8 New Features http://www.ggola.com Index Rebuild Partition SQL> alter index order_idx rebuild partition p1 tablespace index02 ; - alter index command는 한번에 하나의 partition을 rebuild할 수 있다. 이런 형태는 대량의 큰 index 전체를 다시 만들지 않고 문제된 partition만 repairing하는데 매우 유용하다. CF. 이 명령은 index partition을 다른 tablespace로 옮기거나 physical attribute를 바꾸는데 사용될 수도 있고 또한 split operation같은 작업의 final step으로 사용되기도 한다. 즉, 대개의 경우 index maintenance operation중 마지막 작업에 사용된다. - Rebuild partition은 parallelism을 지원하며 우선순위는 다음과 같다. 1. 직접 지정한 parallel clause 2. Default parallel attributes of the index 3. Default parallel attributes of the underlying table 4. Without using parallelism SKIP_UNUSABLE_INDEXES SQL> alter table modify partition p1 unusable local index ; SQL> alter session set skip_unusable_indexes = TRUE ; - 위 명령은 local index를 unusable로 하였지만 그 후에 발생하 는 insert,update,delete 작업을 가능케 한다. 즉, insert나 update, delete시 나타날 수 있는 index 관련 errors 는 override된다. CF. 일반적으로 bulk modification or load of a table partition을 위한 deferring index maintenance 에 사용된다. - The default value for "SKIP_UNUSABLE_INDEXES" parameter는 "FALSE"이다. CF. It is not possible to skip index maintenance on UNUSABLE unique indexes. Table Split Partition SQL> alter table orders split partition p1 at (1997, 06, 16) into (partition p1, partition p4) ; - 이 명령을 통해 하나의 partition을 새로운 두개의 partition으로 나눌 수 있다. split 이전의 old partition은 discard 된다. 즉, split 을 통해 new partition생성시 new segment 가 만들어 지는데 new physical attributes and initial extents를 지정하여 사용할 수 있고 split하기 이전의 partition name을 그대로 지정함으로 써 기존의 partition name을 살릴 수도 있다. jkspark@hanafos.com - 18 - 장 경상
  • 19. Oracle8 New Features http://www.ggola.com - Generally this command can be used when 하나의 partition이 너무 커져서 backup, recovery등 partition maintenance 작업이 to take too long 인 경우에 사용된다. 이 작업을 통해 우리는 redistribute the I/O load를 할 수도 있다. - partition이 split되면 해당 table의 corresponding partition in each local index defined on table 또한 matching split을 수행한 다. 해당 index가 INDEX UNUSABLE이어도 상관없이 진행된 다. CF. 앞서 이야기 했듯이 기존 partition name을 지정해서 재사 용하면 index도 마찬가지로 기존 name을 재사용하고 다만 새 로 추가되는 partition만 "SYS_Pn"의 이름으로 generation된다. 물론, 재사용을 하지 않고 새로운 이름을 지정하여 split 작업을 하면 새로 생기는 index partition은 모두 "SYS_Pn"의 형식을 따 른다. CF. 새로 생성되는 index partition은 parent local index의 physical attributes를 따르고 tablespace가 index 전체를 위해 define되지 않았다면, New local index partitions reside in the same tablespace as the corresponding newly created partitions of the underlying table. - Table Split partition시 해당 partition에 data가 없었다면 split complete과 동시에 Local Index는 valid partition이 된다. If data가 있었다면 split partition은 data를 가지는 partition을 INDEX UNUSABLE로 mark할 것이다. 이 경우 하나의 partition만 data가 존재하면 하나의 partition만 IU상태가 되고 나머지 다른 partition에 data가 없다면 그 partition만 valid될 수 있다. CF. Split partition중 fail이 발생하면 new segment는 drop되고 모든 작업은 rollback 된다. - 위 작업이 실행되면 대개의 경우 final step으로 하게되는 것이 INDEX UNUSABLE에 대한 처리이다. SQL> alter index rebuild partition ~~~~ ; Index Split Partition SQL> alter index order_idx split partition p1 at (1997, 06, 16) into (partition p1, partition p4) ; - 일반적인 속성은 table split partition과 같다. 다만, underlying table partition과 관계가 없다. - 즉, 이 명령은 global index에만 적용되며 설사 INDEX UNUSABLE 상태의 index라도 가능하다. 물론, 이런 경우나 data를 가진 index split의 경우엔 모두 INDEX UNUSABLE이 되므로 Index를 VALID로 만든 후 사용해야 한다. SQL> alter index rebuild partition ~~~ ; jkspark@hanafos.com - 19 - 장 경상
  • 20. Oracle8 New Features http://www.ggola.com - global index는 아무리 split을 통해 underlying table의 partition처럼 만들어도 equipartitioned local index는 될 수 없 다. 만일, 그러하길 원한다면 index drop 후 local index를 만들 어야 한다. Move Partition SQL> alter table order move partition p1 tablespace data05 ; - old partition's segment를 drop하고 new segment를 만든다. (move할 new tablespace지정하면 그곳으로 만일 tablespace를 지정하지 않는다면 단순한 recreation 즉, drop and create 절차 만을 진행한다)  partition을 다른 tablespace로 옮기기 위해  partition recreation으로 de-fragmentation 하기위해  change a physical attribute 하기 위해 CF. parallel clause 사용이 가능하다. - move할 partition이 not empty면 all affected index partitions은 INDEX UNUSABLE로 mark한다. Exchange Partition SQL> alter table order move exchange partition p1 ( source table) with table order_new (  target table) ( excluding indexes, including indexes) (with validation, without validation) ; - 이 명령은 두개의 table간에 partition은 nonpartitioned table로 table은 partitioned table의 한 partition으로 exchange할 수 있 도록 해준다. (by exchanging their data (and optionally index) segments) - 대상 table은 partitioned table 이거나 cluster 이어서는 안되며 exchange하려는 두 table에 대한 alter privileges 가 있는 user만 이 작업을 할 수 있다. CF. 어떤 constraint도 enable 되어서는 안된다. (exchange partition은 triggers에 영향을 주지 않는다.) CF. 작업하려는 tables은 두 table간에 columns 수 및 size and datatype이 모두 일치해야 한다. - this operation이 진행되면 partitioned table의 global index와 대상 table의 partitioned global indexes는 UNUSABLE로 mark 된다. jkspark@hanafos.com - 20 - 장 경상
  • 21. Oracle8 New Features http://www.ggola.com - With validation을 지정하고, 대상 table에 row가 not collate properly되면 error가 return된다. Without validation이 지정되면, 대상 table의 proper collation 을 확인하지 않으며, exchange partition을 analyze하고 invalid rows를 delete하여 작업결과가 logically correct되도록 한다. - Including indexes를 사용하면 source table의 모든 local index 는 target table의 regular index of the same type 이어야 하고 local index partition은 exchanged with the corresponding regular indexes. - Excluding index는 all the local index partitions 과 target table 의 all the regular indexes 을 UNUSABLE로 mark한다. - 다음의 예를 통해 exchange partition의 작업 흐름을 알아보자. 다음은 partitioned table 'order'에서 95년 data partition과 85년 data partition을 한 partition으로 묶어서 10년 비교를 하고자 함이다. 1) create table order_merge85 (..) tablespace ….. ;  옮기고 싶은 data를 가질 temporary용 table 생성 2) alter table order exchange partition order_85 with table order_merge85 without validation ;  exchange를 통해 table과 partition 교환 (table과 partition이 바뀌었으므로 data dictionary가 수정된 다) 3) alter table order drop partition order_85 ;  table로 변해버린 partition을 drop (free the segment originally order_merge85) 4) insert into order partition (order_95) select * from order_merge85 ;  move data to target partition 5) drop table order_merge85 ;  partition으로 변한 table을 drop (free the segment originally order_85) 6) alter table order rename partition order_95 to order_85-95 ;  필요하면 작업이 끝난 partition의 name 수정 Modify Logical Attributes SQL> alter table order add ( new_type varchar2(2)) ; - 일반적인 table modify와 동일하지만 partitioned table에 대해 서는 몇가지 제약이 따른다. 1. Table 이나 index partition에 사용된 column의 length or datatype은 바꿀 수 없다. 2. Long or long raw datatype column은 add할 수 없으며 이미 존재하는 long or long raw column의 datatype도 바꿀 수 없다. 3. Table partition중 하나이상이 read-only tablespace에 존재한 다면 jkspark@hanafos.com - 21 - 장 경상
  • 22. Oracle8 New Features http://www.ggola.com  user-specified default value를 갖는 column을 add할 수 없 다.  varchar2(or varchar) column은 char(or character)로 변경할 수 없다.  char(or character) column의 length를 증가시킬 수 없다. - Alter command 로 Unique or primary key를 add하거나 enable 하면 1. 해당 column에 index가 존재하면  unique index이면 oracle은 그 index를 사용할 것이며 그 index는 global nonpartitioned, global partitioned, local prefixed, local nonprefixed index등 모든 index가 대상이 될 수 있으나 nonprefixed index의 경우엔 partitioning key를 가져야 한다.  unique index가 아니면 alter statement는 error를 return할 것이다.  unique index이지만 index가 IU 상태거나 index의 partition 이 IU 상태이면 역시 alter statement는 error를 return할 것이 다. 2. Index가 존재하지 않는다면 oracle은 global nonpartitioned index를 만들 것이다. Truncate Partition SQL> alter table order truncate partition p3 (drop storage) ; - truncate partition은 지정된 partition에 존재하는 모든 rows를 remove한다. (faster than using 'delete statement') - partition이 truncate되면 corresponding local index partition도 같이 truncate된다. (IU 상태라도) Freed index space는 drop storage를 통해 deallocated 되거나 reuse storage를 통해 재사용될 수 있다. CF. the local index partitions that were marked INDEX UNUSABLE are marked VALID, resetting the INDEX UNUSABLE indicator. - Global index에 대해 not empty partition이 truncated되면 all global index partitions가 INDEX UNUSABLE 된다. (이런 경우 rebuild가 필요하므로 만일 rebuild를 원하지 않는 다면 truncate하지 말고 manually sql delete 하라) - FK를 가진 not empty partition을 truncate 하면 error가 return 된다. 이런 경우는 FK를 먼저 disable하던지 아니면 manually sql delete한 후 truncate해야 한다. CF. truncate partition does not fire the table's DELETE triggers. jkspark@hanafos.com - 22 - 장 경상
  • 23. Oracle8 New Features http://www.ggola.com Index Parallel SQL> alter index order_idx parallel (degree 5 instances 2) ; - this command로 partitioned index의 parallel attributes를 정할 수 있다. CF. index scan시 one slave가 one partition에 작업을 할 수 있 다. 위의 예는 5개의 index partitions에 partition당 one slave가 할당될 수 있다. - parallel create index에서 default parallelism을 위해 사용된다. Privileges for Partitioned Tables and Indexes - nonpartitioned tables and indexes 에 대한 privileges는 partitioned tables and indexes에도 동일한 privilege를 갖는다. CF. 단, table owner가 아닌 user가 ‘alter table drop partition, alter table truncate partition’ operation을 하려면 ‘alter’ privilege와 함께 'Drop any table' privilege가 있어야 한다. - 다음의 명령들은 privilege외에 a space quota in tablespace를 요구한다. Alter index modify/rebuild/ split partition Alter table add/modify/move/split partition an additional portion for partition features Data Dictionary Lists (USER/ALL/DBA prefixed dictionary) - _PART_TABLES, INDEXES, KEY_COLUMNS - _TAB/IND_PARTITIONS - _PART/TAB/_COL_STATISTICS - _PART/TAB/_HISTOGRAMS - _OBJECTS, _TABLES, _TAB_COLUMNS New Columns of the PLAN Table  PARTITION_START, PARTITION_STOP - PARTITION_START, PARTITION_STOP : how oracle computes the partitions to be accessed and provide the range of accessible partitions - Values : number(n), key, row location, invalid jkspark@hanafos.com - 23 - 장 경상
  • 24. Oracle8 New Features http://www.ggola.com - NUMBER(n) : indicates that the start partition has been identified by the SQL compiler. Its partition number is given by n - KEY : indicates that the start partition will be identified at execution time from partitioning key values. - ROW LOCATION : indicates that the start partition(same as the stop partition) will be computed at execution time from the location of each record being retrieved. The record location is obtained by a user or from a global index. - INVALID : indicates that the range of accessed partitions is empty  PARTITION_ID - this column identifies the step that has computed a pair of values PARTIONT_START and PARTITION_STOP columns.  OPTIONS column for PARTITION Step (newly added execution step) - values : concatenated, single, empty - CONCATENATED : 2개 이상의 partitions에서 returned result sets를 concatenation - SINGLE : accessed partition이 execution time에 a single partition 이다. - EMPTY : accessed partition이 empty CF. table access and index step : can contain the values 'by user rowid, by index rowid, by global index rowid, by local index rowid' SQL*Loader - conventional path : partition table에 대한 load도 가능하다. 1. SQL insert statement를 사용한다. 2. Same table에 대하여 concurrently하게 can run multi load and can load different partitions 3. Must specify the table and partition name is the load control file 4. 지정된 partition에 속하지 않는 rows는 'BADFILE'로 쓰여진 다. - Direct path sequential loads : 1. Index are build automatically. 2. Must specify the table and the partition name and set DIRECT=TRUE. jkspark@hanafos.com - 24 - 장 경상
  • 25. Oracle8 New Features http://www.ggola.com 3. If you are loading for the whole table, you cannot run any other loads on the same table concurrently 4. If there are no global indexes, you can run sequential direct path loads on different partitions of the same table concurrently - Direct path parallel loads 1. Must specify the table name and the partition name and set DIRECT=TRUE and PARALLEL=TRUE 2. Local index는 IU 상태가 되므로 loading이 끝나면 rebuild해 야 한다. (rebuild the partitions explicitly) 3. Global index가 있어서는 안된다. 꼭 필요하다면 global index drop and direct path parallel loading and re-create the index 해 야 한다. 4. Can run parallel direct path loads on different partitions of the same table concurrently Export / Import - Export : table mode에서만 partition export가 가능하다. CF. 다음과 같은 형식을 사용한다. table_name:partition_name - Import : partitioned table에 대한 import시 values less than in the highest partition에 해당되지않는 그 이상의 값을 갖는 rows는 모두 reject한다. CF. 다음과 같은 형식을 사용한다. table_name:partition_name CF. SKIP_UNUSABLE_INDEXES를 설정하여 UNUSUABLE maintenance를 skip할 수 있다. Analyze - partitions는 개별적으로 모든 analyze를 할 수 있다. CF. 물론 whole table and index애 대한 analyze는 자동으로 해 당 partition전체에 적용된다. - analyze generates 'combined' table, index and column statistics for a partitioned table or index by merging the statistics from the partitions. 하지만 analyze는 combined histogram을 생성하 지는 않는다. - optimizer 가 아직 analyzed되지 않은 partition을 발견한다면 그때는 each partition에 table/index defaults를 사용한다. jkspark@hanafos.com - 25 - 장 경상
  • 26. Oracle8 New Features http://www.ggola.com 4. Parallelizing Insert, Update and Delete Operations Parallel Operation  대략 megabytes or gigabytes급 table or index에 대하여 적어 도 1%이상의 변경을 일으키는 Large DML operations에 대하 여 speed up을 기대할 만 하다.  일반적으로 DSS or DW 같은 large objects access시 performance and scalability가 중요한 시스템에서 주로 사용된 다. (some OLTP operation에서도 효과를 기대할 수 있다)  parallel DML compliments the parallel query architecture by providing parallel support for Insert, Update, Delete operations.  대개의 경우 parallelism은 partitioned tables and indexes에 대 하여 적용이 된다. 단, 예외적으로 'Insert .. as select … ' on a nonpartitioned table에 대해선 허용한다. Benefits of Parallel  parallel DML의 목적은 performance의 많은 향상이나 반드시 hardware support가 필요하다.  The performance of parallelism is not only based on number of processes spawned. The number of CPU's, the number of disk drives on which the data is located, and some other factors all have an impact Automatic parallelization - 여러 session에서 parallel update를 수행할 필요가 없이 자동으 로 parallel DML operations을 사용할 수 있다. (조건별로 나누어 여러 session에서 동일 DML을 할 필요가 없 다) - 여러 session에서 처리할 필요가 없으므로 level of work를 나누 기 위한 key value or ROWID ranges를 알아야 할 필요가 없다. (따라서 transaction control에 대한 부담이 없이 완전하게 하나 의 transaction으로 처리가 되어진다) jkspark@hanafos.com - 26 - 장 경상
  • 27. Oracle8 New Features http://www.ggola.com Affinity - Oracle uses partition-to-device mapping. A process can be allocated to specific device for a given partition. - Users는 DML 실행 시 node/device/file/table/partition affinity를 알아야 할 필요가 없다. Oracle Parallel Server - OPS환경에서 parallel operations을 수행할 때 manual parallelism을 사용기 위해선 instance별 degree of affinity에 따 라 결정해야 한다. - Parallel DML은 implicitly managed되고 slave processes는 allocated to a given partition on an individual devices Supported Parallel Operations Parallel DML - Parallel Query : Oracle7 과 same architecture - Parallel Insert .. Select direct load on partitioned tables or nonpartitioned tables - Parallel Delete on partitioned tables, parallelize by partition - Parallel Update on partitioned tables, parallelize by partition Types of Parallelism - 하나의 master process가 slave processes를 coordinate한다. - 세가지 방식의 parallel operations이 있다. 1. Parallelize by rowid ranges (for parallel query only) 2. Parallelize by slave processes (for inserts into unpartitioned tables only) 3. Parallelize by partitions (for partitioned tables only) Parallelize by rowid - parallel query를 위해 사용되며 partitioned and nonpartitioned tables에 대하여 구분이 없이 모두 사용할 수 있다. - provide parallelism within a partition, 1개의 process는 1개의 partition만 담당한다. (동시에 여러 process가 1개의 partition을 select할 수 있다) jkspark@hanafos.com - 27 - 장 경상
  • 28. Oracle8 New Features http://www.ggola.com Parallelize by slave processes - insert into table select from table operation for nonpartitioned tables에 대해서만 사용이 가능하다. (parallel degree는 insert하 려는 대상 table에 준다) - Multiple slaves can insert after the high water mark(HWMK) of the table. Parallelize by partitions - partitioned table만을 대상으로 하는 INSERT .. SELECT, UPDATE, DELETE Command만 적용된다. - cannot provide parallelism within a partition . - resource의 sharing and use를 위해 1개의 process는 1개 이상의 partition에 assigned될 수 있다. 그러나 1개의 partition에 1개 이상의 process가 할당될 수는 없다. - Parallel Insert for partitioned table은 temporary segments를 사 용하여 insert를 진행하고 생성된 segment를 대상 table의 HWMK 위에 add한다. - segment가 1개씩 add될 때 HWMK가 이동하고 newly inserted rows에 대하여 ROWIDS가 assigned 된다. CF. 이후의 원칙은 Direct Path mode in SQL*Loader와 같다. Enabling Parallel DML - default Parallel DML mode는 FALSE로 되어있으므로 처음 session을 맺어서는 parallel DML을 사용할 수 없다. 반드시 다 음과 같이 alter session command를 사용하여 enable후 사용을 해야 한다. 단, parallel query는 이와 무관하게 원래부터 사용할 수 있으므로 유의하라. SQL> ALTER SESSION ENABLE PARALLEL DML ; (반대는 DISABLE) Parallel DML Mode - Initial parameter에 설정되어 있지않고, Alter session command 를 사용할 때는 사전에 commit or rollback을 통해 current transaction이 종료되어 있어야 한다. 그렇지 않으면 external error를 return할 것이다. - Each successful parallel DML operation후에는 다른 SQL command를 수행하기 이전에 반드시 commit or rollback이 수 행되어야 한다. 그렇지 않으면 commit or rollback을 수행하라 는 error (12830)가 return될 것이다. jkspark@hanafos.com - 28 - 장 경상
  • 29. Oracle8 New Features http://www.ggola.com - 한 transaction에서 first DML이 serially 수행되거나, Lock Table or Select for update 문장을 사용한 경우 그 이후에 사용되는 모 든 parallel은 무시된다. 즉, 모두 serially 수행된다. (단순 select 는 상관없다) CF. 이것은 Oracle 8.0.3까지의 제약 사항이다. - PL/SQL procedure or block이 Parallel DML enabled session에 서 수행되면 each statement in the procedure or block에 모두 같은 rule이 적용된다. Using Parallel Parallel Clause SQL> create table table_name (column type ….) parallel (degree 4) ; - create or alter table command로 parallel clause을 사용하여 default degree of parallelism을 설정할 수 있다. Parallel Hints SQL> Update, Delete /*+ parallel (table, n) */ …… SQL> Insert /*+ append parallel (table, n) */ into…. /*+ noappend parallel (table, n)*/ - explicit hints를 지정하면 즉, hint를 사용하여 parallel DML을 사용하면 parallel clause을 이용한 default setting은 override된 다. - Insert hint에 사용된 parallel은 select operation에는 적용되지 않으며 설사 insert와 동일 table에 select라도 적용되지 않는다. parallel hint가 없다면 parallel clause을 사용할 것이다. CF. Parallel DML enable상태에서 append는 append insert parallel로 진행될 것이고 disable상태면 append insert serial로 진행될 것이다. CF. noappend hint는 conventional insert를 진행한다. Determining the degree of parallelism - Parallel DML adds some new limits to the degree of parallelism to prevent deadlock situations. - The minimum number of transaction free lists for a partitioned global index is the minimum number across all index partitions. This is a requirement in order to prevent self- deadlock. - If a certain minimum fraction of the desired slave processes is not available(specified by PARALLEL_MIN_PERCENT), a user jkspark@hanafos.com - 29 - 장 경상
  • 30. Oracle8 New Features http://www.ggola.com error is produced. You can retry the query with less parallelism. Parallel select - parallel hint or table level의 parallelism에 따라 parallel select 가 수행된다. - One parallel directive for degree of parallelism is chosen for the entire statement, following these precedence rules : 1. Select hint directive 2. Select clause directive 3. Maximum select directive (join처럼 2 table 이상을 scan시 1, 2중 제일 큰 값을 사용한다) Parallel Insert .. Select - parallelizing에 영향을 주는 4대 요소 1. select parallel hint (at the statement level) 2. parallel clause (definition of the tables) 3. insert parallel hint (at the statement level) 4. parallel clause (definition of the table) CF. Oracle chooses one overall Parallel directive for the entire statement. - 선택 순위 1. Insert hint directive 2. Insert clause directive 3. Maximum select directive EX) insert /*+ parallel (emp, 3) / into emp select /*+ parallel (emp_src, 6) */ from emp_src ;  위의 예에서 선택되는 degree는 ? 3 Parallel update and delete - Parallel hint is applied to both the implicit query portion of the statement and to the DML portion. - If the statement contains subqueries or updatable views, they may have their parallel hints or clauses. - 만일 update중 발생하는 table scan이 serial 발생하더라도 즉, where clause 등에서 index scan이 serial로 발생하더라도 update 자체의 parallel operation은 수행될 것이다. - 선택 순위 1. Update/Delete hints 2. Update/Delete clause jkspark@hanafos.com - 30 - 장 경상
  • 31. Oracle8 New Features http://www.ggola.com Parallel DML and the Data Dictionary - Parallel DML이 수행되면 V$PQ_SESSTAT, V$SESSION, V$PQ_SYSSTAT을 조합하여 적절한 정보를 찾을 수 있다. - Parallel DML이 enable인가? PDML_ENABLED column from V$SESSION - Parallel DML이 수행되고 있는가? Select * From V$PQ_SESSTAT;  current session parallel 정보 Select * From V$PQ_SYSSTAT;  initialized parallel DML 수 Logging / Nologging SQL> alter table table_name LOGGING ; - NOLOGGING Attribute는 statement level이 아니라 alter or create command 즉, object level에서 수행되어야 한다. - Tablespace level에서도 설정이 가능하며 이렇게 NOLOGGING 을 설정하는 경우 all subsequent tables, indexes and partitions 등 모두 do not generate redo logs entries. 그러나 lower level에서 table, index등 object level에서의 설정 이 우선한다. Parallel DML and Rollback Segments - Parallel DML이 수행되면 개별적인 slave process별 transaction 이 발생하므로 동시에 different rollback segments를 할당 받는 다. - 따라서 the coordinator는 내부적으로 slave process별 two- phase commit방식을 취하게 된다. 당연히 rollback segment를 지정하는 set transaction use rollback segment command는 유 효하지 않다. - Parallel DML을 수행하는 a query slave는 long-running transactions수가 가장 적은 것을 우선으로 하여 rollback segment를 할당 받는데 만일 in each rollback segment 동수의 long-running transaction이 할당되어 있을 때는 regular DML 수가 가장적은 것을 할당한다. CF. 가급적 equally sized rollback segment를 가질 필요가 있다. 앞 서 언급했듯이 어떤 slave가 어떤 rollback segment에 할당될 지는 알 수가 없기 때문이다. General Restrictions - 아래와 같이 General Restrictions에 위반되는 parallel DML이 수행되면 error를 return하지 않고 serially 수행될 것이다. jkspark@hanafos.com - 31 - 장 경상
  • 32. Oracle8 New Features http://www.ggola.com - 한 transaction에서는 단 1회의 parallel DML만 허용되며 사전 에 다른 serial DML이 수행되면 안된다. (이런 제약사항은 Oracle V8.0.3이하 버전에서만 유효하고 이후 의 버전에서는 이미 수정되어 그런 제약은 없어졌다.) - 이후 버전에서도 parallel DML이 발생한 후 commit or rollback 없이 동일 table에 대하여 select 나 또 다른 parallel DML은 허 용되지 않는다. 하지만, 다른 table에 대한 작업(parallel DML을 포함하여)은 여전히 유효하다. 또한, LOB type이나 user defined object type을 포함하는 table 에 대한 parallel DML은 허용되지 않고 무조건 serially 처리된 다. - 한 transaction에서 Lock table or Select for update를 사용하면 이후의 작업은 모두 serially로 진행된다. - no parallel insert on global index (to avoid self-deadlock) no parallel update on global unique index no parallel DML operation on tables contains LOBs or object types no parallel DML operations for bitmap indexes no parallel DML operations on clustered tables - Parallel DML이 정상적으로 수행되어도 triggers는 enable되지 않는다. 즉, trigger를 사용하는 replication을 사용할 수 없다. Transaction and Process Recovery for Parallel DML - Transaction Recovery(for system and instance recovery) 1. SMON에 의해서 수행된다. Parallel DML이 있는 transaction 의 recovery는 serially 처리될 것이며 recovery가 완료될 때까 지 all resources locked된다. 그러므로 forward transaction에서 high degree를 사용한 경우 original(forward) transaction의 rollback보다 recovery가 take much longer될 수 있다. 2. 따라서 이렇게 instance가 비정상 종료로 인해 recovery할 때 는 to speed up the recovery process, rerun 앞서 비정상 종료되 었던 the parallel DML statement and return commit or rollback 하라.  a user-issued rollback does not require recovery. - Process Recovery 1. Single slave가 fail되면 PMON이 그 작업을 rollback할 것이 고 나머지 slave는 그들 자신의 작업을 rollback할 것이다. 2. Multiple slave가 fail되면 PMON이 serially하게 rollback을 대행할 것이다. 3. Coordinator process가 fail되면 PMON이 coordinator를 recover할 것이고 all slave processes는 parallel하게 자신들의 작업을 rollback할 것이다. jkspark@hanafos.com - 32 - 장 경상
  • 33. Oracle8 New Features http://www.ggola.com 4. 따라서 Process recovery time은 the forward work와 비슷하 거나 더 오래 걸릴 것이다. jkspark@hanafos.com - 33 - 장 경상
  • 34. Oracle8 New Features http://www.ggola.com 5. Identifying New ROWID Structure Addressing formats  Oracle8에서 새롭게 강화된 기능들은 결국 addressing format 에 대한 변경을 요구하게 되었고 따라서 New ROWID(Extended ROWID)가 탄생하게 되었다.  대표적으로 Larger Database, Many more datafiles, Many more tablespaces, Efficient access to partitioned objects 이러한 것들을 예로 들 수 있다. New ROWID(Extended ROWID) Why is a new ROWID Format Needed ? - 기존의 ROWID는 file, block, row number로 구성되어 있었으 나 이제 Oracle8에서 datafile number는 보다 더 많은 의미를 표현할 필요가 있게 되었다. - Because Oracle8은 partitioned table이 multiple segments를 가질 수 있고 각 segment는 분리된 tablespace에 위치할 수 있다라는 것을 지원하므로 segment를 표현해야 하는 ROWID에는 부가적인 정보가 필요할 수 있게 되었다. - Oracle uses ROWID as a unique identifier for a row in B-tree indexes and in internal algorithms. - DBA_DATA_FILES의 FILE_ID는 database에서 unique하고, DBA_DATA_FILES의 RELATIVE_FNO는 tablespace에서 unique하다. (because of PARTITON) New ROWID Format SQL> select rowid from table ; ROWID -------------------------------------- AAABeVAAEAAAATRAAA ……………. - 64 encoding 방식으로 알파벳 대소문자 + 숫자 + '+', '-' 기호로 표현된다. (A~Z, a~z, 0~9, +, -) AAABeV (6자리) AAE (3자리) AAAATR (6자리) AAA (3자리) Data object # Relative file # Block # Slot # jkspark@hanafos.com - 34 - 장 경상