Tuesday, November 10, 2015

Hive metastore upgrade manually

Env: hive 12 running derby in embedded mode upgraded to hive-1.0

download derbytools-10.4.2.0.jar
--dump current schema
execute java -cp derbytools-10.4.2.0.jar:$HIVE_HOME/lib/derby-10.4.2.0.jar org.apache.derby.tools.dblook -d 'jdbc:derby:metastore_db' > schema-12.sql
(--metastore_db is relative location)

upgrade hive to hive 1.0 but dont start it.
copy following files from the $HIVE_HOME/scripts/metastore/upgrade/derby/
upgrade-0.12.0-to-0.13.0.derby.sql
018-HIVE-6757.derby.sql
017-HIVE-6458.derby.sql
016-HIVE-6386.derby.sql
hive-txn-schema-0.13.0.derby.sql
019-HIVE-7784.derby.sql
upgrade-0.13.0-to-0.14.0.derby.sql


download derbytools-10.10.1.1.jar
execute java -cp derbytools-10.10.1.1.jar:derby-10.10.1.1.jar org.apache.derby.tools.ij
connect 'jdbc:derby:metastore_db'
run 'upgrade-0.12.0-to-0.13.0.derby.sql';
run 'upgrade-0.13.0-to-0.14.0.derby.sql';

now start hive, you can see my old tables and also query them without any issue.
Post a Comment