Hive出现 Cause:Table 'metastore.VERSION' doesn't exist异常

描述:

使用Cloudera Manager集成Hive的服务,出现 Cause:Table 'metastore.VERSION' doesn't exist异常,去对应的数据库查看,发现该表确实不存在,而且很多其它表也没有。

解决方案:

到/opt/cloudera/parcels/CDH-6.2.0-1.cdh6.2.0.p0.967373/lib/hive/scripts/metastore/upgrade/目录寻找schema初始化SQL。(路径中的CDH版本根据实际情况修改)

[root@cdh-05 ~]# cd /opt/cloudera/parcels/CDH-6.2.0-1.cdh6.2.0.p0.967373/lib/hive/scripts/metastore/upgrade
[root@cdh-05 upgrade]# ll
total 36
drwxr-xr-x. 2 root root 4096 Mar 14 15:46 derby
drwxr-xr-x. 2 root root 4096 Mar 14 15:46 mssql
drwxr-xr-x. 2 root root 4096 Mar 14 15:46 mysql
drwxr-xr-x. 2 root root 4096 Mar 14 15:46 oracle
drwxr-xr-x. 2 root root 8192 Mar 14 15:46 postgres
[root@cdh-05 upgrade]# 

我们看到包含有多个数据库,我当前使用的mysql,所以进入mysql目录,找到shcema初始化sql文件:hive-schema-2.1.1.mysql.sql(对应的版本也根据实际情况选择),我当前是2.1.1版本:

然后登陆数据库,选择metastore库,执行该sql(sql路径自己更改):

mysql> use metastore;
Database changed 
mysql> source /data/hive-schema-2.1.1.mysql.sql
//......省略输出
mysql> show tables;
+---------------------------+
| Tables_in_metastore       |
+---------------------------+
| BUCKETING_COLS            |
| CDH_VERSION               |
| CDS                       |
| COLUMNS_V2                |
| DATABASE_PARAMS           |
| DBS                       |
| DB_PRIVS                  |
| DELEGATION_TOKENS         |
| FUNCS                     |
| FUNC_RU                   |
| GLOBAL_PRIVS              |
| IDXS                      |
| INDEX_PARAMS              |
| KEY_CONSTRAINTS           |
| MASTER_KEYS               |
| NOTIFICATION_LOG          |
| NOTIFICATION_SEQUENCE     |
| NUCLEUS_TABLES            |
| PARTITIONS                |
......

然后重试即可。

猜你喜欢

转载自blog.csdn.net/huangzhilin2015/article/details/90517074