Contacting Cloudera Support for help to correct file location problems is highly recommended.
Alternatively, you can perform correct file locations of
managed files yourself.
-
Login as the HDFS superuser and if you use Kerberos, you need to become the
superuser with a valid ticket.
-
Start Hive in Ambari 7.1.x.x.
-
On a node in your cluster, start Beeline in the background and a Hive
shell in the foreground.
-
Change the location of the database and the table from the old location to
the new location.
hive> ALTER DATABASE tpcds_bin_partitioned_orc_10 SET LOCATION
'hdfs://ns1/apps/hive/warehouse/tpcds_bin_partitioned_orc_10.db';
hive> ALTER TABLE tpcds_bin_partitioned_orc_10.store_sales SET LOCATION
'hdfs://ns1/apps/hive/warehouse/tpcds_bin_partitioned_orc_10.db/store_sales';
-
On the Hive Metastore node, log in as the HDFS superuser.
-
Set STACK_VERSION to the HDP version you are running.
$ export STACK_VERSION=`hdp-select status hive-server2 | awk '{ print $3; }'`
-
Run the script for strict Hive migration.
$ /usr/hdp/$STACK_VERSION/hive/bin/hive --config /etc/hive/conf
--service strictmanagedmigration
--hiveconf hive.strict.managed.tables=true -m automatic
--modifyManagedTables --oldWarehouseRoot /apps/hive/warehouse