GBase 8a导出报错File XXX already exists和强制覆盖写解决方案writemode by overwrites

GBase 8a数据库集群提供select into outfile方式导出数据到文件,如果导出的文件已经存在,则会报File XXX already exists的错误。如果想强制覆盖写入,可以增加writemode by overwrites解决。

样例

重复导出2次,报错 File ‘/home/gbase/t1.txt’ already exists

gbase> select * from t1 into outfile '/home/gbase/t1.txt' fields terminated by ',';
Query OK, 1 row affected (Elapsed: 00:00:00.04)

gbase> system cat /home/gbase/t1.txt;
1,234
gbase> select * from t1 into outfile '/home/gbase/t1.txt' fields terminated by ',';
ERROR 1708 (HY000): [10.0.2.107:5050](GBA-02AD-0005)Failed to query in gnode:
DETAIL: File '/home/gbase/t1.txt' already exists
SQL: SELECT /*::ffff:10.0.2.107_208_15_2020-09-04_10:56:42*/ /*+ TID('2556310') */ `_tmp_1795293194_208_t37_1_1599174116_s`.`c1` AS `id`, `_tmp_1795293194_208_t37_1_1599174116_s`.`c2` AS `value` INTO OUTFILE '/home/gbase/t1.txt'  CHARSET utf8 outfilemode by local  writemode by normal  FIELDS  TERMINATED BY ','  ENCLOSED BY ''  LINES  STARTING BY ''  TERMINATED BY '\n'  FROM `gctmpdb`._tmp_1795293194_2
gbase>

增加参数 writemode by overwrites 解决

gbase> select * from t1 into outfile '/home/gbase/t1.txt' fields terminated by ',' writemode by overwrites;
Query OK, 1 row affected (Elapsed: 00:00:00.05)

加载的其它常见错误,请参考右侧【导出】的TAG。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注