Bitbucket Server fails to start after Oracle database migration - ORA-00955 name is already used by an existing object
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
In an attempt to create a staging instance, the following steps were taken:
- Create new DB user.
- Export production database.
- Import production data.
- Update
bitbucket.properties.
Upon start up, the following error is found in the application log in the atlassian-bitbucket.log
:
2015-11-20 20:05:41,684 WARN [spring-startup] o.s.w.c.s.XmlWebApplicationContext Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'crowdUserDao' defined in class path resource [crowd-spi-context.xml]: Unsatisfied dependency expressed through constructor argument with index 1 of type [com.atlassian.stash.internal.project.ProjectDao]: : Error creating bean with name 'projectDao' defined in URL
...
Caused by: liquibase.exception.DatabaseException: Error executing SQL CREATE TABLE staging.DATABASECHANGELOGLOCK (ID INTEGER NOT NULL, LOCKED NUMBER(1) NOT NULL, LOCKGRANTED TIMESTAMP, LOCKEDBY VARCHAR2(255 CHAR), CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID)); on jdbc:oracle:thin:@//10.10.10.100:1555/stagingINSERT INTO staging.DATABASECHANGELOGLOCK (ID, LOCKED) VALUES (1, 0): ORA-00955: name is already used by an existing object
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62) ~[liquibase-core-2.0.5.jar:na]
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:104) ~[liquibase-core-2.0.5.jar:na]
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:70) ~[liquibase-core-2.0.5.jar:na]
at liquibase.database.AbstractDatabase.checkDatabaseChangeLogLockTable(AbstractDatabase.java:571) ~[liquibase-core-2.0.5.jar:na]
at liquibase.lockservice.LockService.acquireLock(LockService.java:94) ~[liquibase-core-2.0.5.jar:na]
... 9 common frames omitted
Caused by: java.sql.SQLSyntaxErrorException: ORA-00955: name is already used by an existing object
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0]
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0]
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0]
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0]
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0]
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0]
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0]
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:999) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0]
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1315) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0]
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1890) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0]
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1855) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0]
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:304) ~[ojdbc6-11.2.0.2.0.jar:11.2.0.2.0]
at com.zaxxer.hikari.proxy.StatementProxy.execute(StatementProxy.java:94) ~[HikariCP-2.4.1.jar:na]
at com.zaxxer.hikari.proxy.HikariStatementProxy.execute(HikariStatementProxy.java) ~[HikariCP-2.4.1.jar:na]
at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92) ~[liquibase-core-2.0.5.jar:na]
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55) ~[liquibase-core-2.0.5.jar:na]
... 13 common frames omitted
Cause
While the new user was created and the data was imported, a View was not created for the new user.
Resolution
Create the View for the new user (where <user>
is the Oracle username that Bitbucket Server uses to connect to the database.
CREATE VIEW <user>.all_objects AS
SELECT *
FROM sys.all_objects
WHERE owner = upper('<user>');
For reference: Connect Bitbucket to Oracle