<?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: Change Hive database location. in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Change-Hive-database-location/m-p/291110#M215293</link>
    <description>&lt;P&gt;Is this a cluster with sentry and sentry hdfs synchronisation enabled?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it is just hive without sentry or sentry hdfs synchronisation enabled and you want to switch from default /user/hive/warehouse to a new path then following steps would do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Step1: Stop hive
Step2: Take backup of your metastore database
Step3: Change the CM &amp;gt; Hive &amp;gt; Configuration &amp;gt; hive.metastore.warehouse.dir setting to '&amp;lt;new path&amp;gt;'
- Deploy client configuration
Step4: Move the current directory
i.e hdfs dfs -mv /user/hive/warehouse &amp;lt;new_path&amp;gt;

Step5:
Update HMS DB tables.
Login to backend hms db and update the following tables in metastore database.
update SDS set location = (select replace(location, '/user/hive/warehouse', '&amp;lt;new_path&amp;gt;') ) where location like '%/user/hive/warehouse%';
update DBS set DB_LOCATION_URI = (select replace(DB_LOCATION_URI, '/user/hive/warehouse', '&amp;lt;new_path&amp;gt;') ) where DB_LOCATION_URI like '%/user/hive/warehouse%';
update SKEWED_COL_VALUE_LOC_MAP set LOCATION = (select replace(LOCATION, '/user/hive/warehouse', '&amp;lt;new path&amp;gt;') ) where LOCATION like '%/user/hive/warehouse%';
update SERDE_PARAMS set PARAM_VALUE = (select replace(PARAM_VALUE, '/user/hive/warehouse', '&amp;lt;new path&amp;gt;') ) where PARAM_VALUE like '%/user/hive/warehouse%';
update TABLE_PARAMS set PARAM_VALUE = (select replace(PARAM_VALUE, '/user/hive/warehouse', '&amp;lt;new path&amp;gt;') ) where PARAM_VALUE like '%/user/hive/warehouse%';

Step6:
- Start hive&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Make sure to test this steps on your test clusters first before proceeding towards production cluster.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Mar 2020 04:50:20 GMT</pubDate>
    <dc:creator>venkatsambath</dc:creator>
    <dc:date>2020-03-05T04:50:20Z</dc:date>
  </channel>
</rss>

