title: Getting ORA-01031: insufficient privileges after confiduring sonarqube to connect to an Oracle 12.01.02 DB
body: <p>I have setup up a linux installation of Sonarqube 5.4 connecting to an Oracle 12.01.02 DB.</p>
  
  <p>After starting sonarqube, I get the following error messages on the web interface:</p>
  
  <pre><code>org.jruby.rack.RackInitializationException: An error has occurred, all later migrations canceled:
  
  ActiveRecord::JDBCError: ORA-01031: insufficient privileges 
  : CREATE SEQUENCE projects_seq START WITH 10000 from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record /connection_adapters/abstract_adapter.rb:227:in `log'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183:in `execute'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/oracle/adapter.rb:134:in `create_table'
  from org/jruby/RubyKernel.java:2231:in `send'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:352:in `method_missing'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:328:in `say_with_time'
  from jar:file:/usr/local/sonarqube-5.4/lib/server/jruby-complete-1.7.9.jar!/META-INF/jruby.home/lib/ruby/1.8/benchmark.rb:293:in `measure'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:328:in `say_with_time'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:348:in `method_missing'
  from /usr/local/sonarqube-5.4/web/WEB-INF/config/environment.rb:228:in `create_table'
  from /usr/local/sonarqube-5.4/web/WEB-INF/db/migrate/001_initial_schema.rb:22:in `up'
  from org/jruby/RubyKernel.java:2223:in `send'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:282:in `migrate'
  from jar:file:/usr/local/sonarqube-5.4/lib/server/jruby-complete-1.7.9.jar!/META-INF/jruby.home/lib/ruby/1.8/benchmark.rb:293:in `measure'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:282:in `migrate'
  from org/jruby/RubyKernel.java:2227:in `send'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:365:in `migrate'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:491:in `migrate'
  from org/jruby/RubyProc.java:290:in `call'
  from org/jruby/RubyProc.java:224:in `call'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:576:in `ddl_transaction'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:490:in `migrate'
  from org/jruby/RubyArray.java:1613:in `each'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:477:in `migrate'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:401:in `up'
  from /usr/local/sonarqube-5.4/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/migration.rb:383:in `migrate'
  from /usr/local/sonarqube-5.4/web/WEB-INF/lib/database_version.rb:66:in `upgrade_and_start'
  from /usr/local/sonarqube-5.4/web/WEB-INF/lib/database_version.rb:77:in `automatic_setup'
  from /usr/local/sonarqube-5.4/web/WEB-INF/config/environment.rb:306:in `(root)'
  from org/jruby/RubyKernel.java:1094:in `load'
  from file:/usr/local/sonarqube-5.4/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:1:in `(root)'
  from file:/usr/local/sonarqube-5.4/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment2.rb:25:in `load_environment'
  from file:/usr/local/sonarqube-5.4/lib/server/jruby-rack-1.1.13.2.jar!/jruby/rack/rails_booter.rb:79:in `load_environment'
  
  at org.jruby.rack.RackInitializationException.wrap(RackInitializationException.java:29)
  at org.jruby.rack.RackApplicationFactoryDecorator.init(RackApplicationFactoryDecorator.java:98)
  at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:50)
  at org.sonar.server.platform.RubyRailsContextListener.contextInitialized(RubyRailsContextListener.java:35)
  at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
  Caused by: org.jruby.exceptions.RaiseException: (StandardError) An error has occurred, all later migrations canceled:
  
  ActiveRecord::JDBCError: ORA-01031: insufficient privileges
  : CREATE SEQUENCE projects_seq START WITH 10000
  </code></pre>
  
  <p>I can see in the database that the tables Projects and Schema_migrations are added.
  I can also delete the tables using the same credentials defined for sonarqube.</p>
  
  <p>Here is a listing of my sonar.properties file:</p>
  
  <pre><code># Property values can:
  # - reference an environment variable, for example sonar.jdbc.url= ${env:SONAR_JDBC_URL}
  # - be encrypted. See http://redirect.sonarsource.com/doc/settings-encryption.html
  
  #--------------------------------------------------------------------------------------------------
  # DATABASE
  #
  # IMPORTANT: the embedded H2 database is used by default. It is recommended for tests but not for
  # production use. Supported databases are MySQL, Oracle, PostgreSQL and Microsoft SQLServer.
  
  # User credentials.
  # Permissions to create tables, indices and triggers must be granted to JDBC user.
  # The schema must be created first.
  sonar.jdbc.username=sonarqube
  sonar.jdbc.password=XXX
  
  #----- Embedded Database (default)
  # H2 embedded database server listening port, defaults to 9092
  # sonar.embeddedDatabase.port=9092
  
  
  #----- MySQL 5.x
  # Only InnoDB storage engine is supported (not myISAM).
  # Only the bundled driver is supported. It can not be changed.
  # sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;characterEncoding=utf8&amp;rewriteBatchedStatements=true&amp;useConfigs=maxPerformance
  
  
  #----- Oracle 11g/12c
  # - Only thin client is supported
  # - Only versions 11.2.x and 12.x of Oracle JDBC driver are supported
  # - The JDBC driver must be copied into the directory extensions/jdbc-driver/oracle/
  # - If you need to set the schema, please refer to http://jira.sonarsource.com/browse/SONAR-5000
  sonar.jdbc.url=jdbc:oracle:thin:@//dbt16-vip.xxx.com:1521/tplm
  
  
  #----- PostgreSQL 8.x/9.x
  # If you don't use the schema named "public", please refer to http://jira.sonarsource.com/browse/SONAR-5000
  #sonar.jdbc.url=jdbc:postgresql://localhost/sonar
  
  
  #----- Microsoft SQLServer 2008/2012/2014 and SQL Azure
  # A database named sonar must exist and its collation must be case-sensitive (CS) and accent-sensitive (AS)
  # Use the following connection string if you want to use integrated security with Microsoft Sql Server
  # Do not set sonar.jdbc.username or sonar.jdbc.password property if you are using Integrated Security
  # For Integrated Security to work, you have to download the Microsoft SQL JDBC driver package from
  # http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&amp;id=11774
  # and copy sqljdbc_auth.dll to your path. You have to copy the 32 bit or 64 bit version of the dll
  # depending upon the architecture of your server machine.
  # This version of SonarQube has been tested with Microsoft SQL JDBC version 4.1
  # sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar;integratedSecurity=true
  
  # Use the following connection string if you want to use SQL Auth while connecting to MS Sql Server.
  # Set the sonar.jdbc.username and sonar.jdbc.password appropriately.
  #sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar
  #----- Connection pool settings
  # The maximum number of active connections that can be allocated
  # at the same time, or negative for no limit.
  # The recommended value is 1.2 * max sizes of HTTP/HTTPS pools. For example if both HTTP and
  # HTTPS ports are enabled with default sizes (50, see properties sonar.web.http.maxThreads
  # and sonar.web.https.maxThreads) then sonar.jdbc.maxActive should be 1.2 * (50 + 50) = 120.
  sonar.jdbc.maxActive=50
  
  # The maximum number of connections that can remain idle in the
  # pool, without extra ones being released, or negative for no limit.
  sonar.jdbc.maxIdle=5
  
  # The minimum number of connections that can remain idle in the pool,
  # without extra ones being created, or zero to create none.
  sonar.jdbc.minIdle=2
  
  # The maximum number of milliseconds that the pool will wait (when there
  # are no available connections) for a connection to be returned before
  # throwing an exception, or &lt;= 0 to wait indefinitely.
  sonar.jdbc.maxWait=5000
  
  #sonar.jdbc.minEvictableIdleTimeMillis=600000
  #sonar.jdbc.timeBetweenEvictionRunsMillis=30000
  
  
  
  #--------------------------------------------------------------------------------------------------
  # WEB SERVER
  
  # Web server is executed in a dedicated Java process. By default heap size is 768Mb.
  # Use the following property to customize JVM options.
  #    Recommendations:
  #
  #    The HotSpot Server VM is recommended. The property -server should be added if server mode
  #    is not enabled by default on your environment: http://docs.oracle.com/javase/7/docs/technotes/guides/vm/server-class.html
  #
  #sonar.web.javaOpts=-Xmx768m -Xms256m -XX:MaxPermSize=160m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true
  
  # Same as previous property, but allows to not repeat all other settings like -Xmx
  #sonar.web.javaAdditionalOpts=
  
  # Binding IP address. For servers with more than one IP address, this property specifies which
  # address will be used for listening on the specified ports.
  # By default, ports will be used on all IP addresses associated with the server.
  #sonar.web.host=0.0.0.0
  
  # TCP port for incoming HTTP connections. Disabled when value is -1.
  #sonar.web.port=9000
  
  
  # Recommendation for HTTPS
  #    SonarQube natively supports HTTPS. However using a reverse proxy
  #    infrastructure is the recommended way to set up your SonarQube installation
  #    on production environments which need to be highly secured.
  #    This allows to fully master all the security parameters that you want.
  
  # TCP port for incoming HTTPS connections. Disabled when value is -1 (default).
  #sonar.web.https.port=-1
  
  # HTTPS - the alias used to for the server certificate in the keystore.
  # If not specified the first key read in the keystore is used.
  #sonar.web.https.keyAlias=
  
  # HTTPS - the password used to access the server certificate from the
  # specified keystore file. The default value is "changeit".
  #sonar.web.https.keyPass=changeit
  
  # HTTPS - the pathname of the keystore file where is stored the server certificate.
  # By default, the pathname is the file ".keystore" in the user home.
  # If keystoreType doesn't need a file use empty value.
  #sonar.web.https.keystoreFile=
  
  # HTTPS - the password used to access the specified keystore file. The default
  # value is the value of sonar.web.https.keyPass.
  #sonar.web.https.keystorePass=
  
  # HTTPS - the type of keystore file to be used for the server certificate.
  # The default value is JKS (Java KeyStore).
  #sonar.web.https.keystoreType=JKS
  
  # HTTPS - the name of the keystore provider to be used for the server certificate.
  # If not specified, the list of registered providers is traversed in preference order
  # and the first provider that supports the keystore type is used (see sonar.web.https.keystoreType).
  #sonar.web.https.keystoreProvider=
  
  # HTTPS - the pathname of the truststore file which contains trusted certificate authorities.
  # By default, this would be the cacerts file in your JRE.
  # If truststoreFile doesn't need a file use empty value.
  #sonar.web.https.truststoreFile=
  
  # HTTPS - the password used to access the specified truststore file. 
  #sonar.web.https.truststorePass=
  
  # HTTPS - the type of truststore file to be used.
  # The default value is JKS (Java KeyStore).
  #sonar.web.https.truststoreType=JKS
  
  # HTTPS - the name of the truststore provider to be used for the server certificate.
  # If not specified, the list of registered providers is traversed in preference order
  # and the first provider that supports the truststore type is used (see sonar.web.https.truststoreType).
  #sonar.web.https.truststoreProvider=
  
  # HTTPS - whether to enable client certificate authentication.
  # The default is false (client certificates disabled).
  # Other possible values are 'want' (certificates will be requested, but not required),
  # and 'true' (certificates are required).
  #sonar.web.https.clientAuth=false
  
  # HTTPS - comma separated list of encryption ciphers to support for HTTPS connections.
  # If specified, only the ciphers that are listed and supported by the SSL implementation will be used.
  # By default, the default ciphers for the JVM will be used. Note that this usually means that the weak
  # export grade ciphers, for instance RC4, will be included in the list of available ciphers.
  # The ciphers are specified using the JSSE cipher naming convention (see
  # https://www.openssl.org/docs/apps/ciphers.html)
  # Example: sonar.web.https.ciphers=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
  #sonar.web.https.ciphers=
  
  # The maximum number of connections that the server will accept and process at any given time.
  # When this number has been reached, the server will not accept any more connections until
  # the number of connections falls below this value. The operating system may still accept connections
  # based on the sonar.web.connections.acceptCount property. The default value is 50 for each
  # enabled connector.
  #sonar.web.http.maxThreads=50
  #sonar.web.https.maxThreads=50
  
  # The minimum number of threads always kept running. The default value is 5 for each
  # enabled connector.
  #sonar.web.http.minThreads=5
  #sonar.web.https.minThreads=5
  
  # The maximum queue length for incoming connection requests when all possible request processing
  # threads are in use. Any requests received when the queue is full will be refused.
  # The default value is 25 for each enabled connector.
  #sonar.web.http.acceptCount=25
  #sonar.web.https.acceptCount=25
  
  # TCP port for incoming AJP connections. Disabled if value is -1. Disabled by default.
  #sonar.ajp.port=-1
  
  
  #--------------------------------------------------------------------------------------------------
  # ELASTICSEARCH
  # Elasticsearch is used to facilitate fast and accurate information retrieval.
  # It is executed in a dedicated Java process.
  
  # JVM options of Elasticsearch process
  #    Recommendations:
  #
  #    Use HotSpot Server VM. The property -server should be added if server mode
  #    is not enabled by default on your environment: http://docs.oracle.com/javase/7/docs/technotes/guides/vm/server-class.html
  #
  #sonar.search.javaOpts=-Xmx1G -Xms256m -Xss256k -Djava.net.preferIPv4Stack=true \
  #  -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 \
  #  -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError
  
  # Same as previous property, but allows to not repeat all other settings like -Xmx
  #sonar.search.javaAdditionalOpts=
  
  # Elasticsearch port. Default is 9001. Use 0 to get a free port.
  # As a security precaution, should be blocked by a firewall and not exposed to the Internet.
  #sonar.search.port=9001
  
  # Elasticsearch host. The search server will bind this address and the search client will connect to it.
  # Default is 127.0.0.1.
  # As a security precaution, should NOT be set to a publicly available address.
  #sonar.search.host=127.0.0.1
  
  
  #--------------------------------------------------------------------------------------------------
  # UPDATE CENTER
  
  # Update Center requires an internet connection to request http://update.sonarsource.org
  # It is enabled by default.
  #sonar.updatecenter.activate=true
  
  # HTTP proxy (default none)
  #http.proxyHost=
  #http.proxyPort=
  
  # NT domain name if NTLM proxy is used
  #http.auth.ntlm.domain=
  
  # SOCKS proxy (default none)
  #socksProxyHost=
  #socksProxyPort=
  
  # proxy authentication. The 2 following properties are used for HTTP and SOCKS proxies.
  #http.proxyUser=
  #http.proxyPassword=
  
  
  #--------------------------------------------------------------------------------------------------
  # LOGGING
  
  # Level of logs. Supported values are INFO(default), DEBUG and TRACE (DEBUG + SQL + ES requests)
  # sonar.log.level=TRACE
  
  # Path to log files. Can be absolute or relative to installation directory.
  # Default is &lt;installation home&gt;/logs
  # sonar.path.logs=logs
  
  # Rolling policy of log files
  #    - based on time if value starts with "time:", for example by day ("time:yyyy-MM-dd")
  #      or by month ("time:yyyy-MM")
  #    - based on size if value starts with "size:", for example "size:10MB"
  #    - disabled if value is "none".  That needs logs to be managed by an external system like logrotate.
  #sonar.log.rollingPolicy=time:yyyy-MM-dd
  
  # Maximum number of files to keep if a rolling policy is enabled.
  #    - maximum value is 20 on size rolling policy
  #    - unlimited on time rolling policy. Set to zero to disable old file purging.
  #sonar.log.maxFiles=7
  
  # Access log is the list of all the HTTP requests received by server. If enabled, it is stored
  # in the file {sonar.path.logs}/access.log. This file follows the same rolling policy as for
  # sonar.log (see sonar.log.rollingPolicy and sonar.log.maxFiles).
  #sonar.web.accessLogs.enable=true
  
  # Format of access log. It is ignored if sonar.web.accessLogs.enable=false. Value is:
  #    - "common" is the Common Log Format (shortcut for: %h %l %u %user %date "%r" %s %b)
  #    - "combined" is another format widely recognized (shortcut for: %h %l %u [%t] "%r" %s %b "%i{Referer}" "%i{User-Agent}")
  #    - else a custom pattern. See http://logback.qos.ch/manual/layouts.html#AccessPatternLayout
  #sonar.web.accessLogs.pattern=combined
  
  
  #--------------------------------------------------------------------------------------------------
  # OTHERS
  
  # Delay in seconds between processing of notification queue. Default is 60 seconds.
  #sonar.notifications.delay=60
  
  # Paths to persistent data files (embedded database and search index) and temporary files.
  # Can be absolute or relative to installation directory.
  # Defaults are respectively &lt;installation home&gt;/data and &lt;installation home&gt;/temp
  #sonar.path.data=data
  #sonar.path.temp=temp
  
  
  #--------------------------------------------------------------------------------------------------
  # DEVELOPMENT - only for developers
  # The following properties MUST NOT be used in production environments.
  
  # Dev mode allows to reload web sources on changes and to restart server when new versions
  # of plugins are deployed.
  #sonar.web.dev=false
  
  # Path to webapp sources for hot-reloading of Ruby on Rails, JS and CSS (only core,
  # plugins not supported).
  #sonar.web.dev.sources=/path/to/server/sonar-web/src/main/webapp
  
  # Elasticsearch HTTP connector, for example for KOPF:
  # http://lmenezes.com/elasticsearch-kopf/?location=http://localhost:9010
  #sonar.search.httpPort=-1
  </code></pre>
  
  <p>With select * from session_privs I can see the following privileges:</p>
  
  <p>SET CONTAINER</p>
  
  <p>CREATE PROCEDURE</p>
  
  <p>CREATE VIEW</p>
  
  <p>CREATE TABLE</p>
  
  <p>ALTER SESSION</p>
  
  <p>CREATE SESSION</p>
  
  <p>Regarding to the Oracle admin this includes: 
  update table
  delete table
  select table</p>
  
  <p>Do anyone have an idea what to look after for solving the issue?</p>
  
  <p>Is there an option to capture the SQL statements send to the DB to get the failing SQL statement?</p>
  
  <p>Thanks and Regards</p>
  
  <p>Martin</p>