boolean validateSchemaVersions() throws HiveMetaException {
    System.out.println("Validating schema version");
    try {
      String hiveSchemaVersion = schemaTool.getMetaStoreSchemaInfo().getHiveSchemaVersion();
      MetaStoreConnectionInfo connectionInfo = schemaTool.getConnectionInfo(false);
      String newSchemaVersion = schemaTool.getMetaStoreSchemaInfo().getMetaStoreSchemaVersion(connectionInfo);
      schemaTool.assertCompatibleVersion(hiveSchemaVersion, newSchemaVersion);
    } catch (HiveMetaException hme) {
      if (hme.getMessage().contains("Metastore schema version is not compatible") ||
          hme.getMessage().contains("Multiple versions were found in metastore") ||
          hme.getMessage().contains("Could not find version info in metastore VERSION table")) {
        System.err.println(hme.getMessage());
        System.out.println("[FAIL]\n");
        return false;
      } else {
        throw hme;
      }
    }
    System.out.println("[SUCCESS]\n");
    return true;
  }
Print Hive version and schema version.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/schematool/SchemaToolTaskValidate.java