Cloudera

This is the documentation for Cloudera 5.3.x. Documentation for other versions is available at Cloudera Documentation.

Using the Hive Schema Tool

Schema Version Verification

Hive now records the schema version in the metastore database and verifies that
the metastore schema version is compatible with the Hive binaries that
are going to access the metastore. The Hive properties to implicitly
create or alter the existing schema are disabled by default. Hence, Hive
will not attempt to change the metastore schema implicitly. When you
execute a Hive query against an old schema, it will fail to access the
metastore displaying an error message as follows:

...
Caused by: MetaException(message:Version information not found in metastore. )
at org.apache.hadoop.hive.metastore.ObjectStore.checkSchema(ObjectStore.java:5638)
...

To suppress the schema check and allow the metastore to implicitly modify the
schema, you need to set the
hive.metastore.schema.verification configuration
property to false in hive-site.xml.

Using schematool

The Hive distribution now includes an offline tool for Hive metastore schema
manipulation called schematool. This tool can be used
to initialize the metastore schema for the current Hive version. It can
also handle upgrading schema from an older version to the current one.
The tool will try to find the current schema from the metastore if
available. However, this will be applicable only to any future upgrades.
In case you are upgrading from existing CDH releases like CDH 4 or CDH
3, you should specify the schema version of the existing metastore as a
command line option to the tool.

The schematool figures out the SQL scripts required to
initialize or upgrade the schema and then executes those scripts against
the backend database. The metastore database connection information such
as JDBC URL, JDBC driver and database credentials are extracted from the
Hive configuration. You can provide alternate database credentials if
needed.

The following options are available as part of the schematool
package.