예: AWS CLI 툴 사용을 기반으로, 데이터 언로드는 데이터 업로드 명령을 생성하여 데이터 저장소( IBM Cloud Object Storage )로 전송됩니다

이 예제의 경우 Optim™ High Performance Unload 는 AWS CLI 도구 사용법에 따라 IBM Cloud Object Storage 대상에 대한 업로드 명령을 생성하여 데이터를 언로드합니다.

실행 보고서:

[i1110@lat111 ~]$ db2hpu -i i1110 -f SYSIN
INZM031I Optim High Performance Unload for Db2 06.05.00.004.02(240430) 
         64 bits 05/03/2024 (Linux lat111 3.10.0-862.14.4.el7.x86_64 #1 SMP Fri Sep 21 09:07:21 UTC 2018 x86_64)
INZI473I Memory limitations: 'unlimited' for virtual memory and 'unlimited' for data segment
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+
000001 GLOBAL CONNECT TO SAMPLE;
000002 UNLOAD TABLESPACE
000003 SELECT * FROM employee;
000004 LOADDEST(OBJECT_STORAGE IBM_COS "ibm_cos_aws")
000005 OUTFILE("outfile")
000006 LOADFILE("loadfile")
000007 FORMAT DEL;
      
INZU462I HPU control step start: 05/03/2024 15:48:57.636.
INZU463I HPU control step end  : 05/03/2024 15:48:57.915.
INZU464I HPU run step start    : 05/03/2024 15:48:57.956.
INZU410I HPU utility has unloaded 42 rows on lat111 host for I1110.EMPLOYEE in outfile.
INZU684I HPU utility has generated an upload command for the IBM COS destination in the loadfile file.
INZU465I HPU run step end      : 05/03/2024 15:48:58.391.
INZI441I HPU successfully ended: Real time -> 0m0.754764s
User time -> 0m0.086151s : Parent -> 0m0.081527s, Children -> 0m0.004624s
Syst time -> 0m0.039175s : Parent -> 0m0.029927s, Children -> 0m0.009248s

db2hpu.dest 파일의 관련 IBM_COS 섹션:

[IBM_COS]
alias=ibm_cos_aws
ibmcloud=no
bucket=MYBUCKET
url=https://s3.eu-de.cloud-object-storage.appdomain.cloud
profile=ibm_cos

생성된 출력 파일에서 발췌한 내용:

[i1110@lat111 ~]$ cat outfile
"000010","CHRISTINE","I","HAAS","A00","3978",19950101,"PRES   ",18,"F",19630824,+0152750.00,+0001000.00,+0004220.0
...
"200340","ROY","R","ALONZO","E21","5698",19970705,"FIELDREP",16,"M",19560517,+0031840.00,+0000500.00,+0001907.00

생성된 업로드 명령:

[i1110@lat111 ~]$ cat loadfile
#!/bin/sh
      
echo Start uploading ...
aws s3 cp --content-type "text/plain; charset=UTF-8" --profile "ibm_cos" --endpoint-url "https://s3.eu-de.cloud-object-storage.appdomain.cloud" "outfile" s3://MYBUCKET > "EMPLOYEE.msg" 2>&1
RC=$?
if [ $RC -ne 0 ]
then
    echo "An error occurred while processing the 'outfile' file. The 'EMPLOYEE.msg' file contains the associated execution report."
else
    echo "The 'outfile' file has been processed successfully. The 'EMPLOYEE.msg' file contains the associated execution report."
fi
exit $RC