Thursday 21 July 2011

Kill OPMN Process and restart the Instance


Causes::

You have previously started the opmn process as an incorrect user (such as root) but are now logged in as the unix user that owns the Application Server installation. The AS unix owner then experiences permission related errors communicating with the root initiated OPMN process.

It can be confirmed that this has taken place by listing the ownership of the running "opmn -d" processes:
$ ps -ef|grep 'opmn -d'|grep -v 'grep'
root 31011 1 0 09:08 ? 00:00:00 /as1013/app/oracle/product/mid101300a/opmn/bin/opmn -d
root 31012 31011 0 09:08 ? 00:00:00 /as1013/app/oracle/product/mid101300a/opmn/bin/opmn -d
Solution

To implement the solution, please execute the following steps:

1. Capture output from "ps -ef|grep 'opmn -d'|grep -v 'grep'" to identify current opmn daemon processes to be terminated.
2. Capture output from "opmnctl status -l" for future reference
- it may be necessary to manually kill processes that the current "opmn -d" processes have started
3. Log in to the UNIX account that owns the current "opmn -d" processes (this may require root privileges).
4. Use "opmnctl stopall" to stop the opmn daemon and all processes
5. Use "ps -ef|grep 'opmn -d'|grep -v 'grep'" to confirm the two "opmn -d" processes have been terminated
- use "kill -9 " on each PID to force this if necessary (again, this may need root privileges)
6. Review the PID column from the "opmnctl status -l" and confirm that each process has been stopped.
- again use "kill -9 " on each PID to force this if necessary (again, this may need root privileges)
7. For the directory of each OC4J instance that exists below $ORACLE_HOME/j2ee,
rename the "persistence" directory to "persistence.old"
8. Confirm if any files under the $ORACLE_HOME have been created under the incorrect unix account:

$ find $ORACLE_HOME -user root -print
With the exception of files below the $ORACLE_HOME/Apache/Apache/bin directory, use "chown" to reset the owner and group of each files that has changed.

For example:

$ cd $ORACLE_HOME/opmn/conf
$ ls -ld1 .*
drwx------ 3 mid101300a oinstall 4096 Sep 7 09:08 .
drwx------ 8 mid101300a oinstall 4096 May 30 09:00 ..
-r-------- 1 root root 21 Sep 7 09:08 .formfactor
Use the ownership of the directory guide the "chown" command needed:

$ chown mid101300a:oinstall .formfactor
9. Log out from the incorrect UNIX account and log back in as the UNIX user owning the AS installation.
10. Start opmn and desired managed processes:

$ opmnctl start

$ opmnctl startproc process-type=HTTP_Server
opmnctl: starting opmn managed processes...

$ opmnctl startproc process-type=home
opmnctl: starting opmn managed processes...
11. Confirm via "ps -ef|grep 'opmn -d'|grep -v 'grep' " that opmn daemon processes are owned by the expected user
12. Use "opmnctl status -l" to confirm all processes have started correctly.

Regards,

Hemesh

No comments: