나의 즐겨찾기 | 블로그홈 | 바로가기 바로가기 | 로그인
하루를 즐거운 마음으로...
블로그  |  사진갤러리  |  동영상갤러리 방명록  |   즐겨찾기 추가


http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=/com.ibm.vacpp7a.doc/compiler/ref/tuoptcfg.htm
<<컴파일관련내용참조>>

http://publib.boulder.ibm.com/infocenter/db2help/index.jsp

 

1. dynamic explain
    dynexpln -d edwid_t -g(Graph Optoin) -f a(Script Name) -o a.out(Output file) -z ";"

    dynexpln -d edwid -g -i -f a.sql -o a.out -z ";"

    Dynamic expln
    패키지에 포함된 Dynamic sql은 expln시 제외되므로 프로그램에 있는 dynamic sql만 추출하여
    plan을 떠야 함.(입력받는 변수에 varchar type인 경우  ?로 대체 한 후 plan)

    db2expln -d edwid -g -i -f aa -o aa.out -z ';'

    db2expln -d edwid -g -i -f Jsum723c.sql -o Jsud723c.out -z ';'

    db2expln -d edwid -g -i -f 0405.sql -o SURBR.out -z ';'
   
    db2expln -d edwid -g -c sumusr1 -p Jsum853c -s 0 -o Jsum853c_20060419.exp

    Static expln
    db2expln -d edwid -g -c sumusr1 -p Jsum891c -s 0 -o Jsum891c.out  소스파일 ...

2. Index Advisor 및 Estimating Time
    db2advise -d pltdb -i a(Script Name)
    db2advis -d edwid -i oded_fc_d02.sql -o g2.out
   
3. 테이블 truncatez`
    db2 "import from /dev/null of del replace into SUM.SU_WIRE_DAYBY_SUM_MB"

4. Procedure생성 환경
   export DB2NODE=0
   db2 terminate

5. 일반작업할때
   export DB2NODE=134
   db2 terminate

6. Node 확인      
   db2 "select current node from sysibm.sysdummy1"
  
7. Export
    db2 "export to 화일명 of del modified by coldel , select ......"  
    db2 "export to 화일명 of del select ~"

    db2 "export to exp_.del of del modified by chardel0x1e messages exp.msg select * from SUM.DIM_BASE_DAY fetch first 1000 rows onl y";

    db2 "export to exp_.del of del messages exp.msg select * from SUM.DIM_BASE_DAY fetch first 1000 rows onl y";

    db2 "export to exp_ixf.del of ixf modified by chardel0x1e messages exp_ixf.msg select * from SUM.DIM_BASE_DAY fetch first 1000 rows onl y into SUM.DIM_BASE_DAY_TEMP";
    export to ev_c_kmap.del of del modified by chardel0x1e select * from ITG.EV_C_KMAP;
    load from RI_RI_KMAP.del.hpu of del modified by delprioritychar chardel0x1e replace into JK_TEMP;
    import from RI_RI_KMAP.del.hpu of del modified by delprioritychar chardel0x1e insert into JK_TEMP;

8. Import
   db2 import from myfile.del of del modified by coldel, chardel” commitcount 1000
    restartcount 30000 messages myfile.msg insert into staff

   -> myfile의 자료를 staff 테이블로 자료를 반입하며 delimiter 구분은 (,), 문자영 구분은 (“”)로 인식함.
      또한 myfile의 자료를 30000행부터 반입하며 1000건마다 commit을 수행함

9. Load
   db2 load from myfile modified by coldel, dumpfile=myfile.dmp pagefreespace=10
   savocount 10000 rowcount 100000 warningcount 1000 messages myfile.msg
   insert into staff for exception staff_exp

  -> delimiter 형식의 myfile에서 대용량 자료의 load를 수행.
     Delimiter 형식은 (,)이고 dump file은 현재 디렉토리에서 myfile.dmp로 지정.
     Dump file에는 data의 자료형식이 맞지않아 load가 거부되는 데이터가 저장.
     Load시 Table의 각 page는 10%의 여유공간이 남겨짐.
     데이터 load시에 10000건마다 savepoint를 가지며(commit), myfile에서 100000만을 읽음.
     데이터 load시 1000개의 경고가 발생하면 load가 중지되고 message는 myfile.msg로 저장됨.
     데이터 load후 기본키 Unique성을 위반하여 삭제단계에서 지워지는 데이터는 staff_exp라는 예외 Table로 들어감.

10. Load
   db2 "load from /n01stage1/export/sam/tb_ccpiiahier_t2.del of del                             1
      modified by dumpfile= /n01stage1/LOAD/tb_ccpiiahier_t2/dump/tb_ccpiiahier_t2              2
      warningcount 10000                                                                        3
      messages /n01stage1/LOAD/tb_ccpiiahier_t2/msgs/tb_ccpiiahier_t2                           4
      replace into pltstag.tb_ccpiiahier_rs2                                                    5
      data buffer 10000 cpu_parallelism 1                                                       6
      partitioned db config mode partition_and_load                                             7
      partitioning_dbpartnums (135,136,137,138,139,140)“                                        8

      1. 적재 할 SAM Data의 경로 및 SAM File 형식
      2. 파일 유형 수정자 옵션 중 dump file을 받을 경로
          - dumpfile : SAM File 적재 중에 Data의 type이 맞지 않는 행은 Table로 기록되지 않고 지정된 dumpfile로 쌓인다.
      3. Data 적재 시 warning이 10000건 이상이 일어나면 Load작업을 취소한다.
      4. Data적재 완료 후 처리된 결과에 대한 Message File
      5. 해당 Table의 기존 내용을 삭제한 후 현재 지정된 SAM File을 처음부터 적재한다.
         기존 Data에 추가를 하려면 insert into 옵션을 쓴다.
      6.  Load Utility Data전송을 위한 버퍼 스페이스와 CPU 병렬 처리수
      7. 병렬 DB로의 적재 시 Data partitioning과 load를 모두 수행한다.
      8. Data적재 전 Data partitioning을 수행하는 노드를 135,136,137,138,139,140로 지정.

8. script에서 query 화일 실행
    db2 -tvf a.sql (화일에서 db2 생략)
    a.sql (화일에 db2 포함)
    db2batch -d edwid_t -f a.sql -r a.out
   
9. Connection 상태 체크
    ksh -fx a.sql
   
10. Procedure compile
    db2 -td@ -f 프로시저화일명
              
11. Table Column 수정
    db2 "ALTER TABLE SUM.SU_CUST_DAYBY_DIM ALTER COLUMN IVPT_NAME SET DATA TYPE VARCHAR(256)"
    db2 "alter table ITG.EV_C_GENL_INQ_HIST add column MIGRT_DSTIN_CD CHAR(2)”
  
12. count확인
    while true do db2 "select count(1) from ITG.EV_C_COMM with ur
    echo "---"
    sleep 30
    done
   
13. index 확인
    desci table명   
    db2 "describe indexes for table SUM2.SU_CRM_PSTN_200601"
   
14. runstates 명령어
    : 자주 변경하는 테이블에 대해서 적절한 간격으로 실행
    : 성능이 아주 중요한 요소로 간주되는 응용프로그램을 바인딩하기전에 실행
    : 테이블 및 인덱스 데이터에서 통계를 수집하여 액세스 플랜 선택을 위한 정확한 정보를 옵티마이저에게 제공
    db2 "runstats on table ITG.EV_C_CUST_ORD_INFO with distribution and detailed indexes all allow write access" 
    db2 "runstats on table sum.SU_WIRE_DAYBY_SUM_T03 with distribution and indexes all util_impact_priority 60" 
    db2 "runstats on table $SCHEMA.$TABLE with distribution on key columns and detailed indexes all allow write access"
    db2 "runstats on table SUM.SU_WIRE_DAYBY_SUM with distribution on key columns and detailed indexes all allow write access"
    runstat.ksh -t itg EV_C_KMAP

15. db2look 명령어(ddl문 자동생성)
    db2look -d db명 -e -z 스키마명 -t 테이블명 -o 화일명
    ex)db2look -d edwid -e -z SUM -t SU_PD_AR_DAYBY_DIM -o a.out

    db2look -d edwid -e -nofed -z SUM2 -t SU_CRM_BILL_WIRE_DAYBY_SUM_200603 -o SU_CRM_BILL_WIRE_DAYBY_SUM_200603.ddl

15. create index
    CREATE INDEX "itg     "."EV_C_KMAP_X1" ON "itg     "."EV_C_KMAP"
        ("SOURCE_TB_NAME") ASC,
         "NO_TYPE_CD") ASC,
         "UNIFY_CUST_ID" ASC);
       
    db2 "create index itg.ACEXP_INFO_T_X1 on itg.EV_C_CUST_ORD_ACEXP_INFO_T (SRC_ID_CD)"
   
16. tail -f    edw_c_ett.log |grep Iard040i   

17. skew 확인
    db2 "select nodenumber(해당테이블 첫번째 컬럼명), count(*) from 스키마.테이블명 group by nodenumber(해당테이블 첫번째 컬럼명) order by 1"

    check skew itg.ar_ar

 주의 사항 skew 확인 script의 경우 해당 table에 대해 group by를 수행합니다. 수십 억건에 해당하는 table에는 사용을 자제.
  이런 table에 대해서는 DBA에게 요청.
       
18. 파티션 키 확인 script
  check dpk SUM.SU_WIRE_DAYBY_SUM_MB
  혹은 db2look ?d edwid_t ?e ?t tablename ?o tablename.ddl
  db2look -d edwid -e -z sum -t  SU_CRM_PSTN_MONBY_SUM_T99

19. reorg 확인
 db2 "reorg table SUM.SU_WIRE_DAYBY_SUM allow read access use ttsys1 on all dbpartitionnums"

 db2 "reorgchk current statistics on table ITG2.EV_U_ETC_SVC_BILL_INFO_200603"

 db2 "reorgchk current statistics on table SUM2.SU_PD_AR_MONBY_DIM"
 
 [db2] Reorg 명령으로 Datafile , Database 정리
 
 http://blog.naver.com/forrest/5512194
 
 -reorgchk를 실시한 후에 성능향상을 위해 주로 실행한다.
 
 -SYSADM,SYSCTRL,SYSMAINT,DBADM, or  CONTROL privilege가 필요
 
 -사용되지 않은 공간을 지우고 table 이나 index data를 연속적인 페이지로 다시 구성함
 
 -table에 자주사용되는 index가 있을 경우 해당 index를 사용하여 reorg를 실행aindex순서와 동일하게 데이터가
  재구성됨
 
 -만약 reorg 도중 어떤 error로 인하여 event가 중단된 경우 reorg에 의해 생성된 temporary파일을 지우지
  않아야 함 a DB2가 recovery 을 위하여 그들을 사용함
 
 ---------------------------------------------------------------------------------------------
 EX1> 특정 Table만 Reorg할때
 
 $db2  reorg  table  db2cert.tabname
 
 EX2> 특정 Index만 Reorg할때
 
 $db2  reorg  table  db2cert.tabname  index db2cert.indexname
 
 EX3> Reogr시 Tempporary tablespace를 사용할 때
 
     $$db2  reorg  table  db2cert.tabname  index db2cert.indexname [ use tempspace1 ]

 20. PK 확인
      SELECT SYSIBM.SYSCOLUMNS.NAME,  
         SYSIBM.SYSCOLUMNS.TBNAME,  
         SYSIBM.SYSCOLUMNS.COLTYPE,  
         SYSIBM.SYSCOLUMNS.NULLS,  
         SYSIBM.SYSCOLUMNS.CODEPAGE,  
         SYSIBM.SYSCOLUMNS.DBCSCODEPG,  
         SYSIBM.SYSCOLUMNS.LENGTH,  
         SYSIBM.SYSCOLUMNS.SCALE,  
         SYSIBM.SYSCOLUMNS.COLNO,  
         SYSIBM.SYSCOLUMNS.COLCARD,  
         SYSIBM.SYSCOLUMNS.KEYSEQ,  
         SYSIBM.SYSCOLUMNS.DEFAULT 
    FROM SYSIBM.SYSCOLUMNS 
   WHERE ( SYSIBM.SYSCOLUMNS.TBCREATOR = :age_createor ) AND 
         ( SYSIBM.SYSCOLUMNS.KEYSEQ <> 0 ) AND 
         ( SYSIBM.SYSCOLUMNS.KEYSEQ is NOT NULL ) AND 
         ( SYSIBM.SYSCOLUMNS.TBNAME like :age_tbname )  
ORDER BY SYSIBM.SYSCOLUMNS.TBNAME ASC,  
         SYSIBM.SYSCOLUMNS.KEYSEQ ASC  

21. Package 리스트 보기
    db2 list packages for schema pltitg
    Command Parameters
 FOR ALL : 데이터 베이스에 있는 모든 패키지를 보여준다.
  SCHEMA : 명시된 스키마에 대한 패키지를 보여준다.
  USER : 현재 USER의 모든 패키지를 보여준다.
  SYSTEM : 데이터 베이스의 모든 시스템 패키지를 보여준다

22. rowlen 구하기
    sh rowlen -t sum su_wire_dayby_sum_mb
   
23. table 확인
    SELECT * FROM SYSCAT.PACKAGEDEP
    WHERE BNAME = 'TB_CCPISVCNOHS_MB'
      AND PKGSCHEMA = 'ITGUSR1'
    WITH UR;   
   
   
MIGRT_BASE_DAY 이행기준일자 No DATE 이행기준일자-데이터 기준일자
MIGRT_WORK_DATE 이행작업일시 No TIMESTAMP 이행작업일시-실제 ETT한 시간
MIGRT_WORK_CD MIGRT_WORK_CD No CHAR(1) 이행작업코드-INSERT,UPDATE,DELETE 코드


24. 테이블 description 확인시
db2 "describe table sum.테이블명"
db2 "describe table sum.SU_CRM_PSTN_MONBY_SUM_T99"
db2 "describe table SUM.SU_CRM_MEGA_MONBY_SUM_T99"

25. ROWNUM 구하기
① FETCH FIRST 1 row onl y
② ROW_NUMBER() OVER (ORDER BY COLUMN DESC) AS ROW_NUM

26.날짜연산
SELECT current timestamp from sysibm.sysdummy1;
TO_CHAR()
TO_DATE()

27.집합연산
UNION, INTERSECT, EXCEPT

db2expln -d edwid -g -c sumusr1 -p Usum842c -o Usum842c.pln -z ";"
db2expln -d edwid -g -f voice.sql -o voice.out -z ';'

db2expln -d(db명) -c(user명) -p(package명) -f(sql 파일명) -o(outfile 이름)

28. db2 list command options

COMMIT OPTION OFF --> set DB2OPTIONS = "+c"

Option  Description                                                Current Setting
 ------  ----------------------------------------  ---------------
   -a    Display SQLCA                                           OFF
   -c    Auto-Commit                                              ON
   -e    Display SQLCODE/SQLSTATE                     OFF
   -f    Read from input file                                      OFF
   -l    Log commands in history file                        OFF
   -n    Remove new line character                         OFF
   -o    Display output                                            ON
   -p    Display interactive input prompt                    ON
   -r    Save output to report file                               OFF
   -s    Stop execution on command error                OFF
   -t    Set statement termination character               OFF
   -v    Echo current command                               OFF
   -w    Display FETCH/SELECT warning messages ON
   -x    Suppress printing of column headings          OFF
   -z    Save all output to output file                         OFF


29. 테이블스페이스 사이즈 확인 --> tbssize

dbclick 2008.12.19  14:15  [203.244.197.254]

K* 사에서 사용하던 스크립트 이군요.. 잘 봤습니다.

답글쓰기

댓글쓰기

댓글쓰기 입력폼

포스트 목록 닫기

목록보기
 
산이 (aproc01)
프로필     
 인기도 :
 이 블로그 점수주기
전체 글보기(162)
DAP
DB 자료
Data Warehouse
사진
음식이야기
ERP - (EBOOK CRM SAP)
기본폴더
오늘 전체
방문자 47 26937
구독자 0 0
댓글 0 4
참조글 0 0
HanRSS 로 구독하기Fish 로 구독하기
2009 11월
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
최근 댓글 전체보기
정말 좋은 자료 감사합..
K* 사에서 사용하던 ..
다녀간 블로거 더보기
- 벌침이야기2
- 신랑
- isaacihan
- egeung
- wntkdfid
 즐겨찾기
 즐겨찾기 글모음
개설일 : 2008/03/07