Upgrade to version 6.1.x Failed With Error "ORA-01000: maximum open cursors exceeded"
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
When upgrading from Confluence 6.0 (or earlier), to Confluence 6.1.x (or later), the upgrade fails with the message ORA-01000: maximum open cursors exceeded
.
The following appears in the atlassian-confluence.log
ERROR [localhost-startStop-1] [atlassian.confluence.plugin.PluginFrameworkContextListener] launchUpgrades Upgrade failed, application will not start: com.atlassian.config.ConfigurationException: Cannot update schema
com.atlassian.confluence.upgrade.UpgradeException: com.atlassian.config.ConfigurationException: Cannot update schema
at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:133)
at com.atlassian.confluence.plugin.PluginFrameworkContextListener.launchUpgrades(PluginFrameworkContextListener.java:118)
at com.atlassian.confluence.plugin.PluginFrameworkContextListener.contextInitialized(PluginFrameworkContextListener.java:77)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
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: com.atlassian.config.ConfigurationException: Cannot update schema
at bucket.core.persistence.hibernate.schema.SchemaHelper.validateSchemaUpdateIfNeeded(SchemaHelper.java:174)
at com.atlassian.confluence.upgrade.AbstractUpgradeManager.upgrade(AbstractUpgradeManager.java:119)
... 11 more
Caused by: org.hibernate.exception.GenericJDBCException: Error accessing table metadata
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97)
at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.convertSQLException(InformationExtractorJdbcDatabaseMetaDataImpl.java:97)
at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.locateTableInNamespace(InformationExtractorJdbcDatabaseMetaDataImpl.java:352)
at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.getTable(InformationExtractorJdbcDatabaseMetaDataImpl.java:226)
at org.hibernate.tool.schema.internal.exec.ImprovedDatabaseInformationImpl.getTableInformation(ImprovedDatabaseInformationImpl.java:110)
at org.hibernate.tool.schema.internal.exec.ImprovedDatabaseInformationImpl.locateTableInformation(ImprovedDatabaseInformationImpl.java:142)
at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.getForeignKeys(InformationExtractorJdbcDatabaseMetaDataImpl.java:655)
at org.hibernate.tool.schema.extract.internal.TableInformationImpl.foreignKeys(TableInformationImpl.java:88)
at org.hibernate.tool.schema.extract.internal.TableInformationImpl.getForeignKey(TableInformationImpl.java:99)
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.findMatchingForeignKey(SchemaMigratorImpl.java:529)
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.applyForeignKeys(SchemaMigratorImpl.java:505)
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.performMigration(SchemaMigratorImpl.java:314)
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:136)
at com.atlassian.confluence.impl.hibernate.ConfluenceHibernateSchemaManagementTool$3.doMigration(ConfluenceHibernateSchemaManagementTool.java:105)
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:109)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:87)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:58)
at bucket.core.persistence.hibernate.schema.SchemaHelper.validateSchemaUpdateIfNeeded(SchemaHelper.java:171)
... 12 more
Caused by: java.sql.SQLException: ORA-01000: maximum open cursors exceeded
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1059)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:522)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257)
Diagnosis
Environment
- Oracle JDBC Driver 12.1.0.2
- Oracle Database
Diagnostic Steps
Running the following query in the database reveals that Confluence is taking up ~600 open cursors during the upgrade:
select a.value, s.username, s.sid, s.serial#
from v$sesstat a, v$statname b, v$session s
where a.statistic# = b.statistic# and s.sid=a.sid
and b.name = 'opened cursors current'
and USERNAME='<INSERT-DATABASE-USERNAME-HERE>'
Cause
CONFSERVER-52353 - Getting issue details... STATUS
This is a known bug with Oracle JDBC driver version 12.1.0.2, which leaks database cursors. See this Oracle Community forum post for more information: https://community.oracle.com/thread/3682300.
Workaround
Increase Maximum Open Cursors
Increase the maximum open cursor in the database by executing the following SQL command on the database:
ALTER SYSTEM SET open_cursors = 1000 SCOPE=BOTH;
This example sets the maximum open cursors to 1000. Change this value as required.
Resolution
Update the Oracle JDBC Driver to the latest version (12.2.0.1)
There is a new version of the Oracle JDBC driver which fixes the cursor leak. Updating your driver prior to upgrading Confluence to 6.1.x will prevent this issue.
To update the driver:
- Stop Confluence, and create a backup of the installation and home directory.
- Download version 12.2.0.1 (or later) of the driver from the Oracle JDBC Driver page.
- Replace the existing
ojdbc7.jar
in<Confluence installation>/confluence/WEB-INF/lib
with the new driver. For detailed instructions, follow step 6 in the database setup for oracle page. - Start Confluence.
- Re-attempt upgrade.