Ejemplo: Descarga de datos con la generación de un comando de carga para un destino de IBM Cloud Object Storage, basado en el uso de la herramienta CLI de IBM Cloud

Para este ejemplo, Optim™ High Performance Unload descargará datos con la generación de un comando de carga para un destino IBM Cloud Object Storage, basado en el uso de la herramienta CLI IBM Cloud.

Informe de ejecución:

[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_ibmcloud")
000005 OUTFILE("outfile")
000006 LOADFILE("loadfile")
000007 FORMAT DEL;
      
INZU462I HPU control step start: 05/03/2024 15:09:13.604.
INZU463I HPU control step end  : 05/03/2024 15:09:13.895.
INZU464I HPU run step start    : 05/03/2024 15:09:13.933.
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:09:14.373.
INZI441I HPU successfully ended: Real time -> 0m0.769607s
User time -> 0m0.124777s : Parent -> 0m0.118261s, Children -> 0m0.006516s
Syst time -> 0m0.044372s : Parent -> 0m0.036770s, Children -> 0m0.007602s

Sección IBM_COS asociada en el archivo db2hpu.dest :

[IBM_COS]
alias=ibm_cos_ibmcloud
bucket=MYBUCKET

Extracto del archivo de salida generado:

[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

Mandato de carga generado:

[i1110@lat111 ~]$ cat loadfile
#!/bin/sh
      
echo Start uploading ...
ibmcloud cos upload --bucket "MYBUCKET" --key "outfile" --file "outfile" > "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