Oracle Connection Manager Demo

Architecture:

a) Set up ocm1.localdomain 192.168.56.11 as regular Linux VM [will house Oracle Client]
b) Set up ocm2.localdomain 192.168.56.12 as regular Linux VM [will house CMAN config]
c) Set up ocm3.localdomain 192.168.56.13 as host of a 19c database orclcdb/orcl

Note1: Turn off or open ports on local firewalls if present.
Note2: Ensure /etc/hosts has all machines listed if not using a DNS server. Use machine names in configs as REMOTE_LISTENER registration seems to rely on them.

OCM1 Oracle Client install

This will represent a typical Oracle client that wants to use OCM to establish a connection.

o Install Oracle client using standard methods.

o Add following to tnsnames.ora:

testproxy=
  (DESCRIPTION=
    (ADDRESS=
      (PROTOCOL=tcp)
      (HOST=ocm2.localdomain)
      (PORT=1560))
    (CONNECT_DATA=
      (SERVICE_NAME=orclpdb1)))

Install CMAN on ocm2

If preinstall required:

sudo su - yum install oracle-database-preinstall-19c.x86_64
sudo mkdir /u01/app
sudo chown oracle:oinstall /u01/app

Download here: https://www.oracle.com/database/technologies/oracle19c-linux-downloads.html
On .12 node, unzip

cd /tmp
unzip LINUX.X64_193000_client.zip
cd client
cp ./response/client_install.rsp .
vi client_install.rsp
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_HOME=/u01/app/oracle/product/19.0.0/client_1
ORACLE_BASE=/u01/app/oracle
oracle.install.client.installType=Custom
oracle.install.client.customComponents=oracle.network.cman:19.0.0.0.0
./runInstaller -silent -responseFile /tmp/client/client_install.rsp -ignoreSysPrereqs -ignorePrereq -noconfig -waitforcompletion -force -showProgress

sudo /u01/app/oraInventory/orainstRoot.sh
sudo /u01/app/oracle/product/19.0.0/client_1/root.sh

Add following to /etc/oratab:

ocm:/u01/app/oracle/product/19.0.0/client_1:N

Configure OCM:

. oraenv
ocm

cd $ORACLE_HOME/network/admin
cp ./samples/cman.ora .
vi cman.ora
cman_ocm2.localdomain =
(configuration=

  (address=(protocol=tcp)(host=ocm1.localdomain)(port=1560))

  (parameter_list =
    (connection_statistics=yes)

    # Valid values: OFF | USER | ADMIN | SUPPORT
    (log_level=USER)

    # Maximum number of connections per gateway
    # Valid values: Any positive number (Practically limited by few 1000s)
    (max_connections=256)

    (idle_timeout=0)
    (inbound_connect_timeout=0)
    (session_timeout=0)
    (outbound_connect_timeout=0)

    (min_gateway_processes=2)
    (max_gateway_processes=16)

    (remote_admin=off)

    (event_group=init_and_term,memory_ops)
    (VALID_NODE_CHECKING_REGISTRATION=OFF)
#    (REGISTRATION_INVITED_NODES=orclpdb.localdomain)

  )

  # Rule list
  (rule_list=
    (rule=
       (src=*)(dst=*)(srv=*)(act=accept)
       (action_list=(aut=off)(moct=0)(mct=0)(mit=0)(conn_stats=on)
    )
  )
  )
)

Start cman:

. oraenv
ocm
cd $ORACLE_HOME/network/admin
cmctl
admin
startup

3) Install RDBMS on ocm3

Create CDB ORCLCDB1 with Pluggable ORCLPDB1.
Create user test with password test123.

Add following to tnsnames.ora:

LISTENER_CMAN=
(DESCRIPTION_LIST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ocm2.localdomain)(PORT = 1560))
  )
)

Then run following:

sqlplus / as sysdba
ALTER SYSTEM SET REMOTE_LISTENER="LISTENER_CMAN" scope=both sid='*';
ALTER SYSTEM REGISTER;

Test it
Log on to OCM1

sqlplus test/test123@testproxy

Startup Script
cmstartup.sh:

#!/bin/bash
export ORAENV_ASK=NO
export ORACLE_SID=ocm
. oraenv
$ORACLE_HOME/bin/cmctl <<EOF
administer
startup
exit
exit
EOF

Shutdown Script
cmshutdown.sh:

#!/bin/bash
export ORAENV_ASK=NO
export ORACLE_SID=ocm
. oraenv
$ORACLE_HOME/bin/cmctl <<EOF
administer
shutdown
exit
exit
EOF

References:

https://database-heartbeat.com/2021/02/02/oracle-connection-manager-cman-install-configure-and-connect-to-dbcs-and-autonomous-databases/

https://www.ibm.com/docs/en/guardium/11.0/11.0?topic=lucocmmet-linux-unix-install-configure-oracle-connection-manager-remote-server

Troubleshooting Guide: TNS-04012: Unable to Start Oracle Connection Manager Instance (Doc ID 733421.1)

MOS Product Search : https://support.oracle.com/epmos/faces/KMConsolidatedSearch?_afrLoop=462789591977971&_afrWindowMode=0&_adf.ctrl-state=a0losgtyb_53

19c Connection Manager Control Utility
19c Configuring Oracle Connection Manager
19c Oracle Connection Manager Parameters