Следующая ошибка появляется при вставке во внешнюю таблицу. В чем причина? Кажется, это означает, что мы не можем записать в файл, но похоже, что нет проблем с разрешениями и дисковым пространством и т. Д. c.
[IBM] [Драйвер CLI] [DB2 / LINUXX8664] SQL20569N Операция с внешней таблицей завершилась неудачно из-за проблемы с соответствующим файлом данных или файлами диагностики c. Имя файла: "/mnt/blumeta0/home/mem/jpep/TBL_MEM_ACC.tsv
Определение внешней таблицы
CREATE EXTERNAL TABLE EXT_TBL_JPOST_ACC
(
EMPLR_ID INTEGER,
YEAR_MON_OBJ INTEGER,
JMDC_BRDG_ID BIGINT,
INSUR_PLC_NTBK_SIGN CHARACTER VARYING(30),
INSUR_PLC_NTBK_NO CHARACTER VARYING(300),
PERSON_NO CHARACTER VARYING(50),
NAME_KJ CHARACTER VARYING(300),
NAME_KN CHARACTER VARYING(300),
PTNT_BIRTH DATE,
PTNT_GENDER CHARACTER(1),
SELF_FAMY_KBN CHARACTER(1),
RELATIONSHIP_CD CHARACTER VARYING(3),
RELATIONSHIP_NM CHARACTER VARYING(45),
START_DATE DATE,
START_REASON_CD CHARACTER VARYING(3),
LOST_DATE DATE,
LOST_REASON_CD CHARACTER VARYING(3),
EMP_NO CHARACTER VARYING(300),
NK_FLG CHARACTER(1),
EST_CD1 CHARACTER VARYING(100),
EST_CD2 CHARACTER VARYING(100),
EST_CD3 CHARACTER VARYING(100),
EST_CD4 CHARACTER VARYING(100),
EST_NM1 CHARACTER VARYING(300),
EST_NM2 CHARACTER VARYING(300),
EST_NM3 CHARACTER VARYING(300),
EST_NM4 CHARACTER VARYING(300),
DEPT_CD1 CHARACTER VARYING(100),
DEPT_CD2 CHARACTER VARYING(100),
DEPT_CD3 CHARACTER VARYING(100),
DEPT_CD4 CHARACTER VARYING(100),
DEPT_NM1 CHARACTER VARYING(300),
DEPT_NM2 CHARACTER VARYING(300),
DEPT_NM3 CHARACTER VARYING(300),
DEPT_NM4 CHARACTER VARYING(300),
ZIP_CD CHARACTER VARYING(30),
ADDR1 CHARACTER VARYING(600),
ADDR2 CHARACTER VARYING(600),
ZIP_CD_SEND CHARACTER VARYING(30),
ADDR1_SEND CHARACTER VARYING(600),
ADDR2_SEND CHARACTER VARYING(600),
TEL_NO CHARACTER VARYING(50),
TEL_NO_K CHARACTER VARYING(50),
E_MAIL_ADDR CHARACTER VARYING(100),
E_MAIL_ADDR_K CHARACTER VARYING(100),
DIST_CD1 CHARACTER VARYING(300),
FILLER1 CHARACTER VARYING(900),
FILLER2 CHARACTER VARYING(300),
FILLER3 CHARACTER VARYING(300),
FILLER4 CHARACTER VARYING(300),
FILLER5 CHARACTER VARYING(300),
FILLER6 CHARACTER VARYING(300),
FILLER7 CHARACTER VARYING(300),
FILLER8 CHARACTER VARYING(300),
FILLER9 CHARACTER VARYING(300),
FILLER10 CHARACTER VARYING(300),
FILLER11 CHARACTER VARYING(300),
FILLER12 CHARACTER VARYING(300),
FILLER13 CHARACTER VARYING(300),
FILLER14 CHARACTER VARYING(300),
FILLER15 CHARACTER VARYING(300),
FILLER16 CHARACTER VARYING(300),
FILLER17 CHARACTER VARYING(300),
FILLER18 CHARACTER VARYING(300),
FILLER19 CHARACTER VARYING(300),
FILLER20 CHARACTER VARYING(300),
REG_USER CHARACTER VARYING(10),
REG_DATE TIMESTAMP,
UPD_USER CHARACTER VARYING(10),
UPD_DATE TIMESTAMP
)
USING
(
DATAOBJECT( '/mnt/blumeta0/home/mem/jpep/TBL_MEM_ACC.tsv' )
DELIMITER '9'
TIMESTYLE '24HOUR'
LOGDIR '/mnt/blumeta0/home/mem/ext_log/'
Y2BASE 2000
ENCODING 'INTERNAL'
IncludeHeader 'true'
NullValue ''
);
Вставить предложение
INSERT INTO EXT_TBL_JPOST_ACC
(
EMPLR_ID
, YEAR_MON_OBJ
, JMDC_BRDG_ID
, INSUR_PLC_NTBK_SIGN
, INSUR_PLC_NTBK_NO
, PERSON_NO
, NAME_KJ
, NAME_KN
, PTNT_BIRTH
, PTNT_GENDER
, SELF_FAMY_KBN
, RELATIONSHIP_CD
, RELATIONSHIP_NM
, START_DATE
, START_REASON_CD
, LOST_DATE
, LOST_REASON_CD
, EMP_NO
, NK_FLG
, EST_CD1
, EST_CD2
, EST_CD3
, EST_CD4
, EST_NM1
, EST_NM2
, EST_NM3
, EST_NM4
, DEPT_CD1
, DEPT_CD2
, DEPT_CD3
, DEPT_CD4
, DEPT_NM1
, DEPT_NM2
, DEPT_NM3
, DEPT_NM4
, ZIP_CD
, ADDR1
, ADDR2
, ZIP_CD_SEND
, ADDR1_SEND
, ADDR2_SEND
, TEL_NO
, TEL_NO_K
, E_MAIL_ADDR
, E_MAIL_ADDR_K
, DIST_CD1
, FILLER1
, FILLER2
, FILLER3
, FILLER4
, FILLER5
, FILLER6
, FILLER7
, FILLER8
, FILLER9
, FILLER10
, FILLER11
, FILLER12
, FILLER13
, FILLER14
, FILLER15
, FILLER16
, FILLER17
, FILLER18
, FILLER19
, FILLER20
, REG_USER
, REG_DATE
, UPD_USER
, UPD_DATE
)
WITH V_ACC AS (
SELECT
ACC.*
FROM
VIEW_TBL_MEM_ACC_FIX ACC
INNER JOIN (
SELECT
EMPLR_ID
FROM
TBL_MSTR_EMPLR
WHERE
HDP_LINK_FLG = '2'
AND
VALID_FLG = 'Y'
) HDP
ON ACC.EMPLR_ID = HDP.EMPLR_ID
)
, V_MAX_MON AS (
SELECT
EMPLR_ID
, MAX(YEAR_MON_OBJ) AS YEAR_MON_MAX
FROM
V_ACC
GROUP BY
EMPLR_ID
)
SELECT
V_ACC.EMPLR_ID
, V_ACC.YEAR_MON_OBJ
, V_ACC.JMDC_BRDG_ID
, V_ACC.INSUR_PLC_NTBK_SIGN
, V_ACC.INSUR_PLC_NTBK_NO
, V_ACC.PERSON_NO
, V_ACC.NAME_KJ
, V_ACC.NAME_KN
, V_ACC.PTNT_BIRTH
, V_ACC.PTNT_GENDER
, V_ACC.SELF_FAMY_KBN
, V_ACC.RELATIONSHIP_CD
, V_ACC.RELATIONSHIP_NM
, V_ACC.START_DATE
, V_ACC.START_REASON_CD
, V_ACC.LOST_DATE
, V_ACC.LOST_REASON_CD
, V_ACC.EMP_NO
, V_ACC.NK_FLG
, V_ACC.EST_CD1
, V_ACC.EST_CD2
, V_ACC.EST_CD3
, V_ACC.EST_CD4
, V_ACC.EST_NM1
, V_ACC.EST_NM2
, V_ACC.EST_NM3
, V_ACC.EST_NM4
, V_ACC.DEPT_CD1
, V_ACC.DEPT_CD2
, V_ACC.DEPT_CD3
, V_ACC.DEPT_CD4
, V_ACC.DEPT_NM1
, V_ACC.DEPT_NM2
, V_ACC.DEPT_NM3
, V_ACC.DEPT_NM4
, V_ACC.ZIP_CD
, V_ACC.ADDR1
, V_ACC.ADDR2
, V_ACC.ZIP_CD_SEND
, V_ACC.ADDR1_SEND
, V_ACC.ADDR2_SEND
, V_ACC.TEL_NO
, V_ACC.TEL_NO_K
, V_ACC.E_MAIL_ADDR
, V_ACC.E_MAIL_ADDR_K
, V_ACC.DIST_CD1
, V_ACC.FILLER1
, V_ACC.FILLER2
, V_ACC.FILLER3
, V_ACC.FILLER4
, V_ACC.FILLER5
, V_ACC.FILLER6
, V_ACC.FILLER7
, V_ACC.FILLER8
, V_ACC.FILLER9
, V_ACC.FILLER10
, NULL AS FILLER11
, NULL AS FILLER12
, NULL AS FILLER13
, NULL AS FILLER14
, NULL AS FILLER15
, NULL AS FILLER16
, NULL AS FILLER17
, NULL AS FILLER18
, NULL AS FILLER19
, NULL AS FILLER20
, V_ACC.REG_USER
, V_ACC.REG_DATE
, V_ACC.UPD_USER
, V_ACC.UPD_DATE
FROM
V_ACC
INNER JOIN V_MAX_MON
ON V_ACC.EMPLR_ID = V_MAX_MON.EMPLR_ID
AND V_ACC.YEAR_MON_OBJ = V_MAX_MON.YEAR_MON_MAX
Место назначения вывода
[mem@dcsv-db2w-01 - Db2wh Python]$ cd /mnt/blumeta0/home/mem
[mem@dcsv-db2w-01 - Db2wh ~]$ ll
total 12
drwxrwxrwx. 2 mem bluadmin 6 Jan 24 14:37 ext_log
drwxrwxrwx. 2 mem bluadmin 29 Jan 24 15:06 jpep
Настройка места назначения вывода
[mem@dcsv-db2w-01 - Db2wh Python]$ db2 get db cfg | grep -i external
Allowed paths for external tables (EXTBL_LOCATION) = /mnt/bludata0/scratch;/mnt/blumeta0/home;/mnt/external
Количество дисков
[mem@dcsv-db2w-01 - Db2wh ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
overlay 84G 41G 44G 49% /
tmpfs 16G 0 16G 0% /dev
/dev/mapper/centos-root 84G 41G 44G 49% /etc/hosts
shm 512M 320M 193M 63% /dev/shm
tmpfs 16G 1.7G 15G 11% /run
tmpfs 3.2G 0 3.2G 0% /run/user/500
tmpfs 3.2G 0 3.2G 0% /run/user/503
tmpfs 3.2G 0 3.2G 0% /run/user/0
tmpfs 3.2G 0 3.2G 0% /run/user/5003
tmpfs 3.2G 0 3.2G 0% /run/user/5001