26
Oracle Connection Manager

Oracle Connection Manager

Embed Size (px)

Citation preview

Page 1: Oracle Connection Manager

Oracle Connection Manager

Page 2: Oracle Connection Manager

Deploying the Oracle Connection Manager

Page 3: Oracle Connection Manager

Connection Manager

What is Oracle Connection Manager InstallationSetupWhat does itArchitecture

Page 4: Oracle Connection Manager

What is Oracle Connection Manager

• Oracle Connection Manager is a proxy-server. that forwards connection requests to databases or other proxy servers

The primary functions of Oracle Connection Manager are:• Access control: To use rule-based configuration to filter out

user-specified client requests and accept others.• Session multiplexing: To funnel multiple client sessions

through a network connection to a shared server destination.

Page 5: Oracle Connection Manager

Installation of Oracle Connection Manager

The total space of the installation is round 1.5 gyg.

We used client version 11.2.0.4

Choose custom installation.

Page 6: Oracle Connection Manager

Installation of Oracle Connection Manager

Page 7: Oracle Connection Manager

Setup Connection Manager

• Edit cman.ora • Installation directory

/u01/app/oracle/product/11.2.0/client11204/network/admin• Runs on the test1020.oracle.sometest.nl• Port 20050. Don’t forget to asked the network/firewall

department to open port 20050. This port will be used by the connection manager.

Page 8: Oracle Connection Manager

Setup Connection ManagerYou must edit the following file $ cd $ORACLE_HOME/network/admin$ cp $ORACLE_HOME/network/admin/samples/cman.ora .$ vi cman.oraYou must change the following lines# CMAN Aliascman_<fqhost> =IN# CMAN Aliascman_test1020.oracle.sometest.nl test1020.oracle.sometest.nl is the server where connection manager is running.

Page 9: Oracle Connection Manager

Setup Connection Manager• You must change the following lines• # Listening address of the cman• (address=(protocol=tcp)(host=<fqhost>)(port=<lsnport>))• IN• # Listening address of the cman• (address=(protocol=tcp)(host=test1020.oracle.sometest.nl)(port=20050))• test1020.oracle.sometest.nl is the server where connection manager is

running.• 20050 is port number for the connection manager

Page 10: Oracle Connection Manager

Setup Connection Manager• You must change the following lines• # Log files would be created in the directory specified here• (log_directory=<logdir>)• IN• # Log files would be created in the directory specified here• (log_directory=/u01/app/oracle/product/11.2.0/

client11204/network/log)

That’s is all you have to do to setup connection manager

Page 11: Oracle Connection Manager

How to use Oracle Connection Manager

The connection manager has a command line interface. You can start it with : cmctl

$ cmctl CMCTL for Linux: Version 11.2.0.4.0 - Production on 20-MAY-2016 12:05:24 Copyright (c) 1996, 2013, Oracle. All rights reserved. Welcome to CMCTL, type "help" for information. CMCTL>This will show a prompt "CMCTL>". Here you will enter different admin commands for the CM processes, much like LSNRCTL command line interpreter.

Page 12: Oracle Connection Manager

How to use Oracle Connection Manager

Start the administration process by typing "administer"

CMCTL> administerCurrent instance CMAN_test1020.oracle.sometest.nl is not yet startedConnections refer to (address=(protocol=tcp)(host=test1020.oracle.rabobank.nl)(port=20050)).The command completed successfully.CMCTL:CMAN_test1020.oracle.sometest.nl>

Page 13: Oracle Connection Manager

How to use Oracle Connection ManagerStart the connection manager processes by issuing "startup"

CMCTL:CMAN_test1020.oracle.sometest.nl> startStarting Oracle Connection Manager instance CMAN_test1020.oracle.sometest.nl. Please wait...TNS-04077: WARNING: No password set for the Oracle Connection Manager instance.CMAN for Linux: Version 11.2.0.4.0 - ProductionStatus of the Instance----------------------Instance name cman_test1020.oracle.sometest.nlVersion CMAN for Linux: Version 11.2.0.4.0 - ProductionStart date 20-MAY-2016 12:10:03Uptime 0 days 0 hr. 0 min. 9 secNum of gateways started 2

Page 14: Oracle Connection Manager

How to use Oracle Connection ManagerAverage Load level 0Log Level USERTrace Level OFFInstance Config file /u01/app/oracle/product/11.2.0/client11204/network/admin/cman.oraInstance Log directory /u01/app/oracle/product/11.2.0/client11204/network/logInstance Trace directory <trcdir>The command completed successfully.CMCTL:CMAN_test1020.oracle.sometest.nl>

Page 15: Oracle Connection Manager

How to use Oracle Connection ManagerIf everything goes well, you should see the CM status CMCTL:CMAN_test1020.oracle.sometest.nl> show statusStatus of the Instance----------------------Instance name cman_test1020.oracle.sometest.nlVersion CMAN for Linux: Version 11.2.0.4.0 - ProductionStart date 20-MAY-2016 12:10:03Uptime 0 days 0 hr. 2 min. 42 secNum of gateways started 2Average Load level 0Log Level USERTrace Level OFFInstance Config file /u01/app/oracle/product/11.2.0/client11204/network/admin/cman.oraInstance Log directory /u01/app/oracle/product/11.2.0/client11204/network/logInstance Trace directory <trcdir>The command completed successfully.CMCTL:CMAN_test1020.oracle.rsometest.nl>

Page 16: Oracle Connection Manager

How to use Oracle Connection ManagerFrom this moment on connection can be made from the client site. You can check the number of connections using CMCTL tool CMCTL:CMAN_test1020.oracle.rabobank.nl> show connectionsNumber of connections: 1.The command completed successfully.The output shows there is one connection through the CM listener. As you connect more, you will see the number next to "Number of connections:" increasing.

That's it. You have successfully configured Connection Manager interface.

Page 17: Oracle Connection Manager

Monitoring connection manager

We have choosing to monitor the Oracle Connection Manager if is up and running through crs resource

Connection manager is now installed on3 nodes. The test1020, acc3020 and prod3520. For monitoring purpose a CRS resource is made for both 3. The crs resource is create on our OMS cluster(xxxx7001, xxxx7002, xxxx8001 and xxxx8002).

Create crs resourcecrsctl add resource eco.obs_cman_o -type application -attr "ACTION_SCRIPT=/u01/app/oracle/admin/general/observer/scripts/cman.sh“

crsctl modify res "eco.obs_cman" -attr "AUTO_START=always"crsctl modify res "eco.obs_cman" -attr "STOP_TIMEOUT=60"crsctl modify res "eco.obs_cman" -attr "SCRIPT_TIMEOUT=120"

Page 18: Oracle Connection Manager

Monitoring connection managerStart CRS resource

crsctl start res eco.obs_cman_o -n xxxx7001

$ crsstat| grep obsNAME TARGET STATE SERVER ------------------------- ---------- ---------- ----------eco.obs_cman_o ONLINE ONLINE xxxx7001

Page 19: Oracle Connection Manager

Monitoring connection managerThe crs resource will check every 30 seconds if the connection managers are still running. If not it will start it(or them) up. If it fails to start it up an incident is created in em12c. The resource uses a script that is located at”/u01/app/oracle/admin/general/observer/scripts$ ls –aldrwxrwx--- 3 oracle oinstall 4096 May 17 13:32 ..-rwxrwx--- 1 oracle oinstall 1428 May 17 13:32 cman.sh The script checks , start and stop the connection manager.

Page 20: Oracle Connection Manager

Monitoring connection managerThe logfile can be found at:/u01/app/11.2.0.4/gi_000/log/peco7001/agent/crsd/application_oracle$ tailf application_oracle.log2016-05-20 12:31:39.495: [eco.obs_cman_o][1484364096]{1:16137:59620} [check] Check action called..2016-05-20 12:31:39.495: [eco.obs_cman_o][1484364096]{1:16137:59620} [check] CHECK action called.2016-05-20 12:31:39.495: [eco.obs_cman_o][1484364096]{1:16137:59620} [check] Executing action script: /u01/app/oracle/admin/general/observer/scripts/cman.sh[check]2016-05-20 12:31:39.897: [eco.obs_cman_o][1484364096]{1:16137:59620} [check] Cman process for connect manager is running2016-05-20 12:31:40.006: [ AGFW][1482262848]{1:16137:59620} Agent received the message: AGENT_HB[Engine] ID 12293:168220162016-05-20 12:31:52.006: [eco.obs_cman_g][1484364096]{1:16137:60942} [check] Check action called..2016-05-20 12:31:52.006: [eco.obs_cman_g][1484364096]{1:16137:60942} [check] CHECK action called.2016-05-20 12:31:52.006: [eco.obs_cman_g][1484364096]{1:16137:60942} [check] Executing action script: /u01/app/oracle/admin/general/observer/scripts/cmang.sh[check]2016-05-20 12:31:52.358: [eco.obs_cman_g][1484364096]{1:16137:60942} [check] Cman process for connect manager is running2016-05-20 12:32:10.010: [ AGFW][1482262848]{1:16137:59620} Agent received the message: AGENT_HB[Engine] ID 12293:16822032• 2016-05-20 12:32:30.121: [eco.obs_cman_p][1490667840]{1:16137:60951} [check] Check action called..

Page 21: Oracle Connection Manager

Architecture of Oracle Connection Manager

Let's quickly go through the architecture of the tool. Assume there are three hosts: client1(Secret) - the machine where the client runs and wants to connect to the databasedbhost1(test004) - the machine where the database instance runscmhost1 (test1020) - the machine where the Connection Manager process runs Here is a rough network diagram of the three machine

Page 22: Oracle Connection Manager

Architecture of Oracle Connection Manager

Page 23: Oracle Connection Manager

Architecture of Oracle Connection Manager

From client1 you can reach cmhost1 but not dbhost1:However, you can ping the dbhost1 from cmhost1 and cmhost1 from client1.Normally the TNS entry at the client machine(In our case Secret) would have looked like this: ODBA1_CM = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.xxx.xxx.19)(PORT = 1550) ) (CONNECT_DATA = (SERVICE_NAME=SRV0ODBA101) ) )

Page 24: Oracle Connection Manager

Architecture of Oracle Connection ManagerHowever, this will not work since the client does not even know the routing for dbhost1. Instead the client connects to the CM host. The connection manager has two processesThe Connection Manager Admin Process (cmadmin). One or more Connection Manager Gateway Processes (cmgw)The CMGW processes allows the client connections to come in through them. The admin process manages the gateways. We will cover more on that later.After setting up the CM processes, you will need to rewrite the TNSNAMES.ORA in the following way: ODBA1_CM = (DESCRIPTION = (SOURCE_ROUTE = YES) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.xxx.xxxx.43 )(PORT = 20050) ) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.xxx.xxx.19)(PORT = 1550) ) (CONNECT_DATA = (SERVICE_NAME=SRV0ODBA101) ) )

Page 25: Oracle Connection Manager

Architecture of Oracle Connection ManagerNote the special parameter:SOURCE_ROUTE = YESThis tells the client connection request to attempt the first address listed first and only then attempt the next one. This is different from load balance setups where you would expect the client tool to pick one of the addresses at random. So the client attempts this address first: (PROTOCOL = TCP)(HOST = 10.xxx.xxx.43 )(PORT = 20050) This is the listener for Connection Manager. The clients are allowed to connect to the port 20050 (the port where CM listener listens on) on the cmhost1 (in our case test1020). After that the connection attempts the second address (PROTOCOL = TCP)(HOST = 10.xxx.xxx.19)(PORT = 1550)

However, it will fail since the client does not have access to the port 1550 of the host dbhost1(in our case the test004). This is where CM comes in. The client does not make the request; CM does on behalf of the client connection that just came in. The connection manager (running on cmhost1: test1020) makes the request with that address. Since the host cmhost1(test1020) can access dbhost1(test004-adm) on port 1550, that connection request goes through successfully.