Search This Blog

Monday, November 18, 2013

OIM11gR2 Setting a specific user as a system administrator

Technique to set a user OIMADMIN to have the same access as XELSYSADM.
OIMADMIN is just an example.

Step 1: Set the user's USR_TYPE to "End-User Administrator"

update usr set usr_type='End-User Administrator' where usr_login='OIMADMIN';
commit;

Step 2: Add the user to the System Administrators "Admin Role"

In the Identity Webapp, logged in as xelsysadm, navigate to Organizations and search on the organization called "Top".
The first role in the Top organization is System Administrators.  Select it.
Explicitly add the OIMADMIN user to this role by direct assignment using the dialog provided.

Be sure to check the sub-orgs and Apply

That is it.   You should see SYSTEM ADMINISTRATORS in the Roles tab of the view user page.


Thursday, November 14, 2013

Packaging an incident report on a weblogic managed server

How to package an incident report:

View this URL:

http://docs.oracle.com/cd/E27559_01/core.1112/e28516/diagnostics.htm#ASADM11171

Quick setup:

Here is a little script to list the OIM incidents (for OIM):

#!/bin/sh
# Lists time and problem for incidents on OIM
PWD=`pwd`
now=`date`
tf=/tmp/litmp$$
cd $DOMAIN_HOME/servers/oim_server*/adr/diag/ofm/oim_domain/oim_server*
echo "Searching incident reports"
find incident/ -type d -name 'incdir_*' -print > $tf
for each in `cat $tf`
do
  echo " "
  head -4 $each/readme.txt
done


Find the incident you want.

Have this script setenv_adr handy and source it:

ORACLE_HOME=$MW_HOME/wlserver_10.3/server/adr
export ORACLE_HOME
LD_LIBRARY_PATH=$ORACLE_HOME
export LD_LIBRARY_PATH
PATH=$PATH:$ORACLE_HOME


Next run adrci and copy in the following:


SET BASE <use your MW_HOME folder>/user_projects/domains/oim_domain/servers/oim_server1/adr
SET HOMEPATH diag/ofm/oim_domain/oim_server1
 
Of course use your own folder names and server names.  Then enter:
 
IPS CREATE PACKAGE INCIDENT incident_number
IPS ADD FILE filespec PACKAGE package_number 

IPS GENERATE PACKAGE # in /tmp

 

Working with the Oracle Diagnostic Logging on Weblogic

How to use the ODL effectively in the following:

Event Handlers
Scheduled Tasks
ICF Connectors

First, use the following classes in your code:
java.util.logging.Logger
java.util.logging.Level

You do not have to use log4j-xxx.jar it is not needed.

Second, and this is very important, if you CAN, do not begin your package name with com, rather use something unique like edu for colleges or your company abbreviation.  This will make it easier to do the configuration in the Enterprise Manager.

Next, in your code, use the following techniques:
1) In your class definition, create a private static final Logger called logger and initialize it with the class like this:
private static final Logger logger = Logger.getLogger(MyClass.class.getName());

2) In each method specify a String with the method name such as:
String methodName="execute";

3) At the beginning of each method use:
logger.logp(Level.FINE, getClass().getName(), methodName, "Entering");

4) Optionally, at the end of each method use:
logger.logp(Level.FINE, getClass().getName(), methodName, "Exiting");


5) For the rest of your output statements, use:
logger.logp(Level.FINE, getClass().getName(), methodName,
   "whatever you want to say in your message");

For these types of statements the following are available:
Level.SEVERE         Level.WARNING      Level.INFO
Level.FINE               Level.FINER             Level.FINEST

That's it for the code.

In Weblogic's Enterprise Manager, open the deployment where you have placed your code, Nav to this with WebLogic Domain -> domain name and select the managed server.

You will see the managed server name (it needs to be up with the green up arrow) and below that will read WebLogic Server and show a down arrow.  Select the down arrow and nav to Logs -> Log Configuration.

In here you see 3 tabs, Log Levels, Log Files, and QuickTrace.  Select Log Levels, View Runtime Loggers, and search on your class name.

Find your class name.  The default log level is normally WARNING.  Choose wisely the class or package you want to modify, and set the level to the highest level you wish to see.  Scroll to the bottom of the screen and check the "Persist log level state across component restarts" and then click "Apply".  Your logger is now set to go to the diagnostic.log file.

If you want to have your data go to a separate set of log files, go to the Log Files tab and select the odl-handler Handler Name, then click on "Create Like...", and create a new Handler.  Give it a cool name and change the configuration to use a different file name pattern than -diagnostic.  Save this and then assign your classes to it.  Done.


Wednesday, November 6, 2013

OIM How to pull an IT Resource Parameter

Inputs will be the IT Resource Name and the IT Resource Parameter Name

Define the following:

private tcITResourceDefinitionOperationsIntf itResDefOp=null;
private tcITResourceInstanceOperationsIntf itResInstOp=null;
private    long itResourceKey = 0L;


Next, in some module pull the Ops:


itResDefOp=Platform.getService(tcITResourceDefinitionOperationsIntf.class);
itResInstOp=Platform.getService(tcITResourceInstanceOperationsIntf.class);


Define a search and get the itResourceKey

Map searchFor = new HashMap();
searchFor.put("IT Resources.Name", itResourceName);
try {
    tcResultSet results = 

        itResInstOp.findITResourceInstances(searchFor);
    if (results.getRowCount() == 1) {
        results.goToRow(0);
        itResourceKey = 

            results.getLongValue("IT Resources.Key");
    } else {
        searchFor.clear();
        results = 

            itResInstOp.findITResourceInstances(searchFor);
        for (int i = 0; i < results.getRowCount(); i++) {
            results.goToRow(i);
            if (results.getStringValue("IT Resources.Name")

                .equalsIgnoreCase(itResourceName)) {
                itResourceKey = 

                     results.getLongValue("IT Resources.Key");
                break;
            }
        }
    }
}
catch (Exception ex) {
    ;
}


Finally, pull the parameter value:

try {

    tcResultSet paramSet= itResInstOp
       .getITResourceInstanceParameters(itResourceKey);
    int numParams=paramSet.getRowCount();
    if (numParams < 1) {
        ;  // Do something here it's not found
    }
    for (int iparam=0; iparam < numParams; ++iparam) {
        paramSet.goToRow(iparam);
        String paramName=paramSet

           .getStringValue("IT Resources Type Parameter.Name");
        if(paramName

           .equalsIgnoreCase("WhatYouAreSearchingFor")) {
            ResultValue=paramSet

               .getStringValue("IT Resource.Parameter.Value");
        }
    }
}
catch (Exception e) {
    ;
}

Tuesday, November 5, 2013

Reduce Weblogic startup time

This one is from my coworker:


In the jre/lib/security/java.security file for the JDK you are running WLS under look for this line:

securerandom.source=file:/dev/urandom

and change it to:

securerandom.source=file:/dev/./urandom

It cuts the startup time in half.  It has to do with a bug where Java interprets /dev/urandom as /dev/random which is a really slow RNG in Linux.  Adding the /./ reference is a simple workaround and makes it go back to /dev/urandom as the RNG.