Wednesday, May 23, 2007

Resetting a lost oc4jadmin password

A common question is how do I change the oc4jadmin password when I don't already know it? If you have access to the application owner's UNIX account its quite easy. But note that it does require a restart of the 10g application server. Since you've lost the password I'm hoping that you're on a development system, so restarting the application server shouldn't be a big deal for you.

  1. Start by locating the correct Oracle home, let's assume that it's .../10gas/10.1.3 for our example
  2. Do a quick check to see that it has the "home" OC4J instance running in it as shown here
    oracle@myhost > /oracle/10gas/10.1.3/opmn/bin/opmnctl status

    Processes in Instance: demo.myhost
    ---------------------------------+--------------------+---------+---------
    ias-component | process-type | pid | status
    ---------------------------------+--------------------+---------+---------
    OC4JGroup:default_group | OC4J:bixmlpserver | 17003 | Alive
    OC4JGroup:default_group | OC4J:bianalytics | 17002 | Alive
    OC4JGroup:default_group | OC4J:bijmx | 17001 | Alive
    OC4JGroup:default_group | OC4J:home | 17000 | Alive
    ASG | ASG | N/A | Down
    HTTP_Server | HTTP_Server | 16999 | Alive

  3. Now edit the .../10gas/10.1.3/j2ee/home/config/system-jazn-data.xml
  4. Search for the keyword "oc4jadmin" to locate the following stanza:
        <user>
    <name>oc4jadmin</name>
    <display-name>OC4J Administrator</display-name>
    <guid>4FE81440BD2911DBBF8EED2D8B2D4B8C</guid>
    <description>OC4J Administrator</description>
    <credentials>{903}YD4N1akwPa8FxfnwvqTAT76FCx62bGsfU8Kzd2p+IJQ=</credentials>
    </user>

  5. Change the content of the credentials tag to something like this:
    <credentials>!mynewpassword</credentials>
    Note the exclamation mark at the beginning of the new password. It marks the entry as a non-encrypted password value.
  6. Save the file

  7. Use .../10gas/10.1.3/opmn/bin/opmnctl to restart the OC4J apps server

  8. Login to the applications server as the oc4jadmin user to verify that your new password works
  9. If you check the system-jazn-data.xml file after the restart you should see that your edit has been replaced by an encrypted version of the password