Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

No Format
 derby|mysql|postgres|oracle 

Usage Examples

  • Initialize to current schema for a new Hive setup:
    No Format
    
    $ schematool -dbType derby -initSchema
    Metastore connection URL:        jdbc:derby:;databaseName=metastore_db;create=true
    Metastore Connection Driver :    org.apache.derby.jdbc.EmbeddedDriver
    Metastore connection User:       APP
    Starting metastore schema initialization to 0.13.0
    Initialization script hive-schema-0.13.0.derby.sql
    Initialization script completed
    schemaTool completeted
    
  • Get schema information:
    No Format
    
    $ schematool -dbType derby -info
    Metastore connection URL:        jdbc:derby:;databaseName=metastore_db;create=true
    Metastore Connection Driver :    org.apache.derby.jdbc.EmbeddedDriver
    Metastore connection User:       APP
    Hive distribution version:       0.13.0
    Metastore schema version:        0.13.0
    schemaTool completeted
    
  • Attempt to get schema information with older metastore:
    No Format
    
    $ schematool -dbType derby -info
    Metastore connection URL:        jdbc:derby:;databaseName=metastore_db;create=true
    Metastore Connection Driver :    org.apache.derby.jdbc.EmbeddedDriver
    Metastore connection User:       APP
    Hive distribution version:       0.13.0
    org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.
    *** schemaTool failed ***
    
    Since the older metastore doesn't store the version information, the tool reports an error retrieving it.
  • Upgrade schema from an 0.10.0 release by specifying the 'from' version:
    No Format
    
    $ schematool -dbType derby -upgradeSchemaFrom 0.10.0
    Metastore connection URL:        jdbc:derby:;databaseName=metastore_db;create=true
    Metastore Connection Driver :    org.apache.derby.jdbc.EmbeddedDriver
    Metastore connection User:       APP
    Starting upgrade metastore schema from version 0.10.0 to 0.13.0
    Upgrade script upgrade-0.10.0-to-0.11.0.derby.sql
    Completed upgrade-0.10.0-to-0.11.0.derby.sql
    Upgrade script upgrade-0.11.0-to-0.12.0.derby.sql
    Completed upgrade-0.11.0-to-0.12.0.derby.sql
    Upgrade script upgrade-0.12.0-to-0.13.0.derby.sql
    Completed upgrade-0.12.0-to-0.13.0.derby.sql
    schemaTool completeted
    
  • 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 completeted
    
    This is useful if you just want to find out all the required scripts for the schema upgrade.