Ejemplo: descarga de datos con la generación de un mandato de carga para un destino Swift
Para este ejemplo, Optim™ High Performance Unload descargará los datos con la generación de un comando de carga para un destino Swift, con los datos de la cuenta tanto en el archivo db2hpu.dest como en las variables de entorno.
Informe de ejecución:
[i1058@lat111 ~]$ db2hpu -i i1058 -f /home/i1058/sysin
INZM031I Optim High Performance Unload for Db2 06.01.00.001(171127)
64 bits 11/28/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 UNLOAD TABLESPACE
000003 LOCK NO QUIESCE NO
000004
000005 SELECT * FROM EMPLOYEE;
000006 OUTFILE("outfile")
000007 LOADFILE("loadfile")
000008 LOADDEST(OBJECT_STORAGE SWIFT "SWIFT_BLUEMIX" WITH STANDARD AUTH)
000009
000010 FORMAT DEL;
INZU462I HPU control step start: 11/28/2017 16:30:41.405.
INZU463I HPU control step end : 11/28/2017 16:30:41.624.
INZU464I HPU run step start : 11/28/2017 16:30:41.661.
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 SWIFT destination in the loadfile file.
INZU465I HPU run step end : 11/28/2017 16:30:41.681.
INZI441I HPU successfully ended: Real time -> 0m0.275633s
User time -> 0m0.245594s : Parent -> 0m0.245594s, Children -> 0m0.000000s
Syst time -> 0m0.033215s : Parent -> 0m0.033215s, Children -> 0m0.000000s
Associated Swift section in the db2hpu.dest file:
[Swift]
alias=SWIFT_BLUEMIX
container=container1
project=object_storage_59e3074d_d0f1_439b_88e8_b4db9dd0e875
project_domain=1507409
region=london
user_id=yesSwift environment variables:
[i1058@lat111 ~]$ env |grep OS_
OS_USER_ID=a4c7b27e8aff4156ada9ac57531b98b1
OS_AUTH_URL=https://lon-identity.open.softlayer.com/v3Extracto 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.00Mandato de carga generado:
[i1058@lat111 ~]$ cat loadfile
#!/bin/sh
echo "Enter password for user-id 'a4c7b27e8aff4156ada9ac57531b98b1':"
read -s password
echo Start uploading ...
swift --auth-version 3 --os-auth-url https://lon-identity.open.softlayer.com/v3 --os-user-id "a4c7b27e8aff4156ada9ac57531b98b1"
--os-password "$password" --os-project-name "object_storage_59e3074d_d0f1_439b_88e8_b4db9dd0e875" --os-project-domain-name "1507409"
--os-region-name "london" upload "container1" --object-name "outfile" "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