9
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

プライベート・エンドポイント構成のAutonomous AI Databaseにお金と手間をかけずにSQL*Plusから接続する

9
Last updated at Posted at 2025-12-17

はじめに

Public Offerやオンボーディング時にOCIテナンシを新規に作成したOracle Database@Azure環境やOracle Database@Google Cloudの環境では、追加のユニバーサル・クレジット契約を行わないとOCI側にComputeインスタンス等の有償リソースの作成ができません。

そこで、Computeインスタンス等を作成せずに、SQL*Plusを使用してAutonomous AI Databaseに接続できる方法があれば便利かと思い、OCIコンソールのCloud ShellからSQL*Plusを使用してAutonomous AI Databaseに接続する手順を検証してみました。

こちらの手順はOracle Database@Hyperscalerの環境だけでなく、通常のOCIテナンシでももちろん利用可能です。

お金と手間をかけず、お手軽にSQL/*PlusからAutonomous AI Databaseに対して接続したい場合に便利かと思います。

注意
こちらの記事の内容はあくまで個人の実験メモ的な内容のため、こちらの内容を利用した場合のトラブルには一切責任を負いません。
また、こちらの記事の内容を元にしたOracleサポートへの問い合わせ等はご遠慮ください。

0. 前提条件

・Autonomous AI Databaseのエンドポイントがあるサブネット内のIPアドレスに空きがあること
・Autonomous AI Databaseが相互TLS(mTLS)認証不要で構成されていること
 (相互TLS認証が必須になっている場合は、ウォレットのダウンロードおよびCloud Shellへのアップロード等の追加の手順が必要になります。)

1. Autonomous AI Databaseの接続文字列の取得

OCIコンソールにサインインします。
スクリーンショット 2025-12-17 10.49.29.png

Autonomous AI Databaseの一覧画面にアクセスします。
メニュー → 「Oracle AI Database」 → 「Autonomous AI Database」

スクリーンショット 2025-12-17 10.18.54.png

Autonomous AI Databaseの名前をクリックして、Autonomous AI Databaseの詳細画面にアクセスします。
スクリーンショット 2025-12-17 10.19.14.png

Autonomous AI Databaseの詳細画面が表示されました。
スクリーンショット 2025-12-17 10.19.43.png

「データベース接続」をクリックします。
スクリーンショット 2025-12-17 10.19.43のコピー2.png

使用するTLS認証の種類(ここではウォレットを使用しないTLS接続)を選択し、接続文字列を取得します。
スクリーンショット 2025-12-17 10.36.11.png

「取り消し」をクリックします。
スクリーンショット 2025-12-17 10.56.14.png

2. ネットワーク・セキュリティ・グループ(NSG)の作成

Autonomous AI Databaseの詳細画面内の「ネットワーク」セクションにある「仮想クラウドネットワーク」のリンクをクリックします。
スクリーンショット 2025-12-17 10.20.00.png

「セキュリティ」タブをクリックします。
スクリーンショット 2025-12-17 10.20.22.png

「ネットワーク・セキュリティ・グループの作成」をクリックします。
スクリーンショット 2025-12-17 10.20.48.png

ネットワーク・セキュリティ・グループの名前ここではCloud Shell NSG)を入力し、
すべての宛先に対するすべてプロトコルのエグレス通信を許可するルールを追加します。
入力が完了したら「作成」をクリックします。
スクリーンショット 2025-12-17 10.22.04.png

ネットワーク・セキュリティ・グループ「Cloud Shell NSG」が作成されました。
スクリーンショット 2025-12-17 10.22.31.png

3. プライベート・ネットワーク定義の作成(Cloud Shell)

Cloud Shellを起動します。
スクリーンショット 2025-12-17 10.26.24.png

Cloud Shellを最大化します。
スクリーンショット 2025-12-17 10.26.51.png

Cloud Shellが最大化されました。
スクリーンショット 2025-12-17 10.27.08.png

「ネットワーク」をクリックします。
スクリーンショット 2025-12-17 10.31.39.png

「プライベート・ネットワーク定義リスト」を選択します。
スクリーンショット 2025-12-17 10.31.53.png

「プライベート・ネットワーク定義の作成」をクリックします。
スクリーンショット 2025-12-17 10.32.07.png

以下の内容を入力し、プライベート・ネットワーク定義を作成します。

・Name:プライベート・ネットワーク定義の名前(ここではADB)
・VCN:Autonomous AI Databaseが配置されているVCNを選択
・サブネット:Autonomous AI Databaseが配置されているサブネットを選択
・ネットワーク・セキュリティ・グループ:2.で作成したネットワーク・セキュリティ・グループを選択(ここでは「Cloud Shell NSG」)
・アクティブなネットワークとして使用:チェックをオン

入力が完了したら「作成」をクリックします。
スクリーンショット 2025-12-17 10.33.09.png

プライベート・ネットワーク定義「ADB」が作成されました。
「閉じる」をクリックします。
スクリーンショット 2025-12-17 10.34.44.png

ネットワークが「ADB」に変わりました。
スクリーンショット 2025-12-17 10.34.58.png

4. SQL*Plusを使用してAutonomous AI Databaseに接続

CloudShellにはSQL*Plusがインストールされているため、追加の構成なしで利用可能です。

SQL*Plusを使用して、adminユーザとしてAutonomous AI Databaseに接続します。
接続には1.で取得した接続文字列を使用します。

スクリーンショット 2025-12-17 10.41.07.png

zaku@cloudshell:~ (ap-tokyo-1)$ sqlplus admin@'(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=xxxxxxxx.adb.ap-tokyo-1.oraclecloud.com))(connect_data=(service_name=xxxxxxxxxxxxxxx_adbatazurejapaneast_medium.adb.oraclecloud.com))(security=(ssl_server_dn_match=no)))'

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 17 01:40:10 2025
Version 19.19.0.0.0

Copyright (c) 1982, 2023, Oracle.  All rights reserved.

Enter password: 
Last Successful login time: Wed Dec 17 2025 01:36:49 +00:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.29.0.1.0

SQL> 

プライベート・エンドポイント構成のAutonomous AI DatabaseにCloud Shell内のSQL*Plusから接続できることが確認できました。

めでたし、めでたし。

参考情報

クラウド・シェルのプライベート・ネットワーキング

9
4
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
9
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?