728x90


Question

This document describes how to determine if a table has been manually taken out of check pending state.

Answer

To determine if a table has been taken out of check pending (by the SET INTEGRITY ... IMMEDIATE UNCHECKED command), you can use the following SELECT query to see what options were used to perform the SET INTEGRITY command: 

select tabschema as Schema, tabname as Name, status as State, substr(const_checked,1,1) as Foreign_Keys, substr(const_checked,2,1) as Check_Constraints, substr(const_checked,5,1) as Summary_Tables from syscat.tables where tabname = '<tablename>' and tabschema = '<schema>'


...where <tablename> is the table and <schema> is the table schema.

For example, if <schema> = db2inst1 and <tablename> = employee, then an example of the result of the query is as follows:


SCHEMA NAME STATE FOREIGN_KEYS CHECK_CONSTRAINTS SUMMARY_TABLES
-------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ----- ------------ ----------------- --------------
DB2INST1 EMPLOYEE N U Y Y 

1 record(s) selected.

The FOREIGN_KEYS column shows the status of the check constraint for table DB2INST1.EMPLOYEE and is shown to have a value of 'U' -- indicating it was checked by the user using the SET INTEGRITY ... IMMEDIATE UNCHECKED command.


728x90
728x90

Question

This technote provides troubleshooting information for the situation where your table data is corrupted and you do not have a recent good backup to restore your data. It describes a method for dumping the table data.

Answer

You can dump table data by using the ddel option of the db2dart command. The database needs to be offline to run the db2dart command.

This example extracts data from the EMPLOYEE table residing in the default USERSPACE1 tablespace with id 2 in the SAMPLE database in a DB2 V9.7 environment.

$db2dart sample /DDEL 

Table object data formatting start.
Please enter
Table ID or name, tablespace ID, first page, num of pages:
EMPLOYEE,2,0,5

14 of 14 columns in the table will be dumped.
Column numbers and datatypes of the columns dumped:
0 CHAR() -FIXED LENGTH CHARACTER STRING
1 VARCHAR() -VARIABLE LENGTH CHARACTER STRING
2 CHAR() -FIXED LENGTH CHARACTER STRING
3 VARCHAR() -VARIABLE LENGTH CHARACTER STRING
4 CHAR() -FIXED LENGTH CHARACTER STRING
5 CHAR() -FIXED LENGTH CHARACTER STRING
6 DATE
7 CHAR() -FIXED LENGTH CHARACTER STRING
8 SMALLINT
9 CHAR() -FIXED LENGTH CHARACTER STRING
10 DATE
11 DECIMAL
12 DECIMAL
13 DECIMAL
Default filename for output data file is TS2T6.DEL,
do you wish to change filename used? y/n
n

Filename used for output data file is TS2T6.DEL. If existing file, data will be appended to it.

Formatted data being dumped ...
Dumping Page 0 ....
Table object data formatting end.

The requested DB2DART processing has completed successfully!
Complete DB2DART report found in:
/home/v97fp2/sqllib/db2dump/DART0000/SAMPLE.RPT


Note: Above example dumps 5 pages of data from the table Employee. If you are not sure of the number of pages, use a large number such as 99999 so that all the pages of the table will get dumped.


Sample contents in the output file (called TS2T6.DEL in this example) found in the location /home/v97fp2/sqllib/db2dump/DART0000 are as follows:

$cat TS2T6.DEL 

"000010","CHRISTINE","I","HAAS","A00","3978",19950101,"PRES ",18,"F",19630824,+0152750.00,+0001000.00,+0004220.00
.....

"200340","ROY","R","ALONZO","E21","5698",19970705,"FIELDREP",16,"M",19560517,+0031840.00,+0000500.00,+0001907.00



http://www-01.ibm.com/support/docview.wss?uid=swg21509964

728x90
728x90

Problem(Abstract)

An 'SQL0433N Value "XXXX" is too long' error is returned when the TIMESTAMDIFF scalar function is run against a database with Oracle compatibility.

Symptom

SQL0433N Value "XXXX" is too long. SQLSTATE=22001

Cause

Subtraction of timestamp values returns DECFLOAT(34), representing the difference as a number of days. As a result, you can not use the TIMESTAMPDIFF scalar function because it depends on the default behavior of timestamp subtraction. Similarly, subtraction of date values returns DECFLOAT(34), which also represents a number of days, because date values are really TIMESTAMP(0). For more details on the functions that are changed under date_compat mode, please go through the 'DATE data type based on TIMESTAMP(0)' in the Related URL below.


Environment

Environments where databases are created with Oracle compatibility mode enabled.

Diagnosing the problem

The following test case can help you determine if you are encountering the problem:

  1. Set the DB2_COMPATIBILITY_VECTOR registry variable as below to enable all of the supported Oracle compatibility features:

    db2set DB2_COMPATIBILITY_VECTOR=ORA
    db2stop
    db2start
     
  2. Created the oratest database for testing purpose: 

    db2 create db oratest
    DB20000I  The CREATE DATABASE command completed successfully. 

  3. Running the TIMESTAMPDIFF scalar function will return SQL0433N error as below:

    db2 "values(TIMESTAMPDIFF(4,CHAR(TIMESTAMP('2001-09-29-11.25.42.483219')-TIMESTAMP('2001-09-26-12.07.58.065497'))))"

    1
    -----------
    SQL0433N  Value "2.970652982893518518518518518518519" is too long. SQLSTATE=22001

Resolving the problem

This is a restriction on the Oracle compatibility mode. A comparison of the tradeoffs needs to be done to determine if Oracle compatibility mode is more necessary than the use of these functions. one of the solutions below can be used as a work around when the database has been created with Oracle compatibility mode enabled:



o  Reducing the length of the timestamp

    db2 "values(TIMESTAMPDIFF(4,CHAR(TIMESTAMP('2010-04-01-09.43.05')-TIMESTAMP('2010-05-01-09.43.05'))))"
      1
      -----------
       
                0
        1 record(s) selected.


o  Multiply the DECFLOAT result to get the units you are interested in.  
    db2 "values ( TIMESTAMP('2001-09-29-11.25.42.483219')-TIMESTAMP('2001-09-26-12.07.58.065497') ) /* days */ * 24 /* hours per day */ * 60 /* minutes per hour */"
      1                                         
      ------------------------------------------
             4277.740295366666666666666666666668

        1 record(s) selected.


http://www-01.ibm.com/support/docview.wss?uid=swg21567168

728x90
728x90

먹보고릴라님 | 쿼리 | 2013-12-16 17:48:46


안녕하세요

CSV 파일을 import from 으로 하여 파일을 insert  시키는데 있어

csv파일에 있는 데이터들이 반은 들어가고 반이 안들어가게 되어 질문하게 되었습니다.

SQL3129W  The date, time, or timestamp field containing ""2013-8-2 12:3:38""
in row "11" and column "10" was padded with blanks.

SQL3129W  The date, time, or timestamp field containing ""2013-8-2 11:39:20""
in row "11" and column "16" was padded with blanks.

SQL3129W  The date, time, or timestamp field containing ""2013-8-2 11:39:20""
in row "11" and column "17" was padded with blanks.

SQL3148W  A row from the input file was not inserted into the table.  SQLCODE
"-180" was returned.

SQL0180N  The syntax of the string representation of a datetime value is
incorrect.  SQLSTATE=22007


위와 같은 메시지가 나옵니다.

위와 같은 메시지를 처리할려면 trim으로 공백을 지워야 할 것 같은데

방법이 있을까요?




pajama 2013-12-17 17:07:17
데이터 파일을 수정하기는 어려운 상황이신듯 합니다.
재현을 해보려 했으나 잘되지 않네요
임시테이블에 CHAR, VARCHAR형태로 입력후에 trim, timestampformat을 사용해서 로드하시는건 어떠신지요


먹보고릴라 2013-12-18 00:36:20
pajama님 안녕하세요
그러면 임시테이블에 값 형태를 char로 변경 후 insert 하니 됩니다. 
이후 실제 테이블에 값을 입력 하려할 때 형태를 맞출려면 지난번 알려주신 timestampformat 형태 하여 insert하나요?
제가 test하는건 대량의 데이터를 insert 구문으로 하기 어려울때 csv 파일로하여
import 시키는 test 하고 있습니다.
그런데 저 날짜 형태에서 계속 헤매고 있습니다. 
그리고 실제 테이블에 ID 값이 기본값으로 되어 있는데 임시테이블을 만들때 실제 테이블 create 구문으로 만들려하면
만들어지지 않더라고요 그래서 그냥INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (CACHE 1), 
이 값을 빼고 만들면 되는데 테이블 복사하려 하니 ID 값에서 걸리고요...
도와주세요~^^

먹보고릴라 2013-12-18 03:27:38
import from data.csv of del modified by timestampformat="YYYY-MM-DD HH:MM:SS" insert into DB명 (column명,....)
SQL3109N The utility is beginning to load data from file "data.csv".

SQL3191N The field in row "1", column "10" which begins with "2013-8-19
11:0:37" does not match the user specified DATEFORMAT, TIMEFORMAT, or
TIMESTAMPFORMAT. The row will be rejected.

SQL3110N The utility has completed processing. "1" rows were read from the
input file.

이와 같이 다른 방법을 찾긴 한 것 같은데요.. 에러에 대한것을 검색해봐도 뭔말인지 이해가 안가네요... 
혹시 아실까요?
데이터는 다른 값들은 들어가는대 timestamp형식만 데이터가 들어가질 않네요

pajama 2013-12-18 22:10:48
아래와 같이 재현해 보았습니다.

로드 파일 data.csv
1,1,1,1,1,1,1,1,1,2013-8-2 12:3:38,1,1,1,1,1,2013-8-2 11:39:20,2013-8-2 11:39:20

테이블
create table test1(
col1 int,
col2 int,
col3 int,
col4 int,
col5 int,
col6 int,
col7 int,
col8 int,
col9 int,
col10 timestamp,
col11 int,
col12 int,
col13 int,
col14 int,
col15 int,
col16 timestamp,
col17 timestamp)


테스트 1
import from data.csv of del insert into test1
SQL3129W 오류가 발생하면서 데이터 입력이 되지 않습니다.


테스트 2
import from temp4.csv of del modified by timestampformat="YYYY-MM-DD HH:MM:SS" insert into test1
SQL3191N 오류가 발생하면서 데이터 입력이 되지 않습니다.


테스트 3
import from temp4.csv of del modified by timestampformat="YYYY-M-D H:M:S" insert into test1
데이터 입력됨


timestampformat을 import 옵션에서 지정할 수 있는데 MM DD HH 와 같은 경우 한자리 숫자를 나타낼때 01 ~ 09 식으로 나타내기 때문에 형식이 일치하지 않아 오류가 발생합니다.

timestampformat 옵션에 대해서는 아래 페이지를 참고하세요
http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.admin.cmd.doc/doc/r0008304.html

먹보고릴라 2013-12-19 16:28:51
pajama님 안녕하세요
테스트해주심에 감사합니다.^^
항상 도와주셔서 감사합니다.^^
해당 참고 페이지를 봐도 잘 몰랐는데 겨우 문제를 해결했습니다. 감사합니다.



728x90
728x90

볼탱이님 | 2013-12-11 16:52:50


안녕하세요. DB2를 접한이 한달도 채 되지 않은 초보 관리자 입니다. 다름이 아니오라 현재 log_dir 과 archive_dir에 동일한 이름의 로그가 존재합니다. 존재하는 로그들은 현재 사용중인 Active log들이 아니고 과거에 사용한 로그들입니다. 예를 들어 현재 S0000020.LOG 부터 S0000040.log까지가 사용중이라면 S0000009.LOG, S0000010.LOG, S0000011.LOG, S0000015.LOG 이렇게 몇개의 로그가 log_dir에 남아 있습니다. 이동 시 빠진 줄 알고 archive_dir로 옮기려고 보니까 이전 log 파일 포함 위의 파일들과 동일한 파일명의 로그가 존재하고 있더라구요. 제가 알기로는 사용 완료한 log파일들은 archive로 이동하는 걸로 알고 있습니다. 혹시 제가 잘못 알고 있는 것이라던지 해당 사항이 왜 발생하는지 조언 부탁드립니다. 제가 아는게 없어서 내용 설명이 많이 부족하네요 ^^; 이상 긴글 읽어주셔서 감사드립니다.




pajama 2013-12-11 18:52:40
안녕하세요. 말씀하신대로 로그가 모두 사용되었을때 로그 아카이브가 발생합니다. 로그 아카이빙 설정이 되어있을때는 로그 아카이브는 수행하되 모두 사용한 active 로그파일을 삭제하는 것이 아니고 이름을 변경하여 재사용합니다. 아니면 트랜잭션이 대량으로 들어와 2차 로그가 생성되었다가 현재는 빈상태로 남아 있는 것일 수도 있습니다.

꼭 로그파일을 직접 삭제하시겠다면 PRUNE명령이나 DB 재시작(deactivate, activate)를 하시면 됩니다.
아래 더 자세한 설명이 있으니 참고하십시오.

http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm.db2.luw.admin.ha.doc/doc/c0008178.html


728x90
728x90

DB는내운명님 | 2013-12-09 17:44:52


인스턴스 설치 후 제대로 설치 되었는지  확인하는 방법이 있나요?

제가 알기로는 .profile (aix) / .bashrc(linux) 에서 확인이 가능하지만 이 방법은 제대로 설치됬는지 에 대한 것은 아닌거 같습니다.

일반적으로 db2start가 제대로 되면 "인스턴스가 설치가 잘 됬구나" 라고 생각할수 있는데,

위 방법을 제외한, 예를들어 log로 확인이 가능하는지, 아니면 다른 방법이 있는지 조언 부탁 드립니다.




pajama 2013-12-09 22:53:30
db2 설치 로그를 확인하신다면 /tmp 디렉토리에 db2_install.log.1111111 과 같은 형태의 파일을 확인해 보십시요.

그리고 인스턴스를 확인하는 db2ilist라는 명령이 있습니다.

unix/linux상이라면
root계정 또는 db2 인스턴스 계정에서 db2ls 명령을 실행하면 db2 설치 디렉토리가 보입니다.

$ db2ls

Install Path Level Fix Pack 
------------------------------------------------------
/opt/IBM/db2/V9.7 9.7.0.8 8 

db2가 설치된 위치의 instance 디렉토리에서 db2ilist 명령을 수행하면 현재 존재하는 인스턴스가 보입니다.

$ /opt/IBM/db2/V9.7/instance/db2ilist
db2inst1


설치 로그와 마찬가지로 인스턴스 생성 로그도 /tmp 디렉토리에 db2icrt.log.1111111 형태의 파일 내용을 확인하시면 되겠습니다.


728x90
728x90

DB는내운명님 | 기타 | 2013-12-03 19:00:58


안녕하세요  DB2 업무를 하고 있습니다. 

다름이 아니라, backup fail 후 SQL2048N Reason 3 이 발생하는 원인 파익이 안되서 문의를 드립니다. 

인포센터 에서는
 
SQL2048N

An error occurred while accessing object object. Reason code: reason-code.

Reason code 3 ->   An unlock object operation failed during the processing of a database utility

혹시 원인 및 해결방안 알고 계신다면, 도움 부탁 드립니다.  

고수님들의 조언 부탁 드립니다. 





pajama 2013-12-03 22:34:40
백업중에 detach/attach, reorg등의 유틸리티로 인한 z lock이 발생하지 않는지 확인해보세요


728x90
728x90

활발이님 | 기타 | 2013-11-28 17:54:27


안녕하세요 automatic storage의 컨테이너에 관해서 질문드립니다.

- db2 restore db testdb2 taken at 20131126162315 redirect
  db가 없는 서버에 백업이미지의 db name과 동일하게 복원합니다.


 Tablespace ID                        = 0
 Name                                 = SYSCATSPACE
 Type                                 = Database managed space
 Contents                             = All permanent data. Regular table space.
 State                                = 0x2000100
   Detailed explanation:
     Restore pending
     Storage may be defined

 Tablespace ID                        = 1
 Name                                 = TEMPSPACE1
 Type                                 = System managed space
 Contents                             = System Temporary data
 State                                = 0x2000100
   Detailed explanation:
     Restore pending
     Storage may be defined

 Tablespace ID                        = 2
 Name                                 = USERSPACE1
 Type                                 = Database managed space
 Contents                             = All permanent data. Large table space.
 State                                = 0x2000100
   Detailed explanation:
     Restore pending
     Storage may be defined

 Tablespace ID                        = 3
 Name                                 = TESTTBS
 Type                                 = Database managed space
 Contents                             = All permanent data. Large table space.
 State                                = 0x2001100
   Detailed explanation:
     Restore pending
     Storage must be defined
     Storage may be defined

 Tablespace ID                        = 4
 Name                                 = SYSTOOLSPACE
 Type                                 = Database managed space
 Contents                             = All permanent data. Large table space.
 State                                = 0x2000100
   Detailed explanation:
     Restore pending
     Storage may be defined

 Tablespace ID                        = 5
 Name                                 = SYSTOOLSTMPSPACE
 Type                                 = System managed space
 Contents                             = User Temporary data
 State                                = 0x2000100
   Detailed explanation:
     Restore pending
     Storage may be defined


위와 같이 tablespace들은 restore pending 상태구요

제가 알기론 tablespace가 automatic storage일 경우 redirect 가 안되는 걸로 알고있습니다.
tablespace의 목록을 보시면 
3번의 경우같이 dms type 의 경우 아래 명령어로 경로를 재지정 해주는데
db2 "set tablespace containers for 3 using (file '/data/testtbs.dat' 1048576)"

1.
0, 1, 2, 4, 5, 번의 tbs는 automatic storege의 상황인데(db2가 만든 tablespace)
이런 경우 backup 이미지에 있는 automatic storage 의 path는 /home/db2inst1/db2inst1/NODE0000/TESTDB2인데
restore 할떄 to 옵션으로 db의 생성 경로는 바꿔주는데
이경우 container들의 경로는 바꾸지 못하는건가요?
2. 
"set tablespace containers for 3 using (file '/data/testtbs.dat' 1048576)" 으로 file로 사이즈까지 다시 지정해주면 되는데
"set tablespace containers for 3 using (path '/data')" 이렇게 백업이미지에 있는 tbs사이즈 그대로에서 path만 바뀌줄라면 자꾸 
SQL0298N  Bad container path.  SQLSTATE=428B2 가 뜨네요.,... /data/ 의 권한은 만족하는 상태구요..
path의 지정 방식이 따로 있는건지요
그리고 file 로 사용할때 뒤에 사이즈가 1048576 이면 1M로 만들겠다는 뜻이 아닌지.. db2top으로 볼시 사이즈가 다르네요

3.
마지막으로 automatic storage이 경로를 지정해주지 않아도 되며 dms와 sms의 혼재된 방식으로 
filesystem의 사용공간 안에서 tablespace를 automatic으로 사용하는 것 같은데
dms type에 autoresize 옵션을 사용해 tablespace의 공간을 automatic으로 사용하는것 과의 차이점은 무엇인지...




pajama 2013-11-30 01:11:11
1. restore할때 automatic storage를 사용할때 경로를 바꾸려면, restore 명령에서 경로를 지정하고 set tablespace 명령에서 using automatic storage 옵션을 사용합니다.

automatic stoage로 정의된 테이블스페이스 컨테이너에 대해 특정 경로를 지정하면 아래와 같이 오류가 발생합니다.
SQL20319N The SET TABLESPACE CONTAINERS command is not allowed on an
automatic storage table space. SQLSTATE=55061


2. 컨테이너 파일 위치를 변경할때는 (file '경로' 페이지수) 와 같이 씁니다.
restore 명령으로 file에서 path로 변경할 수 없습니다. 

1048576은 페이지수로 테이블 스페이스 페이지 사이즈에 의해 컨테이너 크기가 결정됩니다.
예를 들어 테이블스페이스 페이지사이즈가 4K라면 1048576*4096=4294967296 입니다.

페이지사이즈가 4K인 경우에는 db2top에서는 4G로 표시가 됩니다.


3. automatic storage는 스토리지 공간으로 사용할 파일시스템을 단일, 또는 그룹으로 사용하도록 정의할 수 있습니다. 
sms,dms과 같은 관리방식을 명시적으로 지정하지 않을 때, automatic storage용으로 정의한 스토리지 공간에 컨테이너가 단일, 또는 여러개로 분산되어 저장됩니다.

활발이 2013-12-02 09:42:37
답변 감사합니다.
1. 그럼 automatic storage는 경로를 재지정하지못하고 생성된 그 path 그대로 사용해야된다는 말씀이신가요

2. create user temporary tablespace <테이블스페이스명> managed by database using (file ‘<파일명>’ <크기>)이렇게 tbs를 생성하여 쓸때 file 에서 -> path로 변경할수 없다고 하시는것 같은데 
그럼 path 의 경우는 tbs를 (device ‘<디바이스파일명>' <크기>)로 생성하는 경우 인가요?

3. automaric storage의 컨테이너가 단일 또는 여러개로 분산되어 정해진 공간 영역의 size만큼 automatic으로 사용하는 것이고
단일 또는 여러개로 분산되어 저장 된다고 하셨는데
dms의 create tablespace <테이블스페이스명> managed by database using (file ‘<파일명1>’ <크기>, file ‘<파일명2>’ <크기>)
생성을 하면 단일 또는 분산되어 저장되는 것 역시 같은 것 같고, autoresize의 옵션을 주면 
정해진 size공간에서의 tbs의 공간을 autoresizing 하여 사용 하는 것 역시 같은 것 같은데 여기서의 차이점이 해결이 되지 않네요..

pajama 2013-12-02 11:03:15
1. automatic storage 경로를 재지정하시려면 아래와 같은 방식으로 수행합니다.
① automatic storage로 쓸 파일시스템 정의
restore db testdb on /testdb/storage1,/testdb/storage2,/testdb/storage3/ redirect

② 컨테이너를 automatic storage 공간 사용하도록 지정
set tablespace containers for 0 using automatic storage
...

③ restore 계속
restore db testdb continue


2. path는 SMS 방식이고 경로만 지정합니다. (path '/경로') device는 raw device 방식의 DMS 테이블스페이스입니다.
정리하면 file -> device, device -> file은 가능합니다 file, device -> path로는 불가능합니다. (DMS는 DMS로만, SMS는 SMS로만)



3. 말씀하신대로입니다. 관리자가 직접 테이블스페이스를 관리하느냐 DB에 맡기느냐 차이일텐데요.
컨테이너 추가삭제등의 작업을 체계적으로 한다면(예를 들면, 컨테이너 이름 정의등) sms,dms 방식으로 할수도 있겠지요.

활발이 2013-12-02 13:05:40
모르고 아리송 했던 것들이 잘 정리 되었습니다. 감사합니다.



728x90
728x90

OneStep님 | 개발 | 2013-11-26 16:31:51


안녕하세요~
델파이로 개발하고 DB는 DB2를 사용하고 있습니다.

ADO로 연결하여 AdoQuery에 insert, update, delete는 되는데..

Import 는 실행하면 에러가 납니다. (제어센터에서 실행할때는 정상수행이 됩니다)
※ 사용된 import문 입니다
IMPORT
FROM 'd:\데이터1천레코드.sql' OF DEL
MODIFIED BY                
delprioritychar coldel0x09 
INSERT INTO DB2ADMIN.testDB1
;


Create Table도 되구요.. 그런데 또, Create Database는 안되네요..

권한 문제일까요? 

이유가 뭘까요? 

몇일째 이것과 씨름을 하고 있습니다.

아래는 개발관련내용입니다.
DB2Util.dll과 DB2APP.dll에 해당 메소드가 있기는 한데요.. 일단 DB2import의 메소드 형태를 몰라서 델파이로 불러올 수도 없고... 좀 답답하네요..
왠만하면.. DLL에서 펑션 Call해서 사용하지는 않았으면 해서요... (사실, 구조도 몰라서 사용하기도 어렵네요 ㅜㅜ)

아시는분 계시면 알려주시면 정말 감사하겠습니다 ^^

감사합니다 (--)(__)(--)(__)




pajama 2013-11-27 00:39:12
import를 odbc에서 수행하려면 sysproc.admin_cmd 프로시저를 아래와 같이 사용합니다.

CALL SYSPROC.ADMIN_CMD
('IMPORT FROM /home/userid/data/myfile.ixf 
OF IXF MESSAGES on SERVER INSERT INTO STA

여기서 DB서버(로컬)에 위치한 데이터 파일을 사용해야 합니다. ODBC를 통해서는 클라이언트에 있는 파일은 IMPORT할수 없습니다.

그리고 create database 명령은 DB2 인스턴스 레벨에서 수행하는 명령이기 때문에 odbc를 통해 수행할 수 없습니다.


http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.cmd.doc%2Fdoc%2Fr0001941.html
http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.cmd.doc%2Fdoc%2Fr0001941.html
http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.cmd.doc%2Fdoc%2Fr0001941.html


728x90
728x90

활발이님 | 마이그레이션 | 2013-11-20 18:33:58


이번에 db2 마이그레이션을 진행하게 되었는데요
hp서버 에서 -> ibm p장비로 마이그레이션을 하게 되었습니다. 
여기서 이행하는 방안이 3가지로 생각되는데요
방안은 아래와 같습니다.

서버: AIX

 

버전: V9.1. Fixpack4

USE SIZE: 약650G

TOTAL: 800G



 

 이행 방법

A.     HP to AIX 이므로 ASIS Storeage 할당 후 Backup  Restore 방법
- 백업 데이터를 위한 공간 고려
- HP장비에서 BACKUP 후 IBM P장비로 RESOTORE가 되는지

B.      HP 쪽에 Storeage 할당 후 table export 이용하여  IMPORT 방법
- EXPORT 데이터를 위한 공간 고려
-

C.     DB Federation을 이용하여 table  select insert 방법
- 작업 시간?
- 650G의 데이터를 SELECT INSERT 하므로 트랜젝션 로그 FULL?
- DATA의 변경에 대한 이유로 APPLICATION 접속 중단?

  
- 추가적으로 LOB,CLOB 대용량 데이터 TYPE은 마이그레이션이 일반 TYPE과 같은지도 궁금합니다.
 (LOB DATA TYPE도 SELECT INSERT로 가능한지,...?
  BACKUP RECOVERY나 EXPORT IMPORT로 가능한지 여부)
- oracle은 export의 경우 database full로 export나 tablespace ,table단위로 되는데
 db2는 테이블 단위로 밖에 export가 안되는건가요?

마이그레이션 경험이 없어서 어떤 사항을 고려해야 하는지 도움 주시면 감사하겠습니다.
각 A,B,C, 로 진행을 할 때 고려해야 할 상황이 무엇인지 알고 싶습니다.




pajama 2013-11-20 19:53:53
A. 문서상에서는 HP, AIX모두 Big Endian이므로 backup, restore가 가능하다고 합니다만 테스트는 필요합니다.
http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb.admin.doc/doc/c0005960.htm

B. source, target 서버의 내려받을 공간, 파일 전송, export/import로 인한 시간 정도가 고려사항일 듯합니다.

C. insert select보다는 cursor load 방식으로 하시면 로그 풀 문제는 없습니다. B에 비해 디스크 공간에 대한 고려사항은 없습니다. LOB이관도 잘 됩니다.

세가지 다 변경분 데이터와 다운타임이 이슈일 텐데요. 다운타임 없이 이관하셔야 한다면 복제솔루션이 필요할 수 있습니다.
db2에서 export 명령은 테이블 단위입니다. oracle과 같이 dmp파일 형태로 export하는 방식은 없고 backup/restore 수행방식이 이와 유사합니다.
백업/리스토어가 잘 된다면 가장 좋겠지만..이슈등이나 작업 환경 상황에 따라서 방법을 선택하셔야 할 것 같습니다.

활발이 2013-11-20 22:49:34
답변 감사드립니다!! cursor load 방식으로 진행을 하게 되면 데이터 조회 후 메모리에서 바로 이관을 하는데 
이경우 bufferpool의 설정은 어떻게 해야되는지 궁금합니다.
또한 다운 타임이 이슈가 되신다고 했는데 세가지 경우 다 db down time이 필요한 건가요?

활발이 2013-11-20 23:21:56
그리고 insert select의 not logged 옵션으로 로그풀 문제를없앨수 있지는 않은지.... 
cursor load와 어떤 차이가 있는지요?

sakura 2013-11-20 23:24:55
cursor load 진행동안 유틸리티힙을 크게 잡아 주시면 되며 
db downtime 없이 진행 할 경우 ASIS와 TOBE 데이터가 불일치가 발생하기때문에 복제 솔루션을 이용할 경우 DB DOWN TIME 없이 이관이 가능하겠습니다.



728x90

+ Recent posts