示例 7: LOB 子句 (带有%{listValFile} 和%{listValDir} 关键字)

以下示例说明了%{listValFile} 和%{listValDir} 模板关键字的用法,在 LOBFILE 和 LOB IN 子句中指定了一系列数字。 指定了 LOBFILE 和 LOB IN 子句,以便可以生成具有以下名称的 LOB 文件:

  • photos_1/lobfile_1.e1.000 转至 photos_1/lobfile_1.e9.000
  • photos_1/lobfile_2.e1.000 转至 photos_1/lobfile_2.e9.000
  • photos_1/lobfile_3.e1.000 转至 photos_1/lobfile_3.e9.000
  • photos_1/lobfile_5.e1.000 转至 photos_1/lobfile_5.e9.000
  • photos_2/lobfile_1.e1.000 转至 photos_2/lobfile_1.e9.000
  • photos_2/lobfile_2.e1.000 转至 photos_2/lobfile_2.e9.000
  • photos_2/lobfile_3.e1.000 转至 photos_2/lobfile_3.e9.000
  • photos_2/lobfile_5.e1.000 转至 photos_2/lobfile_5.e9.000

此示例中使用的 EMP_PHOTO_IMP 表具有 64 行。

执行报告:
[i1010@lat179(:) ~]$ db2hpu -i i1010 -f sysin_template
INZM031I Optim High Performance Unload for Db2 06.01.00.001(130805)
         64 bits 08/05/2013 (Linux lat179 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 
000002 SAMPLE
000003 ;
000004
000005 UNLOAD TABLESPACE 
000006 DB2 NO
000007 
000008 SELECT * FROM EMP_PHOTO;
000009 
000010 LOB IN ("home/i1010/photos_%{listValDir,(1:2}")
000010 LOBFILE ("lobfile_%{listValFile,(1:3),5}%{seq||1|.e}")
000011 
000012 OUTFILE ("outfile")
000013
000014 FORMAT DEL;

INZU462I HPU control step start: 09:27:54.821.
INZU463I HPU control step end  : 09:27:54.711.
INZU464I HPU run step start    : 09:27:54.712.                                 
INZU410I HPU utility has unloaded 64 rows on lat179 host for I1010.EMP_PHOTO in outfile.
INZU465I HPU run step end      : 09:27:55.487.
INZI441I HPU successfully ended: Real time -> 0m0.789682s
User time -> 0m0.020995s : Parent -> 0m0.019996s, Children -> 0m0.000999s
Syst time -> 0m0.026995s : Parent -> 0m0.022996s, Children -> 0m0.003999s

生成的输出文件:


[i1010@lat179(:) ~]$ cat outfile
"000130","bitmap","/home/i1010/photos_2/lobfile_1.e1.000"
"000130","gif","/home/i1010/photos_1/lobfile_1.e1.000"
...
"000130","bitmap","/home/i1010/photos_2/lobfile_1.e9.000"
"000130","gif","/home/i1010/photos_1/lobfile_1.e9.000"
"000140","bitmap","/home/i1010/photos_2/lobfile_2.e1.000"
"000140","gif","/home/i1010/photos_1/lobfile_2.e1.000"
...
"000140","bitmap","/home/i1010/photos_2/lobfile_2.e9.000"
"000140","gif","/home/i1010/photos_1/lobfile_2.e9.000"
"000150","bitmap","/home/i1010/photos_2/lobfile_3.e1.000"
"000150","gif","/home/i1010/photos_1/lobfile_3.e1.000"
...
"000150","bitmap","/home/i1010/photos_2/lobfile_3.e9.000"
"000150","gif","/home/i1010/photos_1/lobfile_3.e9.000"
"000190","bitmap","/home/i1010/photos_2/lobfile_5.e1.000"
"000190","gif","/home/i1010/photos_1/lobfile_5.e1.000"
...
"000190","bitmap","/home/i1010/photos_2/lobfile_5.e5.000"
"000190","gif","/home/i1010/photos_1/lobfile_5.e5.000"

生成的 LOB 文件:


[i1010@lat179(:) ~]$ ls -al photos_*
photos_1:
total 1780
-rw-r--r-- 1 i1010 db2grp 29540 Oct  3  09:37 lobfile_1.e1.000
...
-rw-r--r-- 1 i1010 db2grp 29540 Oct  3  09:37 lobfile_1.e9.000
-rw-r--r-- 1 i1010 db2grp 71798 Oct  3  09:37 lobfile_2.e1.000
...
-rw-r--r-- 1 i1010 db2grp 71798 Oct  3  09:37 lobfile_2.e9.000
-rw-r--r-- 1 i1010 db2grp 73438 Oct  3  09:37 lobfile_3.e1.000
...
-rw-r--r-- 1 i1010 db2grp 73438 Oct  3  09:37 lobfile_3.e9.000
-rw-r--r-- 1 i1010 db2grp 63542 Oct  3  09:37 lobfile_5.e1.000
...
-rw-r--r-- 1 i1010 db2grp 63542 Oct  3  09:37 lobfile_5.e5.000



photos_2:
total 1356
-rw-r--r-- 1 i1010 db2grp 43690 Oct  3  09:37 lobfile_1.e1.000
...
-rw-r--r-- 1 i1010 db2grp 43690 Oct  3  09:37 lobfile_1.e9.000
-rw-r--r-- 1 i1010 db2grp 29143 Oct  3  09:37 lobfile_2.e1.000
...
-rw-r--r-- 1 i1010 db2grp 29143 Oct  3  09:37 lobfile_2.e9.000
-rw-r--r-- 1 i1010 db2grp 39795 Oct  3  09:37 lobfile_3.e1.000
...
-rw-r--r-- 1 i1010 db2grp 39795 Oct  3  09:37 lobfile_3.e9.000
-rw-r--r-- 1 i1010 db2grp 36088 Oct  3  09:37 lobfile_5.e1.000
...
-rw-r--r-- 1 i1010 db2grp 36088 Oct  3  09:37 lobfile_5.e5.000