Error with Oracle Database - Tablespace does not exist

Still need help?

The Atlassian Community is here for you.

Ask the community

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 starting or restarting Bitbucket Server a database error is thrown in the application log. The following appears in the atlassian-bitbucket.log:

2016-12-02 11:33:29,369 ERROR [active-objects-init-compatibility-tenant-0]  net.java.ao.sql Exception executing SQL update <CREATE INDEX "index_ao_bd73c3_pro578890136" ON "AO_BD73C3_PROJECT_AUDIT"("PROJECT_ID")>
java.sql.SQLSyntaxErrorException: ORA-00959: tablespace '<Tablespace_Name>' does not exist

Diagnosis

The Tablespace_Name referred to in the error message is the same as the user Bitbucket Server uses to connect to the database. When a default tablespace is not defined for a user, Oracle uses the connection username as the name of the default tablespace.

Cause

The default tablespace originally defined for the user used by Bitbucket Server to connect to the database was disassociated from the user. 

Resolution

Determine which database object is associated with the Bitbucket Server database user:

select count(1) from all_objects where owner='<bitbucket_user>' and object_type='VIEW' and object_name='ALL_OBJECTS';


If the result set returns a value more than 1, redefine the default tablespace for the Bitbucket Server user used to connect to the database (as defined in BITBUCKET_HOME/bitbucket.properties):

 ALTER USER <bitbucket_user> DEFAULT TABLESPACE <correct tablespace name here>;

 

If the result set is empty, the view needs to be created:

CREATE VIEW bitbucket.all_objects AS

  SELECT *

  FROM sys.all_objects

  WHERE owner = upper('<bitbucket_user>');

 


Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

Last modified on Jan 19, 2017

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.