Deepesh Khandelwal created HIVE-11628:
-----------------------------------------

             Summary: DB type detection code is failing on Oracle 12
                 Key: HIVE-11628
                 URL: https://issues.apache.org/jira/browse/HIVE-11628
             Project: Hive
          Issue Type: Bug
          Components: Metastore
         Environment: Oracle 12
            Reporter: Deepesh Khandelwal
            Assignee: Deepesh Khandelwal


DB type detection code is failing when using Oracle 12 as backing store.

When determining qualification for direct SQL, in the logs following message is 
seen:
{noformat}
2015-08-14 01:15:16,020 INFO  [pool-6-thread-109]: metastore.MetaStoreDirectSql 
(MetaStoreDirectSql.java:<init>(131)) - Using direct SQL, underlying DB is OTHER
{noformat}

Currently in org/apache/hadoop/hive/metastore/MetaStoreDirectSql, there is a 
code snippet:
{code}
  private DB determineDbType() {
    DB dbType = DB.OTHER;
    if (runDbCheck("SET @@session.sql_mode=ANSI_QUOTES", "MySql")) {
      dbType = DB.MYSQL;
    } else if (runDbCheck("SELECT version from v$instance", "Oracle")) {
      dbType = DB.ORACLE;
    } else if (runDbCheck("SELECT @@version", "MSSQL")) {
      dbType = DB.MSSQL;
    } else {
      // TODO: maybe we should use getProductName to identify all the DBs
      String productName = getProductName();
      if (productName != null && productName.toLowerCase().contains("derby")) {
        dbType = DB.DERBY;
      }
    }
    return dbType;
  }
{code}
The code relies on access to v$instance in order to identify the backend DB as 
Oracle, but this can fail if users are not granted select privileges on v$ 
tables. An alternate way is specified on [Oracle Database Reference 
pages|http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_4224.htm] 
works.
I will attach a potential patch that should work.

Without the patch the workaround here would be to grant select privileges on v$ 
tables.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to