Ejemplo: descarga de datos con la generación de un mandato de carga para un destino de Amazon EC2
Informe de ejecución:
[i1110@pc-l-0037 ~]$ db2hpu -i i1110 -f sysin_aws_ec2
INZM031I Optim High Performance Unload for Db2 06.05.00.002.05(220509)
64 bits 05/09/2022 (Linux pc-l-0037 5.3.18-59.10-preempt #1 SMP PREEMPT Fri Jun 25 12:36:56 UTC 2021 (6856d31) 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 AWS_EC2 "aws_ec2_alias")
000005 OUTFILE("outfile")
000006 LOADFILE("loadfile")
000007 FORMAT DEL;
INZU462I HPU control step start: 05/18/2022 14:24:40.721.
INZU463I HPU control step end : 05/18/2022 14:24:40.795.
INZU464I HPU run step start : 05/18/2022 14:24:41.174.
INZU410I HPU utility has unloaded 42 rows on pc-l-0037 host for I1110.EMPLOYEE in outfile.
INZU684I HPU utility has generated an upload command for the AMAZON EC2 destination in the loadfile file.
INZU465I HPU run step end : 05/18/2022 14:24:41.177.
INZI441I HPU successfully ended: Real time -> 0m0.455819s
User time -> 0m0.058852s : Parent -> 0m0.058852s, Children -> 0m0.000000s
Syst time -> 0m0.016814s : Parent -> 0m0.016814s, Children -> 0m0.000000s
Sección asociada de Amazon EC2 en el archivo db2hpu.dest :
[AWS_EC2]
alias=aws_ec2_alias
privatekey=/home/i1110/ec2_private_key.pem
user=ec2-user
url=ec2-public-url
path=/home/ec2-user/HPU_UNLOADS/Extracto del archivo de salida generado:
[i1110@pc-l-0037 ~]$ 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.00Mandato de carga generado:
[i1110@pc-l-0037 ~]$ cat loadfile
#!/bin/sh
echo Start uploading ...
scp -i "/home/i1110/ec2_hpu_key.pem" "outfile" ec2-user@ec2-public-url:/home/ec2-user/HPU_UNLOADS/ > "EMPLOYEE_LIKE.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