DB2 데이터 익스포트 하는 법

2010. 10. 5. 18:57컴퓨터 프로그램/DB2

DB2 계정으로 로그인 하여 export.sh 파일을 생성 한뒤 다음과 같이 내용을 삽입 한다.
-------------------------------------------------------------------------------------------------------------------------
db2 connect to gjwater
db2 -x "select 'export to '||rtrim(char(tabname,40))||'.ixf of ixf lobs to /home/db2inst1/IBM/EXPORT/LOB modified by lobsinfile select * from db2inst1.'||rtrim(char(tabname,40))|| ' with ur;' from syscat.tables where tabschema = 'db2inst1' and type = 'T'" > export.ddl
-------------------------------------------------------------------------------------------------------------------------
여기에서 db2inst1 은 데이터베이스 스키마명이므로 export 받을 스키마명으로 변경한후에 실행하면

export.ddl 이라는 파일이 생성 된다.

이 파일을 db2 -tvf export.ddl로 실행하면 파일들이 정상적으로 익스포트 된다.