"ORA-00955: name is already used" error when accessing a Bitbucket branch from Jira

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Data Center のみ - この記事は、Data Center プラットフォームのアトラシアン製品にのみ適用されます。

この KB は Data Center バージョンの製品用に作成されています。Data Center 固有ではない機能の Data Center KB は、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。

*Fisheye および Crucible は除く

要約

When accessing a branch from the JIRA side the user gets an error stating Jira is unable to access Bitbucket.

環境

  • Bitbucket 7.17 linked with JIRA 5+
  • Oracle DB

診断

The HAR shows the following when replicating the issue:

{
  "errors": [
    {
      "instance": {
        "primary": true,
        "baseUrl": "https://bitbucket.mycompany",
        "applicationLinkId": "5cb06664-bfd5-380c-8911-79a3dd7ed622",
        "singleInstance": false,
        "name": "BitbucketPrimary",
        "typeName": "Bitbucket Server",
        "type": "stash"
      },
      "error": "HTTP status 500 "
    }
  ],
  "detail": []
}

Bitbucket logs endorse the internal server error coming from it:

2022-02-22 16:26:05,676-0500 http-nio-8080-exec-50 WARN USER 786x171776x4 2r2jyzl 10.1.1.2,127.0.0.1 /rest/dev-status/1.0/issue/detail [c.a.j.p.devstatus.provider.DefaultCoordinator] BitbucketPrimary (HTTP status 500 )

The error below is also seen through Bitbucket logs:

2022-02-22 00:08:08,082 ERROR [http-nio-127.0.0.1-7990-exec-4] @B3YJ12x8x35247x0 10.10.10.90,127.0.0.1 "GET /rest/jira-dev/latest/updated-issues HTTP/1.1" c.a.s.i.r.e.DefaultUnhandledExceptionMapperHelper Unhandled exception while processing REST request: "GET /rest/jira-dev/latest/updated-issues HTTP/1.1"
com.atlassian.activeobjects.internal.ActiveObjectsInitException: bundle [com.atlassian.bitbucket.server.bitbucket-jira-development-integration]
...
Caused by: com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library:
Database:
	- name:Oracle
	- version:Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
	- minor version:0
	- major version:19
Driver:
	- name:Oracle JDBC driver
	- version:12.2.0.1.0

java.sql.SQLSyntaxErrorException: ORA-00955: name is already used by an existing object

原因

This happens due to an existing BUG with the Jira to Bitbucket integration where Oracle databases are not checked for existing sequences during an upgrade, and because of that when the application attempts to create the sequences it needs, it errors out because it is already there. The full details of this bug can be found here:

You can confirm the exact sequence causing the problem by reviewing the following exception which was thrown in the latest application restart:

2022-02-22 17:57:12,858 ERROR [active-objects-init-compatibility-tenant-0]  net.java.ao.sql Exception executing SQL update <CREATE SEQUENCE "AO_777666_JIRA_SITE1384450722" INCREMENT BY 1 START WITH 1 NOMAXVALUE MINVALUE 1>

ソリューション

Follow the resolution procedures below in the Bitbucket database (execute as the DB user for Bitbucket)

Resolution steps

  1. Backup your data (DB + filesystem) before proceeding with the following commands
  2. Stop your Bitbucket instance
  3. In a Bitbucket database session, confirm that the offending sequence already exists through a query such as the following:

    SELECT *
    FROM all_sequences
    WHERE sequence_name LIKE 'AO_777666_JIRA_SITE1384450722';  
  4. Record the value under the 'LAST_NUMBER' column. (If the 'LAST_NUMBER' column is just equal to 1, this step can safely be ignored).
  5. Drop the sequence using a query similar to the following:

    DROP SEQUENCE AO_777666_JIRA_SITE1384450722;  
  6. Start Bitbucket - This should re-create the sequence that we dropped and allow the application to proceed normally and without error
  7. If the previous 'LAST_NUMBER' value for the sequence wasn't 1, we'd recommend resetting the LAST_NUMBER value back to the original value through the following query:

    ALTER SEQUENCE AO_777666_JIRA_SITE1384450722 RESTART 
    START WITH LAST_NUMBER_VALUE_HERE;



最終更新日 2023 年 4 月 12 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.