CSSCAN 0 1 7,317

by 타락천사 [타락천사] csscan [2009.03.13 15:49:04]



1. CSSCAN 란 ?
: CharacterSet 변경 시에 발생할 문제를 미리 체크할 수 있는 Oracle Utility

2. CSSCAN 설치
: Technet 혹은 Metalink 참조

  cd $ORACLE_HOME/rdbms/admin
  export ORACLE_SID=TGDOM
  sqlplus /nolog
  SQL>conn / as sysdba
  SQL>set termout on
  SQL>set echo on
  SQL>spool csminst.log
  SQL>START crminst.sql
 
  Check the csminst.log for errors
 
  SET ECHO {ON | OFF}
    Controls whether the START command lists each command in a script as the command is executed. 
  -- Script 에서 실행되는 Command 자체를 로그에 기록


  SET TERM[OUT] {ON | OFF}
    Controls the display of output generated by commands executed from a script.
   
    csminst.sql 내용
rem   csminst.sql
rem   Create tables for Database Character Set Migration Utility
rem   This script must be run while connected as SYS


csmig  User 생성 및 권한 부여...

alter user csmig default tablespace SYSTEM
/
==> Default Tabelspace 가 System 으로 지정된다.
    csscan  결과가 System Tablespace 에 생성된다는 의미이다.
    원하는 Tablespace 가 있다면 Script 내에서 수정하자.

 CSM$TABLES
  : CSSCAN 대상이 되는 Table Level 통계정보
 CSM$COLUMNS
  : CSSCAN 대상이 되는 Table 의 Column Level 통계정보
 CSM$ERRORS
  : CSSCAN 대상이 되는 Table 의 ROWS 단위로 오류가 발생한 칼럼 값 정보
==> !!! 주의 사항 CSSCAN 실행 후 CSSCAN 결과는 로그 및 CSM$테이블들에
        쌓인다. 이후 다시 CSSCAN 을 수행하면 CSM$테이블의 데이타가 초기화 된다.
        CSSCAN 수행 후 아래와 같이 하여 백업 받도록 한다.

    Create Table SCOTT_CSSCAN_RESULT AS
    select c.username, d.OBJECT_NAME, b.TABLE_NAME, b.COLUMN_NAME, a.errcnt, a.cnverr, a.maxsiz
    from CSM$COLUMNS a, DBA_TAB_COLUMNS b, dba_users c, dba_objects d
    where a.usr# = c.user_id
    and   c.username =’SCOTT’   -- 임의의 유저보 바꾼다.. 혹은 해당 절을 없앤다..
    and   a.obj# = d.object_id
    and   d.object_type =’TABLE’
    AND   d.object_name = b.table_name
    and   a.col# = b.COLUMN_ID
    and ERRCNT <> 0 and CNVERR <> 0 ;       
      
     실행 결과 산출물 A) *.txt, ==> 통합 정보
      Database Scan Summary Report
     
      Time Started  : 2009-03-02 16:55:16
      Time Completed: 2009-03-02 16:56:47
     
      ....
     
      USER.TABLE                                                   Convertible      Exceptional
      ------------------------------------------------------- ---------------- ----------------
      SCOTT.OFFICE_RENAME                                                    0               10
      SCOTT.OFFICE_COMP_RENAME                                               0                9
      SCOTT.TRSO_CNTR_RENAME                                                 0              205
      ------------------------------------------------------- ---------------- ----------------
     
      [Distribution of Convertible Data per Column]
     
      USER.TABLE|COLUMN                                            Convertible      Exceptional
      ------------------------------------------------------- ---------------- ----------------
      SCOTT.OFFICE_RENAME|OFC_ADDR                                           0                9
      SCOTT.OFFICE_RENAME|OFC_RMK                                            0                1
      SCOTT.OFFICE_COMP_RENAME|OFC_ADDR                                      0                9
      SCOTT.TRSO_CNTR_RENAME|CMDT_DESC                                       0               94
      SCOTT.TRSO_CNTR_RENAME|REMARKS                                         0              111
      ------------------------------------------------------- ---------------- ----------------


   
        실행 결과 산출물 B) *.out, ==> CSSCAN 실제 결과 
        Enumerating tables to scan...
       
        . process 1 scanning SCOTT.OFFICE_RENAME
        . process 1 scanning SCOTT.OFFICE_COMP_RENAME
        . process 1 scanning SCOTT.DD_INV_MAIN_RENAME
        . process 1 scanning SCOTT.DD_INV_DTL_RENAME
        . process 1 scanning SCOTT.TRSO_CNTR_RENAME
       
        Creating Database Scan Summary Report...
       
        Creating Individual Exception Report...
       
        Scanner terminated successfully.

          실행 결과 산출물 C) *.err  ==> CSM$COLUMNS 의 내용 로그

3. CSSCAN 실행
 csscan help=y  ==> 기본 메뉴얼
Character Set Scanner v2.0 : Release 10.1.0.4.0 - Production on Mon Mar 2 17:32:20 2009

Copyright (c) 1982, 2004, Oracle.  All rights reserved.


You can let Scanner prompt you for parameters by entering the CSSCAN
command followed by your username/password:

  Example: CSSCAN SYSTEM/MANAGER

Or, you can control how Scanner runs by entering the CSSCAN command
followed by various parameters. To specify parameters, you use keywords:

  Example: CSSCAN SYSTEM/MANAGER FULL=y TOCHAR=utf8 ARRAY=102400 PROCESS=3

Keyword    Default Prompt Description
---------- ------- ------ -------------------------------------------------
USERID             yes    username/password
FULL       N       yes    scan entire database
USER               yes    owner of tables to be scanned
TABLE              yes    list of tables to scan
EXCLUDE                   list of tables to exclude from scan
TOCHAR             yes    new database character set name
FROMCHAR                  current database character set name
TONCHAR                   new national character set name
FROMNCHAR                 current national character set name
ARRAY      102400  yes    size of array fetch buffer
PROCESS    1       yes    number of concurrent scan process
MAXBLOCKS                 split table if block size exceed MAXBLOCKS
CAPTURE    N              capture convertible data
SUPPRESS                  maximum number of exceptions logged for each table
FEEDBACK                  report progress every N rows
BOUNDARIES                list of column size boundaries for summary report
LASTRPT    N              generate report of the last database scan
LOG        scan           base file name of report files
PARFILE                   parameter file name
PRESERVE   N              preserve existing scan results
LCSD       N       no     enable language and character set detection
LCSDDATA   LOSSY   no     define the scope of the detection
HELP       N              show help screen (this screen)
---------- ------- ------ -------------------------------------------------
Scanner terminated successfully.
    
EXPORT 와 흡사하다.
USERID   : 실제로 실행 하는 유저명
FULL     : FULL=Y 이면 데이타베이스 내의 모든 것
USER     : USER=SCOTT 이면 CSSCAN 대상 TABLE 쥔장
TABLE    : CSSCAN 대상 TABLE LIST UP
EXCLUDE  : CSSCAN 제외 TABLE LIST UP
TOCHAR   : 변경하고자 하는 캐릭터셋
FROMCHAR : 현재 캐릭터셋 
ARRAY    : 102400 Fetch 하는Array Size
PROCESS  : CSSCAN 진행하는 Process Count
LOG      : Log 화일명
PARFILE  : 파라미터 화일명

 

 

[ 주의 사항 ]

1.  생각보다 로드가 심하다. [ 실행 시 주의 하자 ]

     모든 대상 Table 에 문자 값이 존재 할수 있는 모든 칼럼 ( Char, Varchar, long, Clob) 에 대해서

     Full Scan 하여 일정 단위로 Fetch 한후 캐릭터셋 문제 발생 여부를 판단 한다.

     발생 가능한 문제에 대해서 체크 하는 것이지, 실제 캐릭터셋을 변화 해주는 툴은 아니다.

2.  결과 확인 시 주의 사항 결과 차이 존재

USER  level 시에는  CSM$COLUMN 에서 OBJ#, COL# LEVEL 에서 중복된 값이 없으나
TABLE LEVEL 시에는 CMS$COLUMN 에서 OBJ#, COL# LEVEL 에서 중복된 값이 존재 한다.
==> 아마두 작동 하는 매커니즘이 다른듯 싶다.
TABLE LEVEL 시에는 TABLE_NAME, COLUMN_NAME 을 GROUP BY 을 통해서

수정 한다.

 

by Ejql [2009.03.16 09:36:48]
참으로 신기하네요. 왜냐하면. 지난주에 케릭터셋에 관해서 친구넘이 물어본적이 있어서. 이쪽에는 해본적이 없어서 아는정도만 말해줬는데.
그거에 관해서 잠시 나왔던 자료네요. 다시 한번 볼 기회를 주신천사님께 감사드립니다.

이제 5번만 더 계기가 있으면 확실히 이름정도는 외울수 있겠네요. ㅎㅎ
(모르는 사람을 기억하려면 7번의 우연이 있어서 기억할 수 있다고 합니다~)
댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입