Example: Data unload with the generation of a file share upload command for an Azure destination, based on the Azure CLI tool usage
Execution report:
[i1156@lat111 ~]$ db2hpu -i i1156 -f sysin_azure
INZM031I Optim High Performance Unload for Db2 06.05.00.003.01(230710)
64 bits 07/10/2023 (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
000003 UNLOAD TABLESPACE
000004
000005 SELECT * FROM EMPLOYEE;
000006
000007 OUTFILE("outfile")
000008 LOADFILE("loadfile")
000009 LOADDEST("OBJECT_STORAGE AZURE "AZURE_CLI_ALIAS")
000010
000011 FORMAT DEL;
INZU462I HPU control step start: 07/10/2023 08:57:02.659.
INZU463I HPU control step end : 07/10/2023 08:57:02.726.
INZU464I HPU run step start : 07/10/2023 08:57:03.376.
INZU410I HPU utility has unloaded 42 rows on lat111 host for I1156.EMPLOYEE in outfile.
INZU684I HPU utility has generated an upload command for the AZURE destination in the loadfile file.
INZU465I HPU run step end : 07/10/2023 08:57:03.383.
INZI441I HPU successfully ended: Real time -> 0m0.724820s
User time -> 0m0.057559s : Parent -> 0m0.057559s, Children -> 0m0.000000s
Syst time -> 0m0.025802s : Parent -> 0m0.025802s, Children -> 0m0.000000s
[i1156@lat111 ~]$ cat loadfile
#!/bin/sh
Associated Azure section in the db2hpu.dest file:
[Azure]
alias=AZURE_CLI_ALIAS
account=my_azure_account
blob=no
sharename=myfileshare
Extract of the output file generated:
[i1156@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
Upload command generated:
[i1156@lat111 ~]$ cat loadfile
#!/bin/sh
echo "Enter account key:"
read -s accountKey
echo Start uploading ...
az storage file upload --account-name my_azure_account --account-key "$accountKey" --share-name myfileshare --source "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