■ 통계를 수동으로 수집해야 하는 시기

 

다음에 대해 수동으로 수집해야 한다.
- 휘발성 객체

- batch 처리 작업에서 수정되는 객체: 배치 처리 작업의 일부로 통계를 수집

- external table, system통계, fixed object

- 새로운 객체: 객체 생성 후 통계 수집

 

external 테이블은 샘플링이 지원되지 않아 estimate_percent 옵션을 명시적으로 null 설정해야 한다.
external 테이블에 대한 데이터 조작이 허용되지 않기에 해당 파일이 변경될 때만 통계 수집하면 충분한다.

 

■ 수동 통계 수집

dbms_stats는 optimize에 필요한 통계만 수집하고 다른 통계 수집은 하지 않는다.

- 예를 들어 테이블이라면 num_rows, 데이터가 있는 block count, 평균 행 길이는 포함되지만 체인된 row수, 평균 사용 가능 공간, 사용되지 않은 데이터 블럭 수는 미포함한다.

 

analyze문의 compute와 estimate 절은 역호환성을 위해서만 지원된다.

analyze문의 validate, list chained, free list 블록에 대한 정보 수집은 계속 사용 가능하다.

 

■ 수동 통계 수집 프로시저

-gather_index_stats
-gather_table_stats
-gather_schema_stats
-gather_dictionary_stats
-gather_database_stats
-gather_system_stats

-gather_fixed_objects_stats

 

PROCEDURE GATHER_DATABASE_STATS
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 ESTIMATE_PERCENT               NUMBER                  IN     DEFAULT
 BLOCK_SAMPLE                   BOOLEAN                 IN     DEFAULT
 METHOD_OPT                     VARCHAR2                IN     DEFAULT
 DEGREE                         NUMBER                  IN     DEFAULT
 GRANULARITY                    VARCHAR2                IN     DEFAULT
 CASCADE                        BOOLEAN                 IN     DEFAULT
 STATTAB                        VARCHAR2                IN     DEFAULT
 STATID                         VARCHAR2                IN     DEFAULT
 OPTIONS                        VARCHAR2                IN     DEFAULT
 STATOWN                        VARCHAR2                IN     DEFAULT
 GATHER_SYS                     BOOLEAN                 IN     DEFAULT
 NO_INVALIDATE                  BOOLEAN                 IN     DEFAULT
 GATHER_TEMP                    BOOLEAN                 IN     DEFAULT
 GATHER_FIXED                   BOOLEAN                 IN     DEFAULT
 STATTYPE                       VARCHAR2                IN     DEFAULT
 OBJ_FILTER_LIST                OBJECTTAB               IN     DEFAULT

 

PROCEDURE GATHER_SCHEMA_STATS
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 OWNNAME                        VARCHAR2                IN
 ESTIMATE_PERCENT               NUMBER                  IN     DEFAULT
 BLOCK_SAMPLE                   BOOLEAN                 IN     DEFAULT
 METHOD_OPT                     VARCHAR2                IN     DEFAULT
 DEGREE                         NUMBER                  IN     DEFAULT
 GRANULARITY                    VARCHAR2                IN     DEFAULT
 CASCADE                        BOOLEAN                 IN     DEFAULT
 STATTAB                        VARCHAR2                IN     DEFAULT
 STATID                         VARCHAR2                IN     DEFAULT
 OPTIONS                        VARCHAR2                IN     DEFAULT
 STATOWN                        VARCHAR2                IN     DEFAULT
 NO_INVALIDATE                  BOOLEAN                 IN     DEFAULT
 GATHER_TEMP                    BOOLEAN                 IN     DEFAULT
 GATHER_FIXED                   BOOLEAN                 IN     DEFAULT
 STATTYPE                       VARCHAR2                IN     DEFAULT
 FORCE                          BOOLEAN                 IN     DEFAULT
 OBJ_FILTER_LIST                OBJECTTAB               IN     DEFAULT

 

PROCEDURE GATHER_TABLE_STATS
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 OWNNAME                        VARCHAR2                IN
 TABNAME                        VARCHAR2                IN
 PARTNAME                       VARCHAR2                IN     DEFAULT
 ESTIMATE_PERCENT               NUMBER                  IN     DEFAULT
 BLOCK_SAMPLE                   BOOLEAN                 IN     DEFAULT
 METHOD_OPT                     VARCHAR2                IN     DEFAULT
 DEGREE                         NUMBER                  IN     DEFAULT
 GRANULARITY                    VARCHAR2                IN     DEFAULT
 CASCADE                        BOOLEAN                 IN     DEFAULT
 STATTAB                        VARCHAR2                IN     DEFAULT
 STATID                         VARCHAR2                IN     DEFAULT
 STATOWN                        VARCHAR2                IN     DEFAULT
 NO_INVALIDATE                  BOOLEAN                 IN     DEFAULT
 STATTYPE                       VARCHAR2                IN     DEFAULT
 FORCE                          BOOLEAN                 IN     DEFAULT

 

PROCEDURE GATHER_INDEX_STATS
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 OWNNAME                        VARCHAR2                IN
 INDNAME                        VARCHAR2                IN
 PARTNAME                       VARCHAR2                IN     DEFAULT
 ESTIMATE_PERCENT               NUMBER                  IN     DEFAULT
 STATTAB                        VARCHAR2                IN     DEFAULT
 STATID                         VARCHAR2                IN     DEFAULT
 STATOWN                        VARCHAR2                IN     DEFAULT
 DEGREE                         NUMBER                  IN     DEFAULT
 GRANULARITY                    VARCHAR2                IN     DEFAULT
 NO_INVALIDATE                  BOOLEAN                 IN     DEFAULT
 STATTYPE                       VARCHAR2                IN     DEFAULT
 FORCE                          BOOLEAN                 IN     DEFAULT

 

PROCEDURE GATHER_DICTIONARY_STATS
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 COMP_ID                        VARCHAR2                IN     DEFAULT
 ESTIMATE_PERCENT               NUMBER                  IN     DEFAULT
 BLOCK_SAMPLE                   BOOLEAN                 IN     DEFAULT
 METHOD_OPT                     VARCHAR2                IN     DEFAULT
 DEGREE                         NUMBER                  IN     DEFAULT
 GRANULARITY                    VARCHAR2                IN     DEFAULT
 CASCADE                        BOOLEAN                 IN     DEFAULT
 STATTAB                        VARCHAR2                IN     DEFAULT
 STATID                         VARCHAR2                IN     DEFAULT
 OPTIONS                        VARCHAR2                IN     DEFAULT
 STATOWN                        VARCHAR2                IN     DEFAULT
 NO_INVALIDATE                  BOOLEAN                 IN     DEFAULT
 STATTYPE                       VARCHAR2                IN     DEFAULT
 OBJ_FILTER_LIST                OBJECTTAB               IN     DEFAULT

 

PROCEDURE GATHER_FIXED_OBJECTS_STATS
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 STATTAB                        VARCHAR2                IN     DEFAULT
 STATID                         VARCHAR2                IN     DEFAULT
 STATOWN                        VARCHAR2                IN     DEFAULT
 NO_INVALIDATE                  BOOLEAN                 IN     DEFAULT

 

PROCEDURE GATHER_SYSTEM_STATS
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 GATHERING_MODE                 VARCHAR2                IN     DEFAULT
 INTERVAL                       NUMBER(38)              IN     DEFAULT
 STATTAB                        VARCHAR2                IN     DEFAULT
 STATID                         VARCHAR2                IN     DEFAULT
 STATOWN                        VARCHAR2                IN     DEFAULT

 

Posted by neo-orcl
,

■ 히스토그램 고려사항

-특정 열의 비대칭 정도가 높을 때 유용하다

-열의 데이터 분산이 자주 변경될 경우 해당 히스토그램을 자주 재계산해야 한다.

 

■ 히스토그램이 유용하지 않은 경우

- 열이 where나 join절에 사용되지 않을 경우

- 균등하게 분산된 열(컬럼 통계만으로 충분하다)

- pk나 uk등으로 unique한 값이 있는 = 술어

 

실질적인 성능 개선이 없다면 히스토그램을 사용하지 않아야 한다. 히스토그램 수집은 통계 수집 중 가장 Load가 높은 작업이기 때문이다.

 

※ 문자열의 처음 32바이트에 대해서만 히스토그램 데이터가 저장되므로 문자 열에는 일부 예외적인 동작이 있을 수 있다.


열에 표현식을 포함하고 있는 술어는 query 옵티마이저에서 문제(인덱스를 사용하지 못하거나)를 일으킨다.

※ function(column) = constant 형태의 술어에 대한 선택성을 계산할 때 옵티마이저는 정적 선택성 값이 1%라고 가정한다.


■히스토그램 정보 확인

dba_tab_histogram
dba_part_histogram
dba_subpart_histogram

 

1. 먼저 해당 컬럼이 히스토그램을 가지고 있는지와 종류를 확인하기 위해서 DBA_TAB_COL_STATISTICS를 조회한다.

select owner, table_name, column_name, histogram
from DBA_TAB_COL_STATISTICS
where table_name='SALES'
and column_name='PROD_ID';

 

OWNER                          TABLE_NAME                     COLUMN_NAME                    HISTOGRAM
------------------------------ ------------------------------ ------------------------------ ---------
SH                             SALES                          PROD_ID                        FREQUENCY

 

2. 히스토그램을 확인한다.

col column_name for a10
col owner for a10
col table_name for a10

select owner, table_name, column_name, endpoint_number, endpoint_value
from DBA_TAB_HISTOGRAMS
where table_name='SALES'
and column_name='PROD_ID';

 

OWNER      TABLE_NAME COLUMN_NAM ENDPOINT_NUMBER ENDPOINT_VALUE
---------- ---------- ---------- --------------- --------------
SH         SALES      PROD_ID               6002             13
SH         SALES      PROD_ID              12012             14
SH         SALES      PROD_ID              17778             15
SH         SALES      PROD_ID              24707             16
SH         SALES      PROD_ID              30867             17
SH         SALES      PROD_ID              40458             18
SH         SALES      PROD_ID              50888             19
SH         SALES      PROD_ID              61791             20
SH         SALES      PROD_ID              66996             21
SH         SALES      PROD_ID              70437             22
SH         SALES      PROD_ID              90079             23
....

Posted by neo-orcl
,

개요

 

자동 통계 수집은 gather_stats_prog 를 통해 자동화된다

 

프로시저

exec dbms_stats.set_global_prefs
exec dbms_stats.set_database_prefs
exec dbms_stats.set_schema_prefs
exec dbms_stats.set_table_prefs

 

프로시저 속성

- cascade: 인덱스에 대한 통계도 수집한다. 단, 이는 병렬화되지 않는다

- estimate_percent

통계 계산에 사용되는 행의 예측 비율(null은 모든 행을 의미)로 0.000001~100 설정 가능하다.
시스템이 자동으로 적정 샘플 크기를 결정하도록 하게 하려면 dbms_stats.auto_sample_size 사용한다.(기본값)

 

- no_invalidate

통계 수집할 테이블의 종속 커서 무효화를 제어한다.
true-종속 커서가 무효화되지 않음, false-종속 커서가 무효화됨
시스템이 무효화해야 하는 시기를 결정하도록 하려면 dbms_stats.auto_invalidate를 사용한다(기본값)

- publish

통계를 딕셔너리에 저장하거나 업데이트 할 지, pending area에 저장할 것인지 결정한다.
pending statistics 기능과 연관이 있다

 

- stale_percent: 객체 통계가 오래된 기준을 정한다. 마지막 통계 수집 이후 수정된 행의 비율이다. 기본값 10%

- degree

통계 계산에 사용되는 병렬도이다. 기본값은 null이며 이는 create table이나 alter table 문에서 degree 절로 지정된 테이블의   기본값을 사용함을 의미한다.
init parameter값을 기반으로 기본값 지정하려면 dbms_stats.default_degree 사용한다.
auto_degree 값은 병렬도를 자동 결정한다. 객체 크기에 따라 1 또는 default_degree(cpu수와 init parameter 기반하는 시스템 기본값)이다


- method_opt: 히스토그램 수집에 사용되는 sql 문자열. 기본값은 for all coluns size auto이다.

- granulity: partition 테이블에 대해 수집할 통계의 단위이다. global이거나 partition단위 일 수 있다.

- incremental

partition 테이블의 global 통계를 incremental 방식으로 수집하는데 사용한다.

 

※ 만약 테이블 단위로 수집 관련 속성을 dbms_stats.set_table_prefs 통해 설정했다면 dba_tab_stat_prefs 뷰를 사용하여 확인할 수 있다.

'Knowledge > Perfomance Tuning' 카테고리의 다른 글

수동통계수집(gathering statistics manually)  (0) 2015.12.29
histogram 고려사항  (0) 2015.12.29
시스템 통계 수집(gathering system statististics)  (0) 2015.12.29
Additional statistics  (0) 2015.12.19
Common wait events  (0) 2015.12.19
Posted by neo-orcl
,

■ 개요

시스템 통계 수집은 정기적으로 이루어져야 한다.

시스템 통계 수집은 기존 실행계획을 무효화하지 않는다.

 

■ 프로시저

dbms_stats.gather_system_stats: 시스템 통계 수집
dbms_stats.set_system_stats: 명시적으로 직접 설정
dbms_stats.get_system_stats: 시스템 통계 정보를 확인

 

gathering_mode:

- noworkload | interval
- start | stop

 

noworkload: 기본값, 몇분 정도 걸릴 수 있고 DB크기에 따라 다르다.
                    DB와 테이블스페이스 생성 후 gather_system_stats('noworkload')를 실행할 것을 권장한다.
interval: 지정된 간격동안 시스템 작업을 캡쳐한다.

 

start | stop: 시작 정지를 지정할 수 있다. 예를 들어 시작 후 작업을 걸고 stop하여 정확한 통계를 수집할 수 있다.

 

※10gR2부터는 시작 시 시스템 통계 필수 부분이 자동으로 수집된다

 

■ 시스템 통계 수집 예제1

exec dbms_stats.gather_system_stats(interval => 120, stattab => 'mystats',statid => 'OLTP'); --첫째날 낮
exec dbms_stats.gather_system_stats(interval => 120, stattab => 'mystats',statid => 'BATCH'); --첫째날 밤
exec dbms_stats.import_system_stats(stattab='mystats',statid='OLTP'); --낮에는 이 통계를 사용하도록 dictionary에 import
exec dbms_stats.import_system_stats(stattab='mystats',statid='DW'); --밤에는 이 통계를 사용하도록 dictionary에 import

 

※위 작업 전에 먼저 통계용 테이블을 dbms_stats.create_stat_table 을 통해 만들어야 한다.

 

■ 시스템 통계 수집 예제2

exec dbms_stats.gather_system_stats(gathering_mode => 'start');

 

workload 수행

exec dbms_stats.gather_system_stats(gathering_mode => 'stop');

 

위 예제는 해당 워크로드가 수행될 때의 시스템 통계를 수집하는 것이 목적이다.

 

'Knowledge > Perfomance Tuning' 카테고리의 다른 글

수동통계수집(gathering statistics manually)  (0) 2015.12.29
histogram 고려사항  (0) 2015.12.29
자동 통계 수집(automatic statistics gathering)  (0) 2015.12.29
Additional statistics  (0) 2015.12.19
Common wait events  (0) 2015.12.19
Posted by neo-orcl
,

 

 statistics name

description 

recommend action 

 redo log space requests

리두 로그 파일에 공간 확보를 하기 위해 대기한 횟수

tune checkpoint, dbwr, archive process

use bigger log file

consistent changes

consistent read를 위해 롤백된 횟수

Automatic undo management 사용

tune work load

consistent gets

consistent read모드로 읽은 블럭 수

Automatic undo management 사용

tune work load

table fetch by continued row

migration or chained rows

reorganization

 

조회 방법.

 

select name, value from v$sysstat where name like 'redo log space reque%'

union all

select name, value from v$sysstat where name like 'consistent changes%'

union all

select name, value from v$sysstat where name like 'con%'

union all

select name, value from v$sysstat where name like 'table fetch by continuted row';

 

NAME                                                                  VALUE
---------------------------------------------------------------- ----------
redo log space requests                                                 124
consistent changes                                                   930117
concurrency wait time                                                  3854
consistent gets                                                     4241014
consistent gets from cache                                          4191819
consistent gets from cache (fastpath)                               2249943
consistent gets - examination                                       1670409
consistent gets direct                                                49195
consistent changes                                                   930117
Posted by neo-orcl
,

 

대기 이벤트명

영역 

 점검대상

 Buffer busy wait

버퍼캐시, DBWR 

문제 발생시에 v$session_wait 

 Free buffer waits

버퍼캐시, DBWR 

OS통계통한 write speed 검토, 버퍼캐시 통계 

 db file scattered read,

db file sequential read

I/O, SQL튜닝 

v$sqlarea PHYSICAL_READ_REQUESTS, v$filestat readtim

enqueue waits (enq:)

LOCK 

v$enqueue_stat 

library cache waits 

Latch 

v$sqlarea parsing calls, child cursor 

 log buffer space

log buffer, lgwr 

v$sysstat 'redo buffer allocation retries', 디스크성능

 log file sync

over commit, lgwr 

v$sysstat 'user commits'+'user rollbacks', 디스크성능

 

Posted by neo-orcl
,

[grid@node01 grid]$ ./runcluvfy.sh stage -post crsinst -n node01,node02 -verbose

Performing post-checks for cluster services setup

Checking node reachability...

Check: Node reachability from node "node01"
  Destination Node                      Reachable?
  ------------------------------------  ------------------------
  node02                                yes
  node01                                yes
Result: Node reachability check passed from node "node01"


Checking user equivalence...

Check: User equivalence for user "grid"
  Node Name                             Status
  ------------------------------------  ------------------------
  node02                                passed
  node01                                passed
Result: User equivalence check passed for user "grid"

Checking node connectivity...

Checking hosts config file...
  Node Name                             Status
  ------------------------------------  ------------------------
  node02                                passed
  node01                                passed

Verification of the hosts config file successful


Interface information for node "node02"
 Name   IP Address      Subnet          Gateway         Def. Gateway    HW Address        MTU
 ------ --------------- --------------- --------------- --------------- ----------------- ------
 eth0   192.168.30.22   192.168.30.0    0.0.0.0         192.168.30.2    00:0C:29:8A:2F:0E 1500
 eth0   192.168.30.28   192.168.30.0    0.0.0.0         192.168.30.2    00:0C:29:8A:2F:0E 1500
 eth0   192.168.30.24   192.168.30.0    0.0.0.0         192.168.30.2    00:0C:29:8A:2F:0E 1500
 eth1   192.168.137.22  192.168.137.0   0.0.0.0         192.168.30.2    00:0C:29:8A:2F:04 1500
 eth1   169.254.41.15   169.254.0.0     0.0.0.0         192.168.30.2    00:0C:29:8A:2F:04 1500


Interface information for node "node01"
 Name   IP Address      Subnet          Gateway         Def. Gateway    HW Address        MTU
 ------ --------------- --------------- --------------- --------------- ----------------- ------
 eth1   192.168.137.21  192.168.137.0   0.0.0.0         192.168.30.2    00:0C:29:07:37:4E 1500
 eth1   169.254.170.129 169.254.0.0     0.0.0.0         192.168.30.2    00:0C:29:07:37:4E 1500
 eth0   192.168.30.21   192.168.30.0    0.0.0.0         192.168.30.2    00:0C:29:07:37:58 1500
 eth0   192.168.30.23   192.168.30.0    0.0.0.0         192.168.30.2    00:0C:29:07:37:58 1500


Check: Node connectivity for interface "eth1"
  Source                          Destination                     Connected?
  ------------------------------  ------------------------------  ----------------
  node02[192.168.137.22]          node01[192.168.137.21]          yes
Result: Node connectivity passed for interface "eth1"


Check: TCP connectivity of subnet "192.168.137.0"
  Source                          Destination                     Connected?
  ------------------------------  ------------------------------  ----------------
  node01:192.168.137.21           node02:192.168.137.22           passed
Result: TCP connectivity check passed for subnet "192.168.137.0"


Check: Node connectivity for interface "eth0"
  Source                          Destination                     Connected?
  ------------------------------  ------------------------------  ----------------
  node02[192.168.30.22]           node02[192.168.30.28]           yes
  node02[192.168.30.22]           node02[192.168.30.24]           yes
  node02[192.168.30.22]           node01[192.168.30.21]           yes
  node02[192.168.30.22]           node01[192.168.30.23]           yes
  node02[192.168.30.28]           node02[192.168.30.24]           yes
  node02[192.168.30.28]           node01[192.168.30.21]           yes
  node02[192.168.30.28]           node01[192.168.30.23]           yes
  node02[192.168.30.24]           node01[192.168.30.21]           yes
  node02[192.168.30.24]           node01[192.168.30.23]           yes
  node01[192.168.30.21]           node01[192.168.30.23]           yes
Result: Node connectivity passed for interface "eth0"


Check: TCP connectivity of subnet "192.168.30.0"
  Source                          Destination                     Connected?
  ------------------------------  ------------------------------  ----------------
  node01:192.168.30.21            node02:192.168.30.22            passed
  node01:192.168.30.21            node02:192.168.30.28            passed
  node01:192.168.30.21            node02:192.168.30.24            passed
  node01:192.168.30.21            node01:192.168.30.23            passed
Result: TCP connectivity check passed for subnet "192.168.30.0"

Checking subnet mask consistency...
Subnet mask consistency check passed for subnet "192.168.30.0".
Subnet mask consistency check passed for subnet "192.168.137.0".
Subnet mask consistency check passed.

Result: Node connectivity check passed

Checking multicast communication...

Checking subnet "192.168.30.0" for multicast communication with multicast group "230.0.1.0"...
Check of subnet "192.168.30.0" for multicast communication with multicast group "230.0.1.0" passed.

Checking subnet "192.168.137.0" for multicast communication with multicast group "230.0.1.0"...
Check of subnet "192.168.137.0" for multicast communication with multicast group "230.0.1.0" passed.

Check of multicast communication passed.
Check: Time zone consistency
Result: Time zone consistency check passed

Checking Oracle Cluster Voting Disk configuration...

ASM Running check passed. ASM is running on all specified nodes

Oracle Cluster Voting Disk configuration check passed

Checking Cluster manager integrity...


Checking CSS daemon...

  Node Name                             Status
  ------------------------------------  ------------------------
  node02                                running
  node01                                running

Oracle Cluster Synchronization Services appear to be online.

Cluster manager integrity check passed


UDev attributes check for OCR locations started...
Result: UDev attributes check passed for OCR locations


UDev attributes check for Voting Disk locations started...
Result: UDev attributes check passed for Voting Disk locations


Check default user file creation mask
  Node Name     Available                 Required                  Comment
  ------------  ------------------------  ------------------------  ----------
  node02        0022                      0022                      passed
  node01        0022                      0022                      passed
Result: Default user file creation mask check passed

Checking cluster integrity...

  Node Name
  ------------------------------------
  node01
  node02

Cluster integrity check passed


Checking OCR integrity...

Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations


ASM Running check passed. ASM is running on all specified nodes

Checking OCR config file "/etc/oracle/ocr.loc"...

OCR config file "/etc/oracle/ocr.loc" check successful


Disk group for ocr location "+OCR" available on all the nodes


NOTE:
This check does not verify the integrity of the OCR contents. Execute 'ocrcheck' as a privileged user to verify the contents of OCR.

OCR integrity check passed

Checking CRS integrity...

Clusterware version consistency passed
The Oracle Clusterware is healthy on node "node02"
The Oracle Clusterware is healthy on node "node01"

CRS integrity check passed

Checking node application existence...

Checking existence of VIP node application (required)
  Node Name     Required                  Running?                  Comment
  ------------  ------------------------  ------------------------  ----------
  node02        yes                       yes                       passed
  node01        yes                       yes                       passed
VIP node application check passed

Checking existence of NETWORK node application (required)
  Node Name     Required                  Running?                  Comment
  ------------  ------------------------  ------------------------  ----------
  node02        yes                       yes                       passed
  node01        yes                       yes                       passed
NETWORK node application check passed

Checking existence of GSD node application (optional)
  Node Name     Required                  Running?                  Comment
  ------------  ------------------------  ------------------------  ----------
  node02        no                        no                        exists
  node01        no                        no                        exists
GSD node application is offline on nodes "node02,node01"

Checking existence of ONS node application (optional)
  Node Name     Required                  Running?                  Comment
  ------------  ------------------------  ------------------------  ----------
  node02        no                        yes                       passed
  node01        no                        yes                       passed
ONS node application check passed


Checking Single Client Access Name (SCAN)...
  SCAN Name         Node          Running?      ListenerName  Port          Running?
  ----------------  ------------  ------------  ------------  ------------  ------------
  node-cluster-scan  node02        true          LISTENER_SCAN1  1521          true

Checking TCP connectivity to SCAN Listeners...
  Node          ListenerName              TCP connectivity?
  ------------  ------------------------  ------------------------
  node01        LISTENER_SCAN1            yes
TCP connectivity to SCAN Listeners exists on all cluster nodes

Checking name resolution setup for "node-cluster-scan"...

Checking integrity of name service switch configuration file "/etc/nsswitch.conf" ...
Checking if "hosts" entry in file "/etc/nsswitch.conf" is consistent across nodes...
Checking file "/etc/nsswitch.conf" to make sure that only one "hosts" entry is defined
More than one "hosts" entry does not exist in any "/etc/nsswitch.conf" file
All nodes have same "hosts" entry defined in file "/etc/nsswitch.conf"
Check for integrity of name service switch configuration file "/etc/nsswitch.conf" passed


ERROR:
PRVG-1101 : SCAN name "node-cluster-scan" failed to resolve
  SCAN Name     IP Address                Status                    Comment
  ------------  ------------------------  ------------------------  ----------
  node-cluster-scan  192.168.30.28             failed                    NIS Entry

ERROR:
PRVF-4657 : Name resolution setup check for "node-cluster-scan" (IP address: 192.168.30.28) failed

ERROR:
PRVF-4664 : Found inconsistent name resolution entries for SCAN name "node-cluster-scan"

Verification of SCAN VIP and Listener setup failed

Checking OLR integrity...

Checking OLR config file...

OLR config file check successful


Checking OLR file attributes...

OLR file check successful


WARNING:
This check does not verify the integrity of the OLR contents. Execute 'ocrcheck -local' as a privileged user to verify the contents of OLR.

OLR integrity check passed
OCR detected on ASM. Running ACFS Integrity checks...

Starting check to see if ASM is running on all cluster nodes...

ASM Running check passed. ASM is running on all specified nodes

Starting Disk Groups check to see if at least one Disk Group configured...
Disk Group Check passed. At least one Disk Group configured

Task ACFS Integrity check passed

Checking to make sure user "grid" is not in "root" group
  Node Name     Status                    Comment
  ------------  ------------------------  ------------------------
  node02        passed                    does not exist
  node01        passed                    does not exist
Result: User "grid" is not part of "root" group. Check passed

Checking if Clusterware is installed on all nodes...
Check of Clusterware install passed

Checking if CTSS Resource is running on all nodes...
Check: CTSS Resource running on all nodes
  Node Name                             Status
  ------------------------------------  ------------------------
  node02                                passed
  node01                                passed
Result: CTSS resource check passed


Querying CTSS for time offset on all nodes...
Result: Query of CTSS for time offset passed

Check CTSS state started...
Check: CTSS state
  Node Name                             State
  ------------------------------------  ------------------------
  node02                                Active
  node01                                Active
CTSS is in Active state. Proceeding with check of clock time offsets on all nodes...
Reference Time Offset Limit: 1000.0 msecs
Check: Reference Time Offset
  Node Name     Time Offset               Status
  ------------  ------------------------  ------------------------
  node02        0.0                       passed
  node01        0.0                       passed

Time offset is within the specified limits on the following set of nodes:
"[node02, node01]"
Result: Check of clock time offsets passed


Oracle Cluster Time Synchronization Services check passed
Checking VIP configuration.
Checking VIP Subnet configuration.
Check for VIP Subnet configuration passed.
Checking VIP reachability
Check for VIP reachability passed.

Post-check for cluster services setup was unsuccessful on all the nodes.

Posted by neo-orcl
,

오라클은 DDL을 DML과는 다르게 처리한다.

create table을 진행하면 DB는 create table문을 최적화하지 않는다.

DDL에 대해 일반적으로 오라클은 parse 후 여러개의 recursive SQL 문을 처리해야 한다.

 

CRATE TABLE test_table (column1 number);

 

위 문장을 처리할 때 다음과 recursive SQL 처리 과정을 거친다.

 

1. create table 문 전에 commit 한다.

 

2. 유저권한과 create table 권한을 확인한다.

 

3. 테이블이 어떤 테이블스페이스에 저장될지 정한다.

 

4. 테이블스페이스의 quota를 넘지 않도록 보장한다.

 

5. 같은 스키마에 같은 object가(이름이) 없는지 보장한다.

 

6. Dictionary에 테이블 정의를 한 row들을 insert한다.

 

7. 성공한다면 commit 실패한다면 rollbckup한다.

'Knowledge > Oracle' 카테고리의 다른 글

sqlplus 접속 hang시에 접속 방법  (0) 2016.05.27
impdp, imp 주의사항  (0) 2016.03.20
SQL Loader Direct Load  (0) 2015.10.05
undo 관련 좋은 링크  (0) 2015.09.15
null 관련 주의사항  (0) 2015.07.10
Posted by neo-orcl
,

1. 테스트 테이블 생성
orcl@EXPERT> create table orders (order_id number primary key, line_items_count number default 0);

orcl@EXPERT> create table lineitems (order_id references orders, seq_no number, constraint lineitem_pk primary key (order_id,seq_no));

 

2. 트리거 생성
orcl@EXPERT> create or replace trigger orders_itemcnt_trg
after update or insert or delete on lineitems
for each row
begin
  if updating or inserting then
      update orders set line_items_count=nvl(line_items_count,0)+1
      where order_id=:new.order_id;
  end if;        --여기서 아예 end if하면 아래 if가 안돌아가기에 end if 후 다른 if가 됨
  if deleting or updating then
      update orders set line_items_count=nvl(line_items_count,0)-1
      where order_id=:old.order_id;
  end if;
end;
/


3. Insert 테스트
orcl@EXPERT> insert into orders(order_id) values(10);
orcl@EXPERT> insert into orders(order_id) values(20);

orcl@EXPERT> insert into lineitems values(10,1);

orcl@EXPERT> select * from orders;      --commit을 하지 않아도 트리거에 의해 update되었음

  ORDER_ID LINE_ITEMS_COUNT
---------- ----------------
        10                1
        20                0

orcl@EXPERT> insert into lineitems values (10,2);
--이때 트리거에 의해 update orders set line_item_count=nvl(1,0)+1 where order_id=10; 발생

 

orcl@EXPERT> select * from orders;

  ORDER_ID LINE_ITEMS_COUNT
---------- ----------------
        10                2
        20                0

 

4. update 테스트
orcl@EXPERT> update lineitems set order_id=20;
--이때 트리거에 의해 아래 과정을 거친다.
update order set line_item_count=nvl(2,0)-1 where order_id=10;
update order set line_item_count=nvl(0,0)+1 where order_id=20;
update order set line_item_count=nvl(1,0)-1 where order_id=10;
update order set line_item_count=nvl(1,0)+1 where order_id=20;

 

orcl@EXPERT> select * from orders;

  ORDER_ID LINE_ITEMS_COUNT
---------- ----------------
        10                0
        20                2

 

5. delete 테스트
orcl@EXPERT> delete from lineitems;
--이때 트리거에 의해 아래 과정을 거친다.
update order set line_item_count=nvl(2,0)-1 where order_id=20;
update order set line_item_count=nvl(1,0)-1 where order_id=20;

 

orcl@EXPERT> select * from orders;

  ORDER_ID LINE_ITEMS_COUNT
---------- ----------------
        10                0
        20                0

'Knowledge > PLSQL' 카테고리의 다른 글

예외처리 예제  (0) 2015.09.03
Posted by neo-orcl
,

 

 

언제 Conventional Data Load를 사용해야 하나?


만약에 데이터 적재 속도가 가장 중요하다면 direct path를 사용해야 한다. conventional path load보다 더 빠르기 때문이다. 그러나 direct path에 특정 제약조건이 있기 때문에 conventional path load를 사용해야 한다. 앞으로는 CPLconventional path load라고 하고 DPLdirect path load라고 하겠다.

 

구분

conventional path load

direct path load

속도

느림

빠름

가용성

로드 작업중 다른 유저가 테이블 수정 가능(가용성up)

로드 작업 중 다른 유저가 테이블 변경 불가(가용성down)

클러스터 테이블

클러스터 테이블에 load 가능

클러스터 테이블에 load 불가

인덱스

관련

인덱스가 걸린 큰 테이블에 소량의 행을 load할 경우(append) 유리

DPL에서는 인덱스를 로드 종료 후에 병합하는데 이때 기존 인덱스를 복사하고 병합한다. 만약 기존 인덱스가 크고 새로운 인덱스 키들이 작을 경우 DPL의 빠른 속도는 기존 인덱스를 복사하는 시간에 의해 상쇄 될 것이다.

제약조건

비교적 적은 수의 행을 큰 테이블에 로드하는데 참조 제약조건과 check 제약조건이 걸려있을 경우 CPL을 사용해야 한다.

DPL에서는 PRIMARY KEY, UNIQUE, NOT NULL만 검증한다.

INSERT

트리거

실행됨

실행되지 않음

 

Direct Path Load 장점


DPLCPL보다 빠른데 그 이유는 다음과 같다.

n  부분적인 블럭들은 사용되지 않는다, 그래서 읽을 블락을 찾을 필요가 없고 적은 쓰기만 수행된다.

n  INSERT가 사용되지 않는다.

n  로드 시작전에 테이블과 INDEXLOCK하고 로드가 끝난뒤에 LOCK을 푼다.

n  데이터파일에 대해 MULTIBLOCK ASYNCHRONOUS I/O를 사용한다.

n  DPL 도중에 프로세스들은 오라클의 버퍼캐시를 사용하는 대신 각자의 쓰기 I/O를 수행한다. 이는 다른 오라클 유저와의 경합을 줄인다.

n  적재되는 테이블이 비어있으면 사전정렬 옵션이 인덱스 생성의 정렬과 병합 단계를 제거한다. 인덱스는 데이터가 도착하는대로 채워진다.

n  인스턴스 장애에 대한 보호가 요구되지 않기에 리두 파일의 IO가 줄어든다. 다음 상황에서 로그파일에 쓰기 과정이 필요없다.

n  DBNOARCHIVELOG 모드일 때

n  SQL*LoaderUNRECOVERABLE 문이 활성화되었을 때

n  SQLNOLOGGING이 적용되었을 경우

 

Direct Path Load의 제약사항


n  클러스터테이블에는 적재될 수 없다.

n  Virtual Private Database(VPD) 정책이 Insert에 활성화된 테이블에는 적재될 수 없다

n  적재되어야할 세그먼트에 트랜잭션이 추가될 수 없다.

n  부모 테이블과 자식 테이블을 함께 적재할 수 없다.

n  BFILE 컬럼을 로딩할 수 없다.

n  적재 중에 CREATE SEQUENCE를 사용할 수 없다. DPLinsert 문을 생성하지 않고 로드를 진행하기 때문에 next value를 불러올 수 없다.

 

Direct Path LoadSingle Partition 제약사항


n  글로벌 인덱스를 가지고 있는 파티션에는 적재할 수 없다,

n  트리거 활성화 불가하다

n  참조와 체크조건이 걸려있는 테이블의 파티션에 대한 적재를 할 수 없다.

 

언제 Direct Path Load를 사용해야 하나?

만약 위의 제약사항에 해당되지 않는다면 아래 상황에서 direct path를 사용하는 것이 좋다.

n  많은 데이터를 빠르게 적재하고 싶을 때,

n  데이터 로드시 성능을 최대로 써서 병렬로 진행하고 싶을 때

 

Direct Path Load 주의사항


n  Check와 참조무결성 제약조건은 DPL시에 자동으로 적재시작 전에 비활성화되며, 적재 완료 후에 반드시 수동으로 활성화시켜야 한다. 이를 자동으로 활성화하게 하려면 REENABLE DISABLED_CONSTRAINTS 절을 컨트롤 파일에 기록해줘야 한다.

n  Check 제약조건은 EVALUDATE CHECK_CONSTRAINTS를 컨트롤 파일에 기록하면 비활성화하지 않게 할 수 있다.

n  INSERT 트리거는 적재 시작전에 비활성화된다. 그리고 적재 완료 후에 자동으로 활성화된다. 즉 그 동안 INSERT된 행들에 대한 트리거는 동작하지 않는다.

n  테이블의 DEFAULTDPL에선 사용할 수 없다. 이를 DEFAULT 적용하려면 DEAFULTIF 를 사용해야 한다. DEFAULTIF를 쓰지 않으면 NULL이 입력된다.

 

 

이 외에도 많은 내용이 더 있다.

http://docs.oracle.com/cd/E11882_01/server.112/e22490/ldr_modes.htm#SUTIL009

'Knowledge > Oracle' 카테고리의 다른 글

impdp, imp 주의사항  (0) 2016.03.20
Oracle Create Table 내부 절차  (0) 2015.10.21
undo 관련 좋은 링크  (0) 2015.09.15
null 관련 주의사항  (0) 2015.07.10
logon trail trigger on oracle  (0) 2015.01.22
Posted by neo-orcl
,