After migrating the Bitbucket Server database from one Oracle server to another, the application leads to an error during start up: missing table [bb_alert]
After migrating a Bitbucket database from one Oracle server to another the application doesn't start up with following error in
ERROR [spring-startup] c.a.j.s.w.s.JohnsonDispatcherServlet SpringMVC dispatcher [springMvc] could not be started org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'crowdAliasDao': Unsatisfied dependency expressed through method 'setSessionFactory' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [stash-context.xml]: Cannot resolve reference to bean 'sessionFactoryPrototype' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [bb_alert]
According to the article Connecting Bitbucket Server to Oracle, whenever a DB is created in Oracle, a local
all_objects view to the user's schema must be created in the ownership of the DB user.
If the new schema is set up with a different user as the owner rather than the one in the original, then the all_objects view (which is also copied along with the tables) would not allow the application to read the tables due to insufficient privileges.
Reassign ownership of the all-objects view to the new user in the migrated schema and restart the application.