{"id":1874,"date":"2020-10-30T14:06:05","date_gmt":"2020-10-30T06:06:05","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=1874"},"modified":"2021-07-07T08:50:50","modified_gmt":"2021-07-07T00:50:50","slug":"gbase-8a%e5%af%bc%e5%87%ba%e6%95%b0%e6%8d%ae%e6%97%b6%ef%bc%8c%e5%ad%97%e6%ae%b5%e5%86%85%e5%ae%b9%e5%8c%85%e5%90%ab%e6%8d%a2%e8%a1%8cn%e6%80%8e%e4%b9%88%e5%a4%84%e7%90%86","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/1874","title":{"rendered":"\u5357\u5927\u901a\u7528GBase 8a\u5bfc\u51fa\u52a0\u8f7d\u6570\u636e\u65f6\uff0c\u5b57\u6bb5\u5185\u5bb9\u5305\u542b\u6362\u884c\\n\u600e\u4e48\u5904\u7406"},"content":{"rendered":"<p>GBase 8a\u6570\u636e\u5e93\u96c6\u7fa4\uff0c\u652f\u6301\u5bfc\u51fa\u65f6\u6307\u5b9a\u884c\u5206\u9694\u7b26\u548c\u5217\u5206\u9694\u7b26\uff0c\u5982\u679c\u6570\u636e\u4e2d\u7684\u5b57\u7b26\u548c\u5176\u51b2\u7a81\uff0c\u53ef\u4ee5\u8003\u8651\u7528\u591a\u4e2a\u5b57\u7b26\u505a\u5206\u9694\u7b26\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u7528\u4e0d\u5e38\u89c1\u6216\u51b2\u7a81\u51e0\u7387\u4f4e\u7684\u4e0d\u53ef\u89c1\u5b57\u7b26\u505a\u5206\u9694\u7b26\u3002<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Directory Navigation<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2ad3f358382\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2ad3f358382\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.gbase8.cn\/en\/1874\/#%E5%A6%82%E6%9E%9C%E5%8E%9F%E5%A7%8B%E6%95%B0%E6%8D%AE%E6%9C%89%E5%8C%85%E5%9B%B4%E7%AC%A6\" >\u5982\u679c\u539f\u59cb\u6570\u636e\u6709\u5305\u56f4\u7b26<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.gbase8.cn\/en\/1874\/#%E6%95%B0%E6%8D%AE\" >\u6570\u636e<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/1874\/#%E5%8A%A0%E8%BD%BD%E6%95%88%E6%9E%9C\" >\u52a0\u8f7d\u6548\u679c<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.gbase8.cn\/en\/1874\/#%E8%A1%8C%E5%88%86%E9%9A%94%E7%AC%A6\" >\u884c\u5206\u9694\u7b26<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.gbase8.cn\/en\/1874\/#%E5%8A%A0%E8%BD%BD%E6%A0%B7%E4%BE%8B\" >\u52a0\u8f7d\u6837\u4f8b<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.gbase8.cn\/en\/1874\/#%E8%A1%A8%E7%BB%93%E6%9E%84\" >\u8868\u7ed3\u6784<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.gbase8.cn\/en\/1874\/#%E6%95%B0%E6%8D%AE-2\" >\u6570\u636e<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.gbase8.cn\/en\/1874\/#%E5%8A%A0%E8%BD%BD\" >Loading<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.gbase8.cn\/en\/1874\/#%E6%9F%A5%E8%AF%A2\" >\u67e5\u8be2<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.gbase8.cn\/en\/1874\/#%E5%8F%A6%E4%B8%80%E4%B8%AA%E4%BE%8B%E5%AD%90\" >\u53e6\u4e00\u4e2a\u4f8b\u5b50<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.gbase8.cn\/en\/1874\/#%E5%AF%BC%E5%87%BA%E6%A0%B7%E4%BE%8B\" >\u5bfc\u51fa\u6837\u4f8b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.gbase8.cn\/en\/1874\/#%E6%80%BB%E7%BB%93\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%A6%82%E6%9E%9C%E5%8E%9F%E5%A7%8B%E6%95%B0%E6%8D%AE%E6%9C%89%E5%8C%85%E5%9B%B4%E7%AC%A6\"><\/span>\u5982\u679c\u539f\u59cb\u6570\u636e\u6709\u5305\u56f4\u7b26<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p> \u53ef\u4ee5\u901a\u8fc7having LINES SEPARATOR\u53c2\u6570\u6765\u52a0\u8f7d\u3002\u5b8c\u6574\u8bed\u6cd5\u53ef\u4ee5\u53c2\u8003 <a href=\"https:\/\/www.gbase8.cn\/en\/121\/\">GBase 8a \u96c6\u7fa4\u52a0\u8f7d\u6570\u636eLOAD\u7684\u65b9\u6cd5<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%95%B0%E6%8D%AE\"><\/span>\u6570\u636e<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@gbase_rh7_001 gbase]# cat t2_2.txt\n99,'ABCD\nEFG','2021-07-07'\n100,'1234\n5678','2021-07-07'\n&#91;root@gbase_rh7_001 gbase]#<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8A%A0%E8%BD%BD%E6%95%88%E6%9E%9C\"><\/span>\u52a0\u8f7d\u6548\u679c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u6ce8\u610f\u6307\u5b9adate_format \u4ee5\u53ca\u540e\u9762\u7684enclosed by\u53c2\u6570\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; load data infile 'sftp:\/\/gbase:gbase1234@10.0.2.101\/home\/gbase\/t2_2.txt' into table t2 data_format 3 having LINES SEPARATOR fields terminated by ',' enclosed by ''''  autofill;\nQuery OK, 2 rows affected (Elapsed: 00:00:01.41)\nTask 9253 finished, Loaded 2 records, Skipped 0 records\n\ngbase&gt; select * from t2;\n+------+-----------+------------+---------+----------+\n| id   | name      | birthday   | commons | loadtime |\n+------+-----------+------------+---------+----------+\n|  100 | 1234\n5678 | 2021-07-07 | NULL    | NULL     |\n|   99 | ABCD\nEFG  | 2021-07-07 | NULL    | NULL     |\n+------+-----------+------------+---------+----------+\n2 rows in set (Elapsed: 00:00:00.02)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%A1%8C%E5%88%86%E9%9A%94%E7%AC%A6\"><\/span>\u884c\u5206\u9694\u7b26<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u9ed8\u8ba4\u7684\u884c\u5206\u9694\u7b26\u662f\u6362\u884c'\\n'<\/p>\n\n\n\n<p>lines terminated by '\\n'<\/p>\n\n\n\n<p>\u5176\u652f\u6301\u6307\u5b9a\u591a\u4e2a\uff0c\u6bd4\u5982\u7528 '\\n\\n' \uff0c\u2018ABC\\n' \u591a\u4e2a\u5b57\u7b26\u4ee3\u8868\u884c\u5206\u9694\u7b26\uff0c\u6216\u80051\u5230\u591a\u4e2a\u4e0d\u53ef\u89c1\u5b57\u7b26 \\xFF\u3002<\/p>\n\n\n\n<p>\u5173\u4e8e\u4e0d\u53ef\u89c1\u5b57\u7b26\u7684\u4f7f\u7528\uff0c\u8bf7\u53c2\u8003 <a href=\"https:\/\/www.gbase8.cn\/en\/1800\/\">GBase 8a\u5bfc\u51fa\u548c\u52a0\u8f7d\u4f7f\u7528\u591a\u4e2a\u4e0d\u53ef\u89c1\u5b57\u7b26\u505a\u5206\u9694\u7b26<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8A%A0%E8%BD%BD%E6%A0%B7%E4%BE%8B\"><\/span>\u52a0\u8f7d\u6837\u4f8b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%A1%A8%E7%BB%93%E6%9E%84\"><\/span>\u8868\u7ed3\u6784<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u56db\u4e2a\u5217\u7684varchar(10\uff09\u7684\u5b57\u6bb5\uff0c\u7528\u6765\u6d4b\u8bd5\u6570\u636e\u4e2d\u5e26\u6362\u884c\u7b26\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; create table t2(v1 varchar(10),v2 varchar(10),v3 varchar(10),v4 varchar(10));\nQuery OK, 0 rows affected (Elapsed: 00:00:01.48)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%95%B0%E6%8D%AE-2\"><\/span>\u6570\u636e<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u5305\u542b\u4e24\u884c\uff0c\u7528\u9017\u53f7\u505a\u5b57\u6bb5\u5206\u9694\u7b26\uff0c\u6570\u636e\u4e2d\u5305\u542b\u6362\u884c\u7b26\uff0c\u6700\u591a\u53ea\u6709\u4e00\u4e2a\u3002\u7528\u4e24\u4e2a\u6362\u884c\u4f5c\u4e3a\u884c\u5206\u9694\u7b26<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;gbase@rh6-1 ~]$ cat t2.txt\nAA,B\nB,CC,DD\n\nAAA,BBB\nB,CC\nCC,DD\nDD<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8A%A0%E8%BD%BD\"><\/span>Loading<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u6b63\u5e38\u52a0\u8f7d\u5165\u5e93\uff0c\u6307\u5b9a2\u4e2a\u6362\u884c\u4f5c\u4e3a\u884c\u5206\u9694\u7b26\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; load data infile 'sftp:\/\/gbase:gbase1234@10.0.2.201\/home\/gbase\/t2.txt' into table t2 fields terminated by ',' lines terminated by '\\n\\n';\nQuery OK, 2 rows affected (Elapsed: 00:00:06.80)\nTask 336744 finished, Loaded 2 records, Skipped 0 records<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E8%AF%A2\"><\/span>\u67e5\u8be2<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u67e5\u8be2\u7ed3\u679c\u548c\u9884\u671f\u76f8\u7b26\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; select * from t2 \\G\n*************************** 1. row ***************************\nv1: AAA\nv2: BBB\nB\nv3: CC\nCC\nv4: DD\nDD\n*************************** 2. row ***************************\nv1: AA\nv2: B\nB\nv3: CC\nv4: DD\n2 rows in set (Elapsed: 00:00:00.40)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8F%A6%E4%B8%80%E4%B8%AA%E4%BE%8B%E5%AD%90\"><\/span>\u53e6\u4e00\u4e2a\u4f8b\u5b50<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u7528ZTE\\n\u505a\u884c\u5206\u9694\u7b26<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;gbase@rh6-1 ~]$ cat t2.txt\nAA,B\nB,CC,DDZTE\nAAA,BBB\nB,CC\nCC,DD\nDDZTE\n&#91;gbase@rh6-1 ~]$ gccli testdb\n\nGBase client 8.6.2.43-R28.122445. Copyright (c) 2004-2020, GBase.  All Rights Reserved.\n\ngbase&gt; truncate table t2;\nQuery OK, 2 rows affected (Elapsed: 00:00:01.40)\n\ngbase&gt; load data infile 'sftp:\/\/gbase:gbase1234@10.0.2.201\/home\/gbase\/t2.txt' into table t2 fields terminated by ',' lines terminated by 'ZTE\\n';\nQuery OK, 2 rows affected (Elapsed: 00:00:16.80)\nTask 338893 finished, Loaded 2 records, Skipped 0 records\n\ngbase&gt; select * from t2 \\G\n*************************** 1. row ***************************\nv1: AA\nv2: B\nB\nv3: CC\nv4: DD\n*************************** 2. row ***************************\nv1: AAA\nv2: BBB\nB\nv3: CC\nCC\nv4: DD\nDD\n2 rows in set (Elapsed: 00:00:00.10)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%AF%BC%E5%87%BA%E6%A0%B7%E4%BE%8B\"><\/span>\u5bfc\u51fa\u6837\u4f8b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u53c2\u6570\u662f\u4e00\u81f4\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; select * from t2 into outfile '\/home\/gbase\/t2_out.txt' fields terminated by ','  ESCAPED BY '' lines terminated by 'ZTE\\n';\nQuery OK, 2 rows affected (Elapsed: 00:00:00.14)\n\ngbase&gt; system cat \/home\/gbase\/t2_out.txt\nAA,B\nB,CC,DDZTE\nAAA,BBB\nB,CC\nCC,DD\nDDZTE\ngbase&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%80%BB%E7%BB%93\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u8fd9\u91cc\u53ea\u662f\u6f14\u793a\u884c\u5206\u9694\u7b26\u53ef\u4ee5\u7528\u591a\u4e2a\u5b57\u7b26\uff0c\u4e0d\u5355\u5355\u975e\u5f97\u7528\\n\\n, \u53ef\u4ee5\u7528\u4efb\u610f\u7684\u7ec4\u5408\uff0c\u6bd4\u5982 \u2019ZTE\\n' \u7528\u4e09\u4e2a\u5b57\u6bcd\u52a0\u6362\u884c\u7b26\u505a\u884c\u5206\u9694\u7b26\uff0c\u6216\u8005\u6309\u5168\u9762\u53c2\u8003\u7684\u6587\u7ae0\uff0c\u4e0d\u53ef\u89c1\u5b57\u7b26\u505a\u5206\u9694\u7b26\u3002<\/p>\n\n\n\n<p>\u5bfc\u51fa\u548c\u5bfc\u5165\u7684\u53c2\u6570\u662f\u5bf9\u5e94\u7684\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>\u5357\u5927\u901a\u7528GBase 8a\u6570\u636e\u5e93\u96c6\u7fa4\uff0c\u652f\u6301\u5bfc\u51fa\u65f6\u6307\u5b9a\u884c\u5206\u9694\u7b26\u548c\u5217\u5206\u9694\u7b26\uff0c\u5982\u679c\u6570\u636e\u4e2d\u7684\u5b57\u7b26\u548c\u5176\u51b2\u7a81\uff0c\u53ef\u4ee5\u8003\u8651\u7528\u591a\u4e2a\u5b57\u7b26\u505a\u5206\u9694\u7b26\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u7528\u4e0d\u5e38\u89c1\u6216\u51b2\u7a81\u51e0\u7387\u4f4e\u7684\u4e0d\u53ef\u89c1\u5b57\u7b26\u505a\u5206\u9694\u7b26\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[10,22],"class_list":["post-1874","post","type-post","status-publish","format-standard","hentry","category-gbase8a","tag-10","tag-22"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/1874","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/comments?post=1874"}],"version-history":[{"count":15,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/1874\/revisions"}],"predecessor-version":[{"id":7215,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/1874\/revisions\/7215"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=1874"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=1874"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=1874"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}