01 May 2006

Hidden Gems in the OPMN opmnctl Utility

The opmnctl command has a few hidden gems. Well I'm sure they're well documented somewhere but I don't see too many people using them.

So my two picks for the day are:

1. Starting and stopping individual applications.

Yes that's right! The opmnctl utility can start and stop individual applications running on an OC4J instance under the control of OPMN.

The command form is:

$opmnctl stopproc application=FOO

where FOO is the name of the application.

This will cause the FOO application to be shutdown and the setting persisted in the OC4J j2ee/home/config/server.xml so that the application will be kept in the last requested state if/when the OC4J instance itself is restarted.

This command is particularly useful if you have wired together a few 10.1.3 instances in which the "Application Server Control" is active on each instance and you receive a warning when you use it that there are multiple instances running. It's a bit of a pain since ASC won't let you stop an ASC application, even if its not the current one. Therefore to stop an instance of ASC from running you can use this nice opmnctl facility.

Go to the $ORACLE_HOME/opmn/bin directory of the instance in which you want to stop ASC and type

$ opmnctl stopproc application=ascontrol
opmnctl: stopping opmn managed processes...

Further, if you have access to one instance of opmnctl which is mapped into the topology then you don't even need to go into the specific $ORACLE_HOME directory of the instance where you want to stop ASC. You can just add an "instance" scope to the command and point it at the instance where you want to stop ASC.

2. Live reporting

The default mode of operation of opmnctl is to report the output of its operations when all of the operations have completed.

If you are like me and like to see results as they happen, then you can give opmnctl an extra switch and it'll report status as it receives it.

You can do this by tacking on the additional switch

$opmnctl report=true

It's a little hard to visualize this, but the following comes in on a line-by-line basis as the individual activities are finishing -- not as a result blob at the very end of the restartproc operation

$opmnctl @cluster restartproc report=true
opmnctl: restarting opmn managed processes...
HTTP_Server/HTTP_Server/HTTP_Server/1,1770851305,3071: success
default_group/home/default_group/1,1770851307,27024: success
multi_group/multi/default_group/2,1770851317,27969: success
multi_group/multi/default_group/1,1770851318,27970: success
060426_ohsj2ee.stadp57.us.oracle.com: 4 of 4 processes restarted.

5 comments:

Unknown said...

Interesting, but... why would I want to stop ASC Application?

Pedro said...

I don't have opmnctl. I can't find it. I don't have that instruction available, What can I do?
I have installed oracle xe on centos 5

Buttso said...

opmnctl is a utility that ships with Oracle Application Server. You are using Oracle Database XE, so it's not something you need to use.

Salih said...

Hi Buttso,

Good Article.
i have some clarifications in the opmnctl.

Please help me in clarifying my doubts.

1.Is it possible to get the heap size memory used by jvm(s) using opmnctl?
2. what is the difference between http2 and http1? it is displayed in the ports column of opmnctl status -l
3.whet is the use of query option in opmnctl?how can we use the same? can u give an example
4.how to get the application name using opmnctl?

Thanks,
Salih
Email:salihkm1981@gmail.com

Buttso said...

Hi Salih --


>>1.Is it possible to get the heap size memory used by jvm(s) using opmnctl?

I don't think the JVM level metrics are accessible directly from OPMN.

>>2. what is the difference between http2 and http1? it is displayed in the ports column of opmnctl status -l

That indicates there are two distinct OHS instances that are configured and being managed by this OPMN configuration.

>>3.what is the use of query option in opmnctl?how can we use the same? can u give an example

Sorry, I'm not familiar with the query option, have never used it. Sounds like it can be used to get information from the OPMN log files based on some attribute. Have a look at the format of the OPMN log file and see if you can specify a query to pick out a specific field.

>>4.how to get the application name using opmnctl?

If you use the "opmnctl status -app" command then you will see a list and status of the deployed applications.