<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: EXPORT HIVE Database in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98285#M11769</link>
    <description>&lt;P&gt;A learning I had was that when you export a table, use complete HDFS URI... In some cases, I found that it helped executing the command which otherwise was failed&lt;/P&gt;</description>
    <pubDate>Thu, 21 Sep 2017 18:27:14 GMT</pubDate>
    <dc:creator>stellium</dc:creator>
    <dc:date>2017-09-21T18:27:14Z</dc:date>
    <item>
      <title>EXPORT HIVE Database</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98277#M11761</link>
      <description>&lt;P&gt;I see the following option to export one table at a time but do we have a way to do this for all the tables on a particular hive db?&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;EXPORT TABLE tablename [PARTITION (part_column=&lt;/CODE&gt;&lt;CODE&gt;"value"&lt;/CODE&gt;&lt;CODE&gt;[, ...])]&lt;/CODE&gt;
&lt;CODE&gt;TO &lt;/CODE&gt;&lt;CODE&gt;'export_target_path'&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 00:07:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98277#M11761</guid>
      <dc:creator>rbalam</dc:creator>
      <dc:date>2015-12-10T00:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: EXPORT HIVE Database</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98278#M11762</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/392/rbalam.html" nodeid="392"&gt;@rbalam&lt;/A&gt;&lt;P&gt;I don't think there is an option to export database. &lt;/P&gt;&lt;P&gt;&lt;A href="https://cwiki.apache.org/confluence/display/Hive/LanguageManual+ImportExport#LanguageManualImportExport-ExportSyntax" target="_blank"&gt;https://cwiki.apache.org/confluence/display/Hive/LanguageManual+ImportExport#LanguageManualImportExport-ExportSyntax&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 00:13:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98278#M11762</guid>
      <dc:creator>nsabharwal</dc:creator>
      <dc:date>2015-12-10T00:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: EXPORT HIVE Database</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98279#M11763</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/140/nsabharwal.html" nodeid="140"&gt;@Neeraj Sabharwal&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks for your quick response on this but do we have other options if we need to export the whole hive db to another cluster?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 00:27:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98279#M11763</guid>
      <dc:creator>rbalam</dc:creator>
      <dc:date>2015-12-10T00:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: EXPORT HIVE Database</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98280#M11764</link>
      <description>&lt;P&gt;I am unaware of an option to export a whole database but you could implement something quickly via a bash script. The rough pseudo-code would be: &lt;/P&gt;&lt;PRE&gt;#!/bin/bash
tables = hive -e "use database_name;show tables;"
for table in tables
do
    hive -e "EXPORT $table ..."
done
&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Dec 2015 00:30:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98280#M11764</guid>
      <dc:creator>bwilson</dc:creator>
      <dc:date>2015-12-10T00:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: EXPORT HIVE Database</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98281#M11765</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/392/rbalam.html" nodeid="392"&gt;@rbalam&lt;/A&gt; please see this &lt;A href="https://community.hortonworks.com/questions/4496/how-to-migrate-hive-data-over-to-new-cluster.html" target="_blank"&gt;https://community.hortonworks.com/questions/4496/how-to-migrate-hive-data-over-to-new-cluster.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This can be a productive workaround. You can get list of tables and then using vi or any editor create a script to export all tables as seperate command. &lt;/P&gt;&lt;OL&gt;
&lt;LI&gt;mysql -u hive -p -e " select concat(  'show create table ' , TBL_NAME,';') from TBLS" hive &amp;gt; file.sql  &lt;/LI&gt;&lt;LI&gt;remove header in file.sql&lt;/LI&gt;&lt;LI&gt;hive -f /tmp/file.sql&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Thu, 10 Dec 2015 00:31:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98281#M11765</guid>
      <dc:creator>nsabharwal</dc:creator>
      <dc:date>2015-12-10T00:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: EXPORT HIVE Database</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98282#M11766</link>
      <description>&lt;P&gt;Falcon can be used to mirror/replicate Hive tables to another cluster: &lt;/P&gt;&lt;P&gt;&lt;A href="http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.2/bk_data_governance/content/section_mirroring_data_falcon.html" target="_blank"&gt;http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.2/bk_data_governance/content/section_mirroring_data_falcon.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 00:32:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98282#M11766</guid>
      <dc:creator>bwilson</dc:creator>
      <dc:date>2015-12-10T00:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: EXPORT HIVE Database</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98283#M11767</link>
      <description>&lt;P&gt;If you are just looking for the data, another option could be to use &lt;A href="https://docs.hortonworks.com/HDPDocuments/Ambari-2.1.2.0/bk_ambari_views_guide/content/section_using_hive_view.html"&gt;the Hive view&lt;/A&gt; from Ambari dashboard: it has an export option.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 01:07:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98283#M11767</guid>
      <dc:creator>abajwa</dc:creator>
      <dc:date>2015-12-10T01:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: EXPORT HIVE Database</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98284#M11768</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;Thank you Brandon for posting your idea.&lt;/P&gt;&lt;P&gt;I have used the framework and built an KSH script to export successfully my Hive databases.&lt;/P&gt;&lt;P&gt;I share herewith the content of what I have conceived, just have to replace the key words and use the right user to execute and backup your databases:&lt;/P&gt;&lt;PRE&gt;#!/bin/ksh
# Author: Francois Tizie
# 2017/09/19
# This program exports all tables from the given Hive database
##############################################################
EXPORT_DIR=/path-to-hdfs/project_name/HIVE_DB_DUMP/
HiveTables=$(hive -e "use your_database_name;show tables;" 2&amp;gt;/dev/null | egrep -v "WARN|^$|^Logging|^OK|^Time\ taken")
hdfs dfs -mkdir -p /path-to-hdfs/project_name/HIVE_DB_DUMP/ 2&amp;gt;/dev/null
for Table in $HiveTables
do
    hive -e "EXPORT TABLE your_database_name.$Table TO '/path-to-hdfs/project_name/HIVE_DB_DUMP/your_database_name.$Table';"
done&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Sep 2017 17:17:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98284#M11768</guid>
      <dc:creator>francois__tizie</dc:creator>
      <dc:date>2017-09-21T17:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: EXPORT HIVE Database</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98285#M11769</link>
      <description>&lt;P&gt;A learning I had was that when you export a table, use complete HDFS URI... In some cases, I found that it helped executing the command which otherwise was failed&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 18:27:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/EXPORT-HIVE-Database/m-p/98285#M11769</guid>
      <dc:creator>stellium</dc:creator>
      <dc:date>2017-09-21T18:27:14Z</dc:date>
    </item>
  </channel>
</rss>

