LoginSignup
2
0

Autonomous Database:Autonomous Data Guardのスタンバイ・データベースを別のテナンシに作成してみた

Posted at

はじめに

Autonomous Databaseの機能強化で、Autonomous Databaseのスタンバイ・データベースをプライマリのAutonomous Databaseがあるテナンシとは別のテナンシに作成すること(クロステナンシAutonomous Data Guardスタンバイ)ができるようになったので、早速試してみました。

この機能強化により、異なるテナンシにあるスタンバイ・データベースへのフェイルオーバー、スイッチオーバーが可能になります。
ま、Autonomos Databaseを他のテナンシに移行する際にも、こちらの機能を利用可能です。

1.プライマリ側のポリシーの設定

プライマリとなるAutonomous Databaseが存在するテナンシのrootコンパートメントに以下のポリシーを設定します。

ここではプライマリが存在するテナンシ内の特定のコンパートメントに属するAutonomous Databaseの読み取りを、スタンバイを作成するテナンシ内の特定のグループに許可しています。

define tenancy RemoteTenancy as ocid1.tenancy.oc1..axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxa(スタンバイを作成するテナンシのOCID)
define group RemoteTenancyGroup as ocid1.group.oc1..axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgwa(スタンバイを作成するテナンシ内にある、スタンバイの作成/操作を許可するグループのOCID)
admit group RemoteTenancyGroup of tenancy RemoteTenancy to read autonomous-databases in compartment id ocid1.compartment.oc1..axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxdkq(プライマリのAutonomous Databaseが属するコンパートメントのOCID)

2.スタンバイ側のポリシーの設定

Autonomous Data Guardのスタンバイを作成するテナンシのrootコンパートメントに以下のポリシーを設定します。

ここではスタンバイを作成するテナンシにあるグループCrossTenancyAuDG_Groupに対して、プライマリのテナンシのAutonomous Databaseの読み取り、およびスタンバイを作成するテナンシ内のコンパートメントCrossTenancyAuDG_Test内のAutonomous Databaseの管理を許可しています。

Define tenancy PrimaryTenancy as ocid1.tenancy.oc1..aaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxuca(プライマリとなるAutonomous Databaseが存在するテナンシのOCID)
Endorse group CrossTenancyAuDG_Group to read autonomous-databases in tenancy PrimaryTenancy
Allow group CrossTenancyAuDG_Group to manage autonomous-databases in compartment CrossTenancyAuDG_Test

3.クロステナンシのAutonomous Data Guardスタンバイの作成

必要なポリシーの設定が完了したので、OCI CLIを使用して、異なるテナンシにあるAutonomous Database のスタンバイデータベースを作成します。

異なるテナンシにあるAutonomous Database のスタンバイデータベースの作成は、OCI CLIまたはAPIから実施する必要があります。
(コンソールからは作成できません)

異なるテナンシにあるAutonomous Database のスタンバイデータベースを作成するには、以下のコマンドを使用します。

oci db autonomous-database create-cross-tenancy-disaster-recovery-details 

必須のオプションは以下の通りです。

オプション 指定する値
--compartment-id スタンバイを作成するコンパートメントのOCID
--source-id プライマリとなるAutonomous DatabaseのOCID
--disaster-recovery-type DRのタイプ(Autonomous Data Guardのスタンバイ作成時は"ADG")

最小限の必須オプションのみを指定する場合のコマンドは以下のようになります

oci db autonomous-database create-cross-tenancy-disaster-recovery-details --compartment-id ocid1.compartment.oc1..aaaxxxxxxxxxxxxxxxyia --source-id ocid1.autonomousdatabase.oc1.ap-tokyo-1.anxxxxxxxxxxxxxxxxs6a --disaster-recovery-type ADG

スタンバイを作成するテナンシのCrossTenancyAuDG_Groupに属するユーザとして、最小限の必須オプションのみを指定してコマンドを実行してみます。

user@mac ~ % ooci db autonomous-database create-cross-tenancy-disaster-recovery-details --compartment-id ocid1.compartment.oc1..aaaxxxxxxxxxxxxxxxyia --source-id ocid1.autonomousdatabase.oc1.ap-tokyo-1.anxxxxxxxxxxxxxxxxs6a --disaster-recovery-type ADG
{
  "data": {
    "actual-used-data-storage-size-in-tbs": null,
    "allocated-storage-size-in-tbs": null,
    "apex-details": null,
    "are-primary-whitelisted-ips-used": null,
    "auto-refresh-frequency-in-seconds": null,
    "auto-refresh-point-lag-in-seconds": null,
    "autonomous-container-database-id": null,
    "autonomous-maintenance-schedule-type": "REGULAR",
    "available-upgrade-versions": null,
    "backup-config": {
      "manual-backup-bucket-name": null,
      "manual-backup-type": "NONE"
    },
    "backup-retention-period-in-days": 60,
    "character-set": "AL32UTF8",
    "compartment-id": "ocid1.compartment.oc1..aaaxxxxxxxxxxyia",
    "compute-count": 2.0,
    "compute-model": "ECPU",
    "connection-strings": {
      "all-connection-strings": null,
      "dedicated": null,
      "high": null,
      "low": null,
      "medium": null,
      "profiles": null
    },
    "connection-urls": {
      "apex-url": null,
      "database-transforms-url": null,
      "graph-studio-url": null,
      "machine-learning-notebook-url": null,
      "machine-learning-user-management-url": null,
      "mongo-db-url": null,
      "ords-url": null,
      "sql-dev-web-url": null
    },
    "cpu-core-count": 0,
    "customer-contacts": [
      {
        "email": "kaoru.yamakawa@oracle.com"
      }
    ],
    "data-safe-status": "NOT_REGISTERED",
    "data-storage-size-in-gbs": 50,
    "data-storage-size-in-tbs": null,
    "database-edition": "ENTERPRISE_EDITION",
    "database-management-status": null,
    "dataguard-region-type": "REMOTE_STANDBY_DG_REGION",
    "db-name": "sourceatp",
    "db-tools-details": [
      {
        "compute-count": null,
        "is-enabled": true,
        "max-idle-time-in-minutes": null,
        "name": "APEX"
      },
      {
        "compute-count": 2.0,
        "is-enabled": true,
        "max-idle-time-in-minutes": 10,
        "name": "DATA_TRANSFORMS"
      },
      {
        "compute-count": null,
        "is-enabled": true,
        "max-idle-time-in-minutes": null,
        "name": "DATABASE_ACTIONS"
      },
      {
        "compute-count": 2.0,
        "is-enabled": true,
        "max-idle-time-in-minutes": 240,
        "name": "GRAPH_STUDIO"
      },
      {
        "compute-count": null,
        "is-enabled": false,
        "max-idle-time-in-minutes": null,
        "name": "MONGODB_API"
      },
      {
        "compute-count": 2.0,
        "is-enabled": true,
        "max-idle-time-in-minutes": 60,
        "name": "OML"
      },
      {
        "compute-count": null,
        "is-enabled": true,
        "max-idle-time-in-minutes": null,
        "name": "ORDS"
      }
    ],
    "db-version": "19c",
    "db-workload": "OLTP",
    "defined-tags": {},
    "disaster-recovery-region-type": "REMOTE",
    "display-name": "SourceATP_NRT",
    "failed-data-recovery-in-seconds": null,
    "freeform-tags": {},
    "id": "ocid1.autonomousdatabase.oc1.ap-tokyo-1.anxxxxxxxxxxxjza",
    "in-memory-area-in-gbs": null,
    "in-memory-percentage": null,
    "infrastructure-type": null,
    "is-access-control-enabled": null,
    "is-auto-scaling-enabled": false,
    "is-auto-scaling-for-storage-enabled": true,
    "is-data-guard-enabled": false,
    "is-dedicated": false,
    "is-dev-tier": null,
    "is-free-tier": false,
    "is-local-data-guard-enabled": false,
    "is-mtls-connection-required": false,
    "is-preview": false,
    "is-reconnect-clone-enabled": null,
    "is-refreshable-clone": null,
    "is-remote-data-guard-enabled": false,
    "key-history-entry": null,
    "key-store-id": null,
    "key-store-wallet-name": null,
    "kms-key-id": "ORACLE_MANAGED_KEY",
    "kms-key-lifecycle-details": null,
    "kms-key-version-id": null,
    "license-model": "BRING_YOUR_OWN_LICENSE",
    "lifecycle-details": null,
    "lifecycle-state": "PROVISIONING",
    "local-adg-auto-failover-max-data-loss-limit": null,
    "local-disaster-recovery-type": "BACKUP_BASED",
    "local-standby-db": null,
    "long-term-backup-schedule": null,
    "memory-per-oracle-compute-unit-in-gbs": null,
    "ncharacter-set": "AL16UTF16",
    "net-services-architecture": null,
    "next-long-term-backup-time-stamp": null,
    "nsg-ids": null,
    "ocpu-count": null,
    "open-mode": null,
    "operations-insights-status": "NOT_ENABLED",
    "peer-db-ids": [
      "ocid1.autonomousdatabase.oc1.ap-tokyo-1.anxxxxxxxxxxxs6a"
    ],
    "permission-level": null,
    "private-endpoint": null,
    "private-endpoint-ip": null,
    "private-endpoint-label": null,
    "provisionable-cpus": null,
    "refreshable-mode": null,
    "refreshable-status": null,
    "remote-disaster-recovery-configuration": {
      "disaster-recovery-type": "ADG",
      "is-replicate-automatic-backups": null,
      "is-snapshot-standby": null,
      "time-snapshot-standby-enabled-till": null
    },
    "resource-pool-leader-id": null,
    "resource-pool-summary": {
      "is-disabled": true,
      "pool-size": null
    },
    "role": "STANDBY",
    "scheduled-operations": null,
    "service-console-url": null,
    "source-id": "ocid1.autonomousdatabase.oc1.ap-tokyo-1.anxxxxxxxxxxxs6a",
    "standby-db": null,
    "standby-whitelisted-ips": null,
    "subnet-id": null,
    "supported-regions-to-clone-to": null,
    "system-tags": {},
    "time-created": "2024-06-05T04:57:00.123000+00:00",
    "time-data-guard-role-changed": null,
    "time-deletion-of-free-autonomous-database": null,
    "time-disaster-recovery-role-changed": null,
    "time-local-data-guard-enabled": null,
    "time-maintenance-begin": null,
    "time-maintenance-end": null,
    "time-of-auto-refresh-start": null,
    "time-of-joining-resource-pool": null,
    "time-of-last-failover": null,
    "time-of-last-refresh": null,
    "time-of-last-refresh-point": null,
    "time-of-last-switchover": null,
    "time-of-next-refresh": null,
    "time-reclamation-of-free-autonomous-database": null,
    "time-until-reconnect-clone-enabled": null,
    "total-backup-storage-size-in-gbs": null,
    "used-data-storage-size-in-gbs": null,
    "used-data-storage-size-in-tbs": null,
    "vault-id": null,
    "whitelisted-ips": [
      "0.0.0.0/0"
    ]
  },
  "etag": "f2a333f",
  "opc-work-request-id": "ocid1.coreservicesworkrequest.oc1.ap-tokyo-1.abxxxxxxxxxxx56q"
}
userw@mac ~ % 

コマンドが問題なく実行されました。

スタンバイ側のテナンシのスタンバイを作成したコンパートメント内のAutonomous Databaseをリストをコンソールで確認します。

スクリーンショット 2024-06-05 13.58.05.png
他のテナンシにあるAutonomous Databaseのスタンバイ・データベースのプロビジョニングが開始されたことが確認できました。

スタンバイの詳細画面を確認します。

スクリーンショット 2024-06-05 13.59.44.png

しばらく待つと、ステイタスが「STANDBY」に変わり、別のテナンシにあるAutonomous Databaseのスタンバイ・データベースが無事作成できたことが確認できました。

スクリーンショット 2024-06-05 14.06.25.png

参考情報

Use a Cross Tenancy Autonomous Data Guard Standby Database
Cross-Tenancy Policies
OCI CLI Command Reference : oci db autonomous-database create-cross-tenancy-disaster-recovery-details

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0