Part 7 of the series:
Create and manage multiple network configuration files
- How to setup listener.ora
- How to setup tnsnames.ora
- How to setup sqlnet.ora
- How to change the listener port/Listener oracle home
- How to setup multiple listeners in listener.ora
- tcp_invited_nodes feature
- What is a connection manager and How to set it up.
7. Below I will show you how to install and deploy CMAN and configure the DB client to use CMAN to connect to the database.
What is Connection Manager:
A router through which a client connection request may be sent either to its next hop or directly to the database server. Clients who route their connection requests through an Oracle Connection Manager can take advantage of the session multiplexing, access control, or protocol conversion features configured for that Oracle Connection Manager.
Oracle Connection Manager Control utility (cmctl)
A utility included with Oracle Net Services to control various functions, such as starting, stopping, and getting the status of the Oracle Connection Manager.commands available via cmctl:
[oracle@collabn1 admin]$ cmctl
CMCTL for Linux: Version 11.2.0.1.0 - Production on 13-SEP-2015 22:38:54
Copyright (c) 1996, 2009, Oracle. All rights reserved.
Welcome to CMCTL, type "help" for information.
CMCTL> help
The following operations are available
An asterisk (*) denotes a modifier or extended command:
administer close* exit quit
reload resume* save_passwd set*
show* shutdown sleep startup
suspend*
CMCTL for Linux: Version 11.2.0.1.0 - Production on 13-SEP-2015 22:38:54
Copyright (c) 1996, 2009, Oracle. All rights reserved.
Welcome to CMCTL, type "help" for information.
CMCTL> help
The following operations are available
An asterisk (*) denotes a modifier or extended command:
administer close* exit quit
reload resume* save_passwd set*
show* shutdown sleep startup
suspend*
Lets do the demo:
Below I will install the Oracle Client Software including the Oracle Net Listener:
shaiks@MAC$ssh -X oracle@192.168.78.51
oracle@192.168.78.51's password:
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Warning: No xauth data; using fake authentication data for X11 forwarding.
Last login: Sun Sep 13 20:00:04 2015 from 192.168.78.2
[oracle@collabn1 ~]$ls -lrt
-rwxrwx--- 1 root vboxsf 706187979 Sep 13 19:07 linux.x64_11gR2_client.zip
[oracle@collabn1 ~]$unzip linux.x64_11gR2_client.zip
[oracle@collabn1 ~]$ cd /media/sf_stage/client/
[oracle@collabn1 client]$ ls
doc install response runInstaller stage welcome.html
Start the Install
[oracle@collabn1 client]$ ./runInstaller
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 10153 MB Passed
Checking swap space: must be greater than 150 MB. Actual 2934 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-09-13_08-01-09PM. Please wait ...[oracle@collabn1 client]$ You can find the log of this install session at:
/u01/app/oraInventory/logs/installActions2015-09-13_08-01-09PM.log
[oracle@collabn1 client]$
[root@collabn1 CLIENT]# ./root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0.2/CLIENT
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
[root@collabn1 CLIENT]#
[oracle@collabn1 admin]$
[oracle@collabn1 admin]$cat i listener.ora
CMAN =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = collabn1.shaiksameer)(PORT = 1523))
)
)
ADR_BASE_CMAN = /u01/app/oracle
[oracle@collabn1 admin]$ lsnrctl status cman
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 13-SEP-2015 20:18:07
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1523)))
STATUS of the LISTENER
------------------------
Alias cman
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 13-SEP-2015 20:18:02
Uptime 0 days 0 hr. 0 min. 5 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0.2/CLIENT/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/collabn1/cman/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1523)))
The listener supports no services
The command completed successfully
Stop the Traditional Listener:
[oracle@collabn1 admin]$ lsnrctl stop cman
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 13-SEP-2015 20:27:11
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1523)))
The command completed successfully
Let’s use Connection Manager instead of traditional Listener configurations:
Create the cman configuration files cman.ora & tnsnames.ora
[oracle@collabn1 admin]$ cp samples/cman.ora .
[oracle@collabn1 admin]$ vi cman.ora
[oracle@collabn1 admin]$ vi cman.ora
# CMAN Alias
cman_collabn1 =
(configuration=
# Listening address of the cman
(address=(protocol=tcp)(host=collabn1.shaiksameer)(port=1523))
(parameter_list =
(aso_authentication_filter=off)
(connection_statistics=yes)
(log_directory=/u01/app/oracle/product/11.2.0.2/CLIENT/log/)
(log_level=off)
(max_connections=6)
(idle_timeout=0)
(inbound_connect_timeout=0)
(session_timeout=0)
(outbound_connect_timeout=0)
(max_gateway_processes=16)
(min_gateway_processes=2)
(remote_admin=on)
(trace_directory=/u01/app/oracle/product/11.2.0.2/CLIENT/log/)
(trace_level=off)
(max_cmctl_sessions=4)
(event_group=init_and_term,memory_ops)
)
(rule_list=
(rule=
(src=*)(dst=*)(srv=*)(act=accept)
(action_list=(aut=off)(moct=0)(mct=0)(mit=0)(conn_stats=on))
)
)
)
[oracle@collabn1 admin]$ cp samples/tnsnames.ora .
[oracle@collabn1 admin]$ vi tnsnames.ora
cman_collabn1=(DESCRIPTION_LIST =
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=tcp)
(HOST=collabn1.shaiksameer)
(PORT=1523)
)
)
)
)
[oracle@collabn1 admin]$ cmctl
CMCTL for Linux: Version 11.2.0.1.0 - Production on 13-SEP-2015 20:30:11
Copyright (c) 1996, 2009, Oracle. All rights reserved.
Welcome to CMCTL, type "help" for information.
CMCTL> administer cman_collabn1
Current instance cman_collabn1 is not yet started
Connections refer to (address=(protocol=tcp)(host=collabn1.shaiksameer)(port=1523)).
The command completed successfully.
CMCTL:cman_collabn1> startup
Starting Oracle Connection Manager instance cman_collabn1. Please wait...
TNS-04077: WARNING: No password set for the Oracle Connection Manager instance.
CMAN for Linux: Version 11.2.0.1.0 - Production
Status of the Instance
----------------------
Instance name cman_collabn1
Version CMAN for Linux: Version 11.2.0.1.0 - Production
Start date 13-SEP-2015 20:30:37
Uptime 0 days 0 hr. 0 min. 9 sec
Num of gateways started 2
Average Load level 0
Log Level OFF
Trace Level OFF
Instance Config file /u01/app/oracle/product/11.2.0.2/CLIENT/network/admin/cman.ora
Instance Log directory /u01/app/oracle/diag/netcman/collabn1/cman_collabn1/alert
Instance Trace directory /u01/app/oracle/diag/netcman/collabn1/cman_collabn1/trace
The command completed successfully.
CMCTL:cman_collabn1> show services
Services Summary...
Proxy service "cmgw" has 1 instance(s).
Instance "cman", status READY, has 2 handler(s) for this service...
Handler(s):
"cmgw001" established:0 refused:0 current:0 max:6 state:ready
<machine: ::1, pid: 22904>
(ADDRESS=(PROTOCOL=tcp)(HOST=::1)(PORT=32895))
"cmgw000" established:0 refused:0 current:0 max:6 state:ready
<machine: ::1, pid: 22902>
(ADDRESS=(PROTOCOL=tcp)(HOST=::1)(PORT=32304))
Service "cmon" has 1 instance(s).
Instance "cman", status READY, has 1 handler(s) for this service...
Handler(s):
"cmon" established:1 refused:0 current:1 max:4 state:ready
<machine: ::1, pid: 22893>
(ADDRESS=(PROTOCOL=tcp)(HOST=::1)(PORT=19041))
The command completed successfully.
[oracle@collabn1 admin]$ ps -aef| grep CLIENT
oracle 6936 8617 0 21:21 pts/1 00:00:00 grep CLIENT
oracle 22893 1 0 20:52 ? 00:00:00 /u01/app/oracle/product/11.2.0.2/CLIENT/bin/cmadmin cman_collabn1 -inherit
oracle 22897 1 0 20:52 ? 00:00:00 /u01/app/oracle/product/11.2.0.2/CLIENT/bin/tnslsnr ifile=/u01/app/oracle/product/11.2.0.2/CLIENT/network/admin/cman.ora cman_collabn1 -inherit -mode proxy
oracle 22902 1 0 20:52 ? 00:00:00 /u01/app/oracle/product/11.2.0.2/CLIENT/bin/cmgw cmgw0 0 16 cman_collabn1 SNLSM:0e9a4000
oracle 22904 1 0 20:52 ? 00:00:00 /u01/app/oracle/product/11.2.0.2/CLIENT/bin/cmgw cmgw1 1 16 cman_collabn1 SNLSM:0e9a4000
Register the cman on the Database to listen for connections:
SHAIKDB>alter system set remote_listener="(address=(protocol=tcp)(host=collabn1.shaiksameer)(port=1523))";
System altered.
SHAIKDB>alter system register;
System altered.
SHAIKDB>!
Verify the registration:
CMCTL> administer cman_collabn1
TNS-04077: WARNING: No password set for the Oracle Connection Manager instance.
Current instance cman_collabn1 is already started
Connections refer to (address=(protocol=tcp)(host=collabn1.shaiksameer)(port=1523)).
The command completed successfully.
CMCTL:cman_collabn1> show services
Services Summary...
Proxy service "cmgw" has 1 instance(s).
Instance "cman", status READY, has 2 handler(s) for this service...
Handler(s):
"cmgw001" established:0 refused:0 current:0 max:6 state:ready
<machine: ::1, pid: 22904>
(ADDRESS=(PROTOCOL=tcp)(HOST=::1)(PORT=32895))
"cmgw000" established:0 refused:0 current:0 max:6 state:ready
<machine: ::1, pid: 22902>
(ADDRESS=(PROTOCOL=tcp)(HOST=::1)(PORT=32304))
Service "SHAIKDB.shaikmeer" has 1 instance(s).
Instance "SHAIKDB", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1521))
Service "SHAIKDBXDB.shaikmeer" has 1 instance(s).
Instance "SHAIKDB", status READY, has 1 handler(s) for this service...
Handler(s):
"D000" established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: collabn1.shaiksameer, pid: 26756>
(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=47765))
Service "cmon" has 1 instance(s).
Instance "cman", status READY, has 1 handler(s) for this service...
Handler(s):
"cmon" established:2 refused:0 current:0 max:4 state:ready
<machine: ::1, pid: 22893>
(ADDRESS=(PROTOCOL=tcp)(HOST=::1)(PORT=19041))
The command completed successfully.
Configure the client tnsnames.ora:
[oracle@collabn1 sf_stage]$ vi $TNS_ADMIN/tnsnames.ora
cman =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = collabn1.shaiksameer)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = collabn1.shaikmeer)
)
)
[oracle@collabn1 sf_stage]$ tnsping cman
TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 13-SEP-2015 22:26:53
Copyright (c) 1997, 2009, Oracle. All rights reserved.
Used parameter files:
/u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = collabn1.shaiksameer)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = SHAIKDB.shaikmeer)))
OK (0 msec)
[oracle@collabn1 sf_stage]$ sqlplus system@cman
SQL*Plus: Release 11.2.0.1.0 Production on Sun Sep 13 22:26:56 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SHAIKDB>select name from v$database;
NAME
---------
SHAIKDB