Ejemplo: descarga de datos con la generación de un mandato de carga para un destino Amazon S3 basado en el uso de la herramienta AWS CLI
Para este ejemplo Optim™ High Performance Unload descargará datos con la generación de un comando de carga para un destino Amazon S3, basado en el uso de la herramienta CLI AWS y el cifrado del lado del servidor 'aws:kms
Informe de ejecución:
[i1058@lat111 ~]$ db2hpu -i i1058 -f sysin
INZM031I Optim High Performance Unload for Db2 06.01.00.001(170817)
64 bits 08/18/2017 (Linux lat111 3.10.0-327.36.1.el7.x86_64 #1 SMP Wed Aug 17 03:02:37 EDT 2016 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
000003 UNLOAD TABLESPACE
000004 LOCK NO QUIESCE NO
000005
000006 SELECT * FROM I1058.EMPLOYEE;
000007 OUTFILE("outfile")
000008 LOADFILE("loadfile")
000009 LOADDEST(OBJECT_STORAGE AWS_S3 "s3_cli_alias")
000010
000011 FORMAT DEL;
INZU462I HPU control step start: 08/18/2017 15:46:21.054.
INZU463I HPU control step end : 08/18/2017 15:46:21.287.
INZU464I HPU run step start : 08/18/2017 15:46:21.359.
INZU410I HPU utility has unloaded 42 rows on lat111 host for I1058.EMPLOYEE in outfile.
INZU684I HPU utility has generated an upload command for the AMAZON S3 destination in the loadfile file.
INZU465I HPU run step end : 08/18/2017 15:46:21.392.
INZI441I HPU successfully ended: Real time -> 0m0.337930s
User time -> 0m0.246752s : Parent -> 0m0.246752s, Children -> 0m0.000000s
Syst time -> 0m0.045137s : Parent -> 0m0.045137s, Children -> 0m0.000000s
Associated Amazon S3 section in the db2hpu.dest file:
[AWS_S3]
alias=s3_cli_alias
bucket=dev-hpum-test
relativepath=folder1
encrypt=aws:kmsExtracto del archivo de salida generado:
[i1058@lat111 ~]$ cat outfile
"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
Mandato de carga generado:
[i1058@lat111~]$ cat loadfile
#!/bin/sh
echo Start uploading ...
aws s3 cp --content-type "text/plain;charset=UTF-8" --sse "aws:kms" "outfile" s3://dev-hpum-test/folder1/ > "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