Bitbucket Server を Oracle に接続する
このページでは、Bitbucket Server を Oracle データベースに接続する方法について説明します。
Bitbucket Server で Oracle データベースを使用するための全体的なプロセスは次のとおりです。
- Bitbucket Server からアクセス可能な場所に Oracle をインストールします。
- Oracle サーバーで、Bitbucket Server が使用するデータベースおよびユーザーを作成します。
- Windows、Linux、または Mac に Bitbucket Server をインストールします。「使用を開始する」をご覧ください。
- 次のいずれかを実行します。
- Bitbucket Server のインストール時にセットアップ ウィザードを実行して Bitbucket Server を Oracle データベースに接続します。または
- あとから Bitbucket Server を Oracle データベースに移行します。「データベース移行ウィザードの使用」を参照してください。
ここでは、Oracle をすでにインストールし、実行中であることを想定しています。Oracle のインストールと Oracle データベースの作成の詳細については、Oracle のドキュメント ページを参照してください。Bitbucket Server がサポートする Oracle のバージョンについては「サポート対象プラットフォーム」をご確認ください。
前提条件
バックアップ
内部の Bitbucket Server データベースからデータを移行する場合、Bitbucket Server ホーム ディレクトリをバックアップします。
別の外部データベースから Bitbucket Server データを移行する場合は、これらの手順を進める前に、データベース ベンダーから提供された手順に従ってデータベースをバックアップします。
「データの復元とバックアップ」を参照してください。
Bitbucket Server データベースの作成
Bitbucket Server で Oracle を使用する前に、Oracle を次のようにセットアップする必要があります。
- Ensure that you have a database instance available for Bitbucket Server (either create a new one or use an existing one)
The character set of the database must be set to eitherAL32UTF8
orUTF8
, to support storage of Unicode data as per the Oracle documentation.
Note that it is important to the proper operation of Bitbucket Server that the database store its data in a case-sensitive manner. By changing the values of the NLS_COMP and/or NLS_SORT variables, it is possible to cause Oracle to perform its searches in a case-insensitive manner. We therefore strongly recommend that those variables be left at their default values. - Create a user that Bitbucket Server will connect as (e.g.
bitbucket
).
Remember the database user name; it will be used to configure Bitbucket Server's connection to the database in subsequent steps.
When you create a user in Oracle, a schema is automatically created.
It is strongly recommended that you create a new database user for use by Bitbucket Server rather than sharing one that is used by other applications or people. - Grant the Bitbucket Server user
connect
andresource
roles only. Theconnect
role is required to set up a connection, whileresource
role is required to allow the user to create objects in its own schema. - Create a local
all_objects
view to the user's schema, so that there is no possibility that a table with the same name as one of the Bitbucket Server tables in another schema will cause any conflicts. - Bitbucket Server では、データベースのアイドル接続を 10 分以上に維持する必要があります。データベースの接続タイムアウトが 10 分未満に設定されている場合、ランダムに見える接続エラーが発生します。
Oracle でユーザーを作成するコマンドの形式は次のとおりです。
CREATE USER <user>
IDENTIFIED BY <password>
DEFAULT TABLESPACE USERS
QUOTA UNLIMITED ON USERS;
GRANT CONNECT, RESOURCE to <user>;
CREATE VIEW <user>.all_objects AS
SELECT *
FROM sys.all_objects
WHERE owner = upper('<user>');
Here is a simple example, using SQL*Plus, of how one might create a user called bitbucket
with password jdHyd6Sn21
in tablespace users
, and grant the user a minimal set of privileges. When you run the command on your machine, remember to replace the username, password and tablespace names with your own values.
CREATE USER bitbucket
IDENTIFIED BY jdHyd6Sn21
DEFAULT TABLESPACE USERS
QUOTA UNLIMITED ON USERS;
GRANT CONNECT, RESOURCE to bitbucket;
CREATE VIEW bitbucket.all_objects AS
SELECT *
FROM sys.all_objects
WHERE owner = upper('bitbucket');
This creates an empty Oracle schema with the name bitbucket
, and a user that can log in from the host that Bitbucket Server is running on and who has full access to the newly created schema. In particular, the user is allowed to create sessions and tables.
Bitbucket Server では一般に、データベース コネクションが約 25~30 必要です。最大コネクション数をシステム プロパティで構成できます。「データベース プール」を参照してください。
Bitbucket Server を Oracle データベースに接続する
次のいずれかのタイミングで Bitbucket Server を Oracle データベースに接続できるようになりました。
- インストール時にセットアップ ウィザードを実行する場合
- 埋め込みの Bitbucket Server データベースまたは別の外部データベースから Oracle に移行したい場合。
インストール時にセットアップ ウィザードを実行する場合
- "Database" 手順で [External] を選択します。
- [Database Type] で [Oracle] を選択します。
- フォームに入力します。詳細は、以下の表を参照してください。
- [Next] をクリックし、Bitbucket Server のセットアップ ウィザードの手順に従います。
Oracle に移行する場合
- Bitbucket Server の管理領域で、[設定] 配下の [データベース] をクリックします。
- [データベースの移行] をクリックします。
- [Database Type] で [Oracle] を選択します。
- フォームに入力します。詳細は、以下の表を参照してください。
- [移行の開始] をクリックします。
ホスト名
データベース サーバーを実行するコンピューターのホスト名または IP アドレス。
ポート
Bitbucket Server がデータベース サーバーに接続できる TCP ポート。既定値は、MySQL または MariaDB が実行される既定のポートです。MySQL または MariaDB インスタンスが使用しているポートを確認済みの場合は変更できます。
データベース名
Bitbucket Server が接続するデータベースの名前。
データベース ユーザー名
Bitbucket Server がデータベースへのアクセスに使用するユーザー名。
データベース パスワード
Bitbucket Server がデータベースへのアクセスに使用するパスワード。