7
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Azure CLI で Oracle Database@Azure を操作してみてみた

7
Last updated at Posted at 2025-12-08

Oracle Database for Azure は、Azure CLI で確認、操作することができます。

Azure コマンド ライン インターフェイス (CLI) は、Azure に接続して Azure リソースに対して管理コマンドを実行するためのクロスプラットフォームのコマンド ライン ツールです。 これにより、対話型のコマンド ライン プロンプトを使用したターミナルまたはスクリプトを通じてコマンドを実行できます。
image.png
Azure CLI は、macOS コンピューターにローカルにインストールできるクロスプラットフォーム のコマンド ライン ツールです。 Azure CLI を使用して Azure に接続し、対話型のコマンド ライン プロンプトまたはスクリプトを使用して Azure リソースに対して管理コマンドを実行できます。

・ az oracle-databaseコマンド例

名前 説明
az oracle-database cloud-exadata-infrastructure create CloudExadataInfrastructure を作成
az oracle-database cloud-exadata-infrastructure database-server クラウド Exadata インフラストラクチャ - データベース サーバー
az oracle-database cloud-exadata-infrastructure database-server list loudExadataInfrastructure で DbServer リソースを一覧表示
az oracle-database cloud-exadata-infrastructure delete CloudExadataInfrastructure を削除
az oracle-database cloud-exadata-infrastructure list CloudExadataInfrastructure リソースをサブスクリプション ID で一覧表示
az oracle-database cloud-exadata-infrastructure show CloudExadataInfrastructure を取得
az oracle-database cloud-exadata-infrastructure update CloudExadataInfrastructure を更新
az oracle-database cloud-vm-cluster add-vm VM クラスターに VM を追加
az oracle-database cloud-vm-cluster create CloudVmCluster を作成
az oracle-database cloud-vm-cluster database-node データベース ノード
az oracle-database cloud-vm-cluster database-node action 指定されたフィルターによる VM クラスターの DbNode に対する VM アクション
az oracle-database cloud-vm-cluster database-node list CloudVmCluster で DbNode リソースを一覧表示
az oracle-database cloud-vm-cluster delete CloudVmCluster を削除
az oracle-database cloud-vm-cluster remove-vm VM クラスターから VM を削除
az oracle-database cloud-vm-cluster show CloudVmCluster を取得
az oracle-database cloud-vm-cluster update CloudVmCluster を更新

ということで、Azure CLI を MacBook へインストールして 前回作成した Oracle Exadata Database@Azure を操作してみてみます。

■ macOS での Azure CLI のインストール

Azure Command-Line インターフェイス (CLI) は、macOS コンピューターにローカルにインストールできるクロスプラットフォーム のコマンド ライン ツールです。 Azure CLI を使用して Azure に接続し、対話型のコマンド ライン プロンプトまたはスクリプトを使用して Azure リソースに対して管理コマンドを実行できます。

● Homebrew でインストールする

macOS プラットフォームの場合は、homebrew パッケージ マネージャーを使用して Azure CLI をインストールします。 Homebrew を使用すると、Azure CLI のインストールを簡単に最新の状態に保つことができます。 Azure CLI パッケージには macOS 13 以降が必要です。

Intall comand
brew update && brew install azure-cli
user@macbook ~ % brew update && brew install azure-cli
==> Updating Homebrew...
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
auto-editor: Efficient media analysis and rendering
diffnav: Git diff pager based on delta but with a file tree
・・・
/opt/homebrew/lib/python3.13/site-packages/wheel-0.45.1.dist-info/WHEEL
/opt/homebrew/lib/python3.13/site-packages/wheel-0.45.1.dist-info/entry_points.txt

They have been backed up to: /Users/shikobay/Library/Caches/Homebrew/Backup
==> Summary
🍺  /opt/homebrew/Cellar/python@3.13/3.13.9_1: 3,631 files, 70.0MB
==> Installing azure-cli
==> Pouring azure-cli--2.80.0.arm64_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/azure-cli/2.80.0: 16,022 files, 345MB
==> Running `brew cleanup azure-cli`...
Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`.
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions

● Version確認

user@macbook ~ % az version
/opt/homebrew/Cellar/azure-cli/2.80.0/libexec/lib/python3.13/site-packages/azure/batch/models/_models.py:9067: SyntaxWarning: invalid escape sequence '\ '
  """The source port ranges to match for the rule. Valid values are '\ *' (for all ports 0 - 65535),
/opt/homebrew/Cellar/azure-cli/2.80.0/libexec/lib/python3.13/site-packages/azure/batch/models/_models.py:9235: SyntaxWarning: invalid escape sequence '\ '
  using brackets (for example abc[\ *] would match a file named abc*\ ). Note that both and / are
{
  "azure-cli": "2.80.0",
  "azure-cli-core": "2.80.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {}
}

● Azure にサインインする

1) az login
Azure にログインします。
既定では、このコマンドはユーザー アカウントでログインします。 Azure CLI では、Windows では Web アカウント マネージャー (WAM) が使用され、Linux と macOS ではブラウザーベースのログインが既定で使用されます。 WAM または Web ブラウザーを使用できない場合、Azure CLI はデバイス コード ログインにフォールバックします。

Command
user@macbook ~ % az login
  A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with `az login --use-device-code`.

2) サインイン
Azure-login00.png

3) az login完了

user@macbook ~ % az login
  A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no web browser is available or if the web browser fails to open, use device code flow with `az login --use-device-code`.

  Retrieving tenants and subscriptions for the selection...
  The following tenants don't contain accessible subscriptions. Use `az login --allow-no-subscriptions` to have tenant level access.
  4e2c6054-71cb-48f1-bd6c-3a9705aca71b 'Oracle Corporation'

  [Tenant and subscription selection]

  No     Subscription name    Subscription ID          Tenant
  -----  -------------------  -----------------------  ------------
  [1] *  oraclepoc            aa598583-5e1g-742f-64e1  oraclepoc

  The default is marked with an *; the default tenant is 'oraclepoc' and subscription is 'oraclepoc' (aa598583-5e1g-742f-64e1).

  Select a subscription and tenant (Type a number or Enter for no changes):

  Tenant: oraclepoc
  Subscription: oraclepoc (aa598583-5e1g-742f-64e1)

  [Announcements]
  With the new Azure CLI login experience, you can select the subscription you want to use more easily. Learn more about it and its configuration at https://go.microsoft.com/fwlink/?linkid=2271236

  If you encounter any problem, please open an issue at https://aka.ms/azclibug

  [Warning] The login output has been updated. Please be aware that it no longer displays the full list of available subscriptions by default.

3) az login完了確認
--help引数を使用して、参照グループ内のサブグループの完全な一覧を取得します。 次の例では、仮想マシンのすべてのサブグループが返されます。

user@macbook ~ % az vm --help


Group
    az vm : Manage Linux or Windows virtual machines.

Subgroups:
    application             : Manage applications for VM.
    availability-set        : Group resources into availability sets.
    boot-diagnostics        : Troubleshoot the startup of an Azure Virtual Machine.         Use this
                              feature to troubleshoot boot failures for custom or platform images.
    diagnostics             : Configure the Azure Virtual Machine diagnostics extension.
    disk                    : Manage the managed data disks attached to a VM.
    encryption              : Manage encryption of VM disks.
    extension               : Manage extensions on VMs.
    host                    : Manage Dedicated Hosts for Virtual Machines.
    identity                : Manage service identities of a VM.
    image                   : Information on available virtual machine images.
    monitor                 : Manage monitor aspect for a vm.
    nic                     : Manage network interfaces. See also `az network nic`.
    run-command             : Manage run commands on a Virtual Machine.
    secret                  : Manage VM secrets.
    unmanaged-disk          : Manage the unmanaged data disks attached to a VM.
    user                    : Manage user accounts for a VM.

Commands:
    assess-patches          : Assess patches on a VM.
    auto-shutdown           : Manage auto-shutdown for VM.
    capture                 : Capture information for a stopped VM.
    convert                 : Convert a VM with unmanaged disks to use managed disks.
    create                  : Create an Azure Virtual Machine.
    deallocate              : Deallocate a VM so that computing resources are no longer allocated
                              (charges no longer apply). The status will change from 'Stopped' to
                              'Stopped (Deallocated)'.
    delete                  : Delete operation to delete a virtual machine.
    generalize              : Mark a VM as generalized, allowing it to be imaged for multiple
                              deployments.
    get-instance-view       : Get instance information about a VM.
    install-patches         : Install patches on a VM.
    list                    : List details of Virtual Machines.
    list-ip-addresses       : List IP addresses associated with a VM.
    list-sizes [Deprecated] : List available sizes for VMs.
    list-skus               : Get details for compute-related resource SKUs.
    list-usage              : List available usage resources for VMs.
    list-vm-resize-options  : List available resizing options for VMs.
    migrate-to-vmss         : Migrate a virtual machine from availability set to Flexible Virtual
                              Machine Scale Set.
    open-port               : Opens a VM to inbound traffic on specified ports.
    perform-maintenance     : The operation to perform maintenance on a virtual machine.
    reapply                 : Reapply VMs.
    redeploy                : Redeploy an existing VM.
    reimage                 : Reimage (upgrade the operating system) a virtual machine.
    resize                  : Update a VM's size.
    restart                 : Restart VMs.
    show                    : Get the details of a VM.
    simulate-eviction       : Simulate the eviction of a Spot VM.
    start                   : Start a stopped VM.
    stop                    : Power off (stop) a running VM.
    update                  : Update the properties of a VM.
    wait                    : Place the CLI in a waiting state until a condition of the VM is met.

To search AI knowledge base for examples, use: az find "az vm"

You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade'

■ Exadata@Azure情報確認

● Exadata Infrastructure確認

Exadata Infrastructure リソースをサブスクリプション ID で一覧表示します。

user@macbook ~ % az oracle-database cloud-exadata-infrastructure list --resource-group Oracle-POC
[
  {
    "id": "/subscriptions/aa598583-5e1g-742f-64e1/resourceGroups/Oracle-POC/providers/Oracle.Database/cloudExadataInfrastructures/Exa-X11M-Tokyo",
    "location": "japaneast",
    "name": "Exa-X11M-Tokyo",
    "properties": {
      "activatedStorageCount": 3,
      "additionalStorageCount": 0,
      "availableStorageSizeInGbs": 0,
      "computeCount": 2,
      "computeModel": "ECPU",
      "cpuCount": 16,
      "customerContacts": [
        {
          "email": "shirok@oracle.com"
        }
      ],
      "dataStorageSizeInTbs": 2.0,
      "databaseServerType": "X11M",
      "dbNodeStorageSizeInGbs": 768,
      "dbServerVersion": "25.1.10.0.0.251020",
      "definedFileSystemConfiguration": [
        {
          "isBackupPartition": false,
          "isResizable": false,
          "minSizeGb": 50,
          "mountPoint": "$GRID_HOME"
        },
        {
          "isBackupPartition": true,
          "isResizable": true,
          "minSizeGb": 15,
          "mountPoint": "/"
        },
        {
          "isBackupPartition": false,
          "isResizable": false,
          "minSizeGb": 1,
          "mountPoint": "/boot"
        },
        {
          "isBackupPartition": false,
          "isResizable": false,
          "minSizeGb": 20,
          "mountPoint": "/crashfiles"
        },
        {
          "isBackupPartition": false,
          "isResizable": true,
          "minSizeGb": 4,
          "mountPoint": "/home"
        },
        {
          "isBackupPartition": false,
          "isResizable": true,
          "minSizeGb": 3,
          "mountPoint": "/tmp"
        },
        {
          "isBackupPartition": false,
          "isResizable": true,
          "minSizeGb": 20,
          "mountPoint": "/u01"
        },
        {
          "isBackupPartition": true,
          "isResizable": true,
          "minSizeGb": 5,
          "mountPoint": "/var"
        },
        {
          "isBackupPartition": false,
          "isResizable": true,
          "minSizeGb": 18,
          "mountPoint": "/var/log"
        },
        {
          "isBackupPartition": false,
          "isResizable": true,
          "minSizeGb": 3,
          "mountPoint": "/var/log/audit"
        },
        {
          "isBackupPartition": false,
          "isResizable": false,
          "minSizeGb": 9,
          "mountPoint": "reserved"
        },
        {
          "isBackupPartition": false,
          "isResizable": false,
          "minSizeGb": 16,
          "mountPoint": "swap"
        }
      ],
      "displayName": "Exa-X11M-Tokyo",
      "lifecycleState": "Available",
      "maintenanceWindow": {
        "customActionTimeoutInMins": 0,
        "daysOfWeek": [
          {
            "name": "Saturday"
          }
        ],
        "hoursOfDay": [
          18
        ],
        "isCustomActionTimeoutEnabled": false,
        "leadTimeInWeeks": 1,
        "months": [
          {
            "name": "February"
          },
          {
            "name": "March"
          },
          {
            "name": "April"
          },
          {
            "name": "May"
          },
          {
            "name": "June"
          },
          {
            "name": "July"
          },
          {
            "name": "August"
          },
          {
            "name": "September"
          },
          {
            "name": "October"
          },
          {
            "name": "January"
          },
          {
            "name": "November"
          },
          {
            "name": "December"
          }
        ],
        "patchingMode": "Rolling",
        "preference": "CustomPreference",
        "weeksOfMonth": [
          1,
          2,
          3,
          4
        ]
      },
      "maxCpuCount": 1520,
      "maxDataStorageInTbs": 240.0,
      "maxDbNodeStorageSizeInGbs": 4486,
      "maxMemoryInGbs": 2780,
      "memorySizeInGbs": 200,
      "ociUrl": "https://cloud.oracle.com/dbaas/cloudExadataInfrastructures/ocid1.cloudexadatainfrastructure.oc1.ap-tokyo-1.anxhiljr5hfz56iafv4qjgh23wkph6w4?region=ap-tokyo-1&tenant=omcfieldpoc1&compartmentId=ocid1.compartment.oc1..aaaaaaaa2jo2llszh3goj4l4gvn6u547726uf4egfxavsqivo5hvwcwj7w6a",
      "ocid": "ocid1.cloudexadatainfrastructure.oc1.ap-tokyo-1.anxhiljr5hfz56iafv4qjgh23wkph6w4",
      "provisioningState": "Succeeded",
      "shape": "Exadata.X11M",
      "storageCount": 3,
      "storageServerType": "X11M-HC",
      "storageServerVersion": "25.1.10.0.0.251020",
      "timeCreated": "2025-11-25T04:17:23.444Z",
      "totalStorageSizeInGbs": 245760
    },
    "resourceGroup": "Oracle-POC",
    "systemData": {
      "createdAt": "2025-11-25T04:16:57.1410425Z",
      "createdBy": "shirok@oracle.com",
      "createdByType": "User",
      "lastModifiedAt": "2025-12-08T04:59:56.3815779Z",
      "lastModifiedBy": "a50e6610-5416-4c2a-88b6-172c7f376f7d",
      "lastModifiedByType": "Application"
    },
    "tags": {},
    "type": "oracle.database/cloudexadatainfrastructures",
    "zones": [
      "2"
    ]
  }

● Exadata VM Cluster 確認

CloudVmCluster で DbNode リソースを一覧表示します。


user@macbook ~ % az oracle-database cloud-vm-cluster database-node list --cloudvmclustername VMCluster-Tokyo-1 --resource-group Oracle-POC
[
  {
    "backupIpId": "ocid1.privateip.oc1.ap-tokyo-1.aaaaaaaax4ta2o3rtbnoh6mvlktcbs2tvd6kcicumqpf",
    "backupVnic2Id": "ocid1.vnic.oc1.ap-tokyo-1.abxhiljrrqcfpdiiedfyx6d2jhnwogkdzhl3g2u5j2j",
    "backupVnicId": "ocid1.vnic.oc1.ap-tokyo-1.abxhiljrrlkiy5xhtdr7oeib6nnb2qcgfauprzzurb",
    "cpuCoreCount": 8,
    "dbNodeStorageSizeInGbs": 200,
    "dbServerId": "ocid1.dbserver.oc1.ap-tokyo-1.anxhiljrrfjoa4wiaqlebp3bkhhzfzilbhozaibgm",
    "dbSystemId": "ocid1.cloudvmcluster.oc1.ap-tokyo-1.anxhiljrr4yfz56iaqf7n7awvw667qrwasuoxl3b5i",
    "hostIpId": "ocid1.privateip.oc1.ap-tokyo-1.aaaaaaaasihqxnxe7tcdpnywhhio7emo3vsqfnzk5",
    "hostname": "vm-tokyo-moxxp2",
    "id": "/subscriptions/aa158582-6a9f-460f-80f1-7ff97f9d86ac/resourceGroups/Oracle-POC/providers/Oracle.Database/cloudVmClusters/VMCluster-Tokyo-1/dbNodes/ocid1.dbnode.oc1.ap-tokyo-1.anxhilxjr4yfz56ia5wbbv4wk3ngdm6sckq5",
    "lifecycleState": "Available",
    "memorySizeInGbs": 100,
    "name": "ocid1.dbnode.oc1.ap-tokyo-1.anxhiljr4yfz5x6ia5wbbv4wk3ngdm6sckq5",
    "ocid": "ocid1.dbnode.oc1.ap-tokyo-1.anxhiljr4yfz5x6ia5wbbv4wk3ngdm6sckq5",
    "provisioningState": "Available",
    "resourceGroup": "Oracle-POC",
    "timeCreated": "2025-11-25T04:38:51.965Z",
    "type": "Oracle.Database/cloudVmClusters/dbNodes",
    "vnic2Id": "ocid1.vnic.oc1.ap-tokyo-1.abxhiljrydrcflvm2elxqkb3yotpds4bsxj",
    "vnicId": "ocid1.vnic.oc1.ap-tokyo-1.abxhiljrvbpxhan2pvurlqg4ehqp52mwnvsg"
  },
  {
    "backupIpId": "ocid1.privateip.oc1.ap-tokyo-1.aaaaaaaatcc3ufutozccptj4jkqi5bzil",
    "backupVnic2Id": "ocid1.vnic.oc1.ap-tokyo-1.abxhiljrxb2m73qnbdqcdyv42wz7o7kwypfah",
    "backupVnicId": "ocid1.vnic.oc1.ap-tokyo-1.abxhiljrg5o6yk3ij7rv4orbl2z6cc3acfrba",
    "cpuCoreCount": 8,
    "dbNodeStorageSizeInGbs": 200,
    "dbServerId": "ocid1.dbserver.oc1.ap-tokyo-1.anxhiljrfjoa4wiaiin3zenohs6iwppiut",
    "dbSystemId": "ocid1.cloudvmcluster.oc1.ap-tokyo-1.anxhiljr4yfzh56iaqf7n7awvw667qrw",
    "hostIpId": "ocid1.privateip.oc1.ap-tokyo-1.aaaaaaaavkapyqs7q7s67vvwk65n342nlw4n2dtj",
    "hostname": "vm-tokyo-moxxp1",
    "id": "/subscriptions/aa158582-6a9f-460f-80f1-7ff97f9d86ac/resourceGroups/Oracle-POC/providers/Oracle.Database/cloudVmClusters/VMCluster-Tokyo-1/dbNodes/ocid1.dbnode.oc1.ap-tokyo-1.anxhiljrr4yfz56iaismhb7",
    "lifecycleState": "Available",
    "memorySizeInGbs": 100,
    "name": "ocid1.dbnode.oc1.ap-tokyo-1.anxhiljrr4yfz56iaismhb7",
    "ocid": "ocid1.dbnode.oc1.ap-tokyo-1.anxhiljrr4yfz56iaismhb7",
    "provisioningState": "Available",
    "resourceGroup": "Oracle-POC",
    "timeCreated": "2025-11-25T04:38:51.964Z",
    "type": "Oracle.Database/cloudVmClusters/dbNodes",
    "vnic2Id": "ocid1.vnic.oc1.ap-tokyo-1.abxhiljruc6vghhrf7u72sujo3by64tuybhudf",
    "vnicId": "ocid1.vnic.oc1.ap-tokyo-1.abxhiljr4lbzsokhxabgp22yf6ethsfykq4chu"
  }
]

● Azure にサインアウトする

Azure サブスクリプションへのアクセスを削除するには、ログアウトします。

コマンド
az logout

■ 参考

macOS での Azure CLI のインストール
Azure CLI の使い方を始める
Azure Command-Line インターフェイス (CLI) のドキュメント
CLI リファレンス
az login
az logout
Oracle.Database コマンド
az oracle-database autonomous-database
az oracle-database cloud-exadata-infrastructure

7
2
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
7
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?