3
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?

OCIのBaseDBをGoogle CloudのEM Expressからクロスクラウド経由で管理する

Posted at

はじめに

Google CloudとOCIを接続し、OCIのデータベース(BaseDB)へアクセスを行うことが可能です。

クロスクラウド接続の場合には基本的にインスタンスなどは各クラウドで管理する必要があります。
OCI上のBaseDBだけ利用したい、という場合にわざわざ両方のコンソールで管理したりするのは大変だな、という事で、Oracle DatabaseのWebベースの管理ツール、Enterprise Manager Express(以下、EM Express)を利用してGoogle Cloudから管理すると良いのではないか、という事でやってみました。

EM Expressの準備

OCI上のBaseDBでEM Expressを利用できるように準備する必要があります。
基本的には流れは次のリンクのとおりです。

1.EM Expressのコンソールを有効化

BaseDBのCDBに接続し、次のコマンドを実行してポートの設定を行います。
5500番ポートを指定しています。

$ sqlplus '/as sysdba'

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Sep 21 16:27:46 2024
Version 19.24.0.0.0

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

Connected to:
Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production
Version 19.24.0.0.0

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> exec DBMS_XDB_CONFIG.SETHTTPSPORT(5500);
PL/SQL procedure successfully completed. 

SQL> select dbms_xdb_config.getHttpsPort() from dual; 
DBMS_XDB_CONFIG.GETHTTPSPORT() 
------------------------------ 
                          5500
                          
SQL> !lsnrctl status | grep HTTP
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=emtest.xxxxxxxx.xxxxxxxxx.oraclevcn.com)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/19.0.0/dbhome_1/admin/EMTEST_xxx_xxx/xdb_wallet))(Presentation=HTTP)(Session=RAW))

2.BaseDBのiptablesの設定

BaseDBのOSのポートもOpenしてあげる必要があります。

# iptables-save > /tmp/iptables.orig
# iptables -I INPUT 8 -p tcp -m state --state NEW -m tcp --dport 5500 -j ACCEPT -m comment --comment "Required for EM Express."
# service iptables status
Redirecting to /bin/systemctl status iptables.service
● iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
   Active: active (exited) since Sat 2024-09-21 12:08:41 JST; 2h 34min ago
  Process: 1558 ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=0/SUCCESS)
 Main PID: 1558 (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 99933)
   Memory: 0B
   CGroup: /system.slice/iptables.service

Sep 21 12:08:41 emtest systemd[1]: Starting IPv4 firewall with iptables...
Sep 21 12:08:41 emtest iptables.init[1558]: iptables: Applying firewall rules: [  OK  ]
Sep 21 12:08:41 emtest systemd[1]: Started IPv4 firewall with iptables.
# 
# cat /etc/sysconfig/iptables | grep 5500
-A INPUT -p tcp -m state --state NEW -m tcp --dport 5500 -m comment --comment "Required for EM Express." -j ACCEPT
# 
# /sbin/service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]

3.PDB用のポート設定

CDB/PDB構成となるため、PDBでも同一のポートで管理できるように設定します。

SQL> exec dbms_xdb_config.setglobalportenabled(TRUE);
PL/SQL procedure successfully completed.

4. ネットワーク接続の設定

Google Cloud側からBaseDBの 5500 ポートへのアクセスを許可するようセキュリティリストもしくはネットワークセキュリティグループ(以下、NSG)を設定します。
今回はNSGでGoogle Cloud側のセグメントをそのまま許可します。

image.png

接続元のGoogle Cloud側のインスタンスは次になります。

image.png

EM Express からの接続

Google Cloud側のインスタンスからブラウザを起動し、「BaseDBのIPアドレス:5500」にアクセスします。

image.png

sysユーザでCDB$ROOTにアクセスします。

image.png

ログインするとリソースやストレージの管理ができます。

image.png

まとめ

無事Google Cloud側からOCI BaseDBのEM Expressに接続して管理を行うことができました!
これでOCI側のコンソールに入らなくてもデータベースの管理ができますね、めでたしめでたし・・・といきたいところでしたが、実はEM Expressは19c(正確には21c)でサポート終了しており、23aiでは利用できません。。
また、EM Express自体の機能も色々と経緯があり機能縮小されているのでこれで管理、というのはちょっと難しそうです。

Enterprise Managerには有償のCloud Controlもあり、そちらなら高度な管理ができそうなので、次回試してみます。。

3
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
3
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?