Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: examples of moveDatabase & moveTable


By default the configuration property hive.metastore.schema.verification is false and metastore to implicitly write the schema version if it's not matching. To enable the strict schema verification, you need to set this property to true in hive-site.xml.

See Hive Metastore Administration for general information about the metastore.


  • Upgrade dry run can be used to list the required scripts for the given upgrade.

    No Format
    $ build/dist/bin/schematool -dbType derby -upgradeSchemaFrom 0.7.0 -dryRun
    Metastore Connection Driver :    org.apache.derby.jdbc.EmbeddedDriver
    Metastore connection User:       APP
    Starting upgrade metastore schema from version 0.7.0 to 0.13.0
    Upgrade script upgrade-0.7.0-to-0.8.0.derby.sql
    Upgrade script upgrade-0.8.0-to-0.9.0.derby.sql
    Upgrade script upgrade-0.9.0-to-0.10.0.derby.sql
    Upgrade script upgrade-0.10.0-to-0.11.0.derby.sql
    Upgrade script upgrade-0.11.0-to-0.12.0.derby.sql
    Upgrade script upgrade-0.12.0-to-0.13.0.derby.sql
    schemaTool completed

    This is useful if you just want to find out all the required scripts for the schema upgrade.

  • Moving a database and tables under it from default Hive catalog to a custom spark catalog

    No Format
    build/dist/bin/schematool -moveDatabase db1 -fromCatalog hive -toCatalog spark

  • Moving a table from Hive catalog to Spark Catalog

    No Format
    # Create the desired target database in spark catalog if it doesn't already exist.
    beeline ... -e "create database if not exists newdb";
    schematool -moveDatabase newdb -fromCatalog hive -toCatalog spark
    # Now move the table to target db under the spark catalog.
    schematool -moveTable table1 -fromCatalog hive -toCatalog spark  -fromDatabase db1 -toDatabase newdb