Wednesday, 24 December 2014

EPM - Did you know? #2

If you read yesterday you will know I am putting together a series of quick posts with EPM information which you may or may not know.

The randomiser today has picked:

Did you know you can simply automate the refreshing of the Shared Services cache using the Java API?

In the Shared Services under the user directory configuration there is the option to set the cache refresh interval which the default is 60 minutes.

In some cases with large corporate directories the interval may be set to higher value to reduce performance degradation.

You may be wondering what the cache is for anyway, well here is Oracle’s definition:

"Interval (in minutes) for refreshing the Shared Services cache of groups to users relationship data. Default is 60 minutes.

Shared Services caches information about new external user directory groups and new users added to existing groups only after the next cache refresh. Users provisioned through a newly created external user directory group do not get their provisioned roles until the cache is refreshed."

Now say there have been changes in the external directory such as users have been added or removed from groups then these will not be picked up until the next cache refresh, if these changes are required to be pushed through straight away or maybe changes should be applied at a set time then having to log into Shared Services to click the refresh button is not the ideal option.

Luckily there is an option available using the API and a simple piece of code will allow the refresh to occur on demand.

Here is an example piece of code I wrote to basically accept a username and password which is then authenticated and if successful the cache is refreshed.

Apologies to master coders out there if you are appalled by my attempt :)

Right, let’s demonstrate refreshing the cache with an example scenario, in Shared Services I have an active directory group called EPM_ADMINISTRATORS which has already been provisioned with roles.

At present the group only has only user called epm_admin, in the AD I add myself to the group

Checking the properties of the group in Shared Services still only shows one member.

This will be the case until the next refresh of the cache so time to give my code a quick test.

Running the java can easily be done from command line with the following:
  • Set the classpath to include the required java classes, to simplify I am using epm_j2se.jar which references many packages
  • Set the epm instance location
  • Call the java class passing in the epm instance and user credentials.
So for my environment I used:

set classpath=.;E:\Oracle\Middleware\EPMSystem11R1\common\jlib\\epm_j2se.jar;

set EPM_ORACLE_INSTANCE=E:\Oracle\Middleware\user_projects\epmsystem1

java -DEPM_ORACLE_INSTANCE=%EPM_ORACLE_INSTANCE% refreshCache  admin password

The warnings can be ignored as they not important, I would recommend adding some encryption though as clear text credentials are not for the security conscious.

Checking the properties of the group in Shared Services confirms the refresh has happened with myself now displaying as a member.

If you are using essbase and run the above code the caching system essbase uses will not automatically trigger an update until a user logs in, so you could update the code to include a login using the essbase JAPI or Maxl and then you should see entries in the SharedServices_Security_Client.log to confirm the cache refresh did happen.

Well that completes #2, until next time..


Celvin Kattookaran said...

I thought that refreshcache just adds a pointer in the deltacache table that it is going to be a manual refresh.

I think the documentation also points in that direction, good to see it working though

John Goodwin said...

Hi Celvin,

You know Oracle like to confuse with documentation :)

It is pretty much similar code to what happens when you click the refresh button in Shared Services

amarnath said...

Thanks John
This is what I have been looking for.

Anonymous said...

If we click the Refresh Now, instead of using the API code- what are the pitfalls? Please let me know.Last week we had an issue.
we had 3 domains on the AD and in the shared servces, suddenly shared services stopped talking to one of the domain and all the users in that domain were not able to log in to HFM ( but they were able to work in Smart View)
We had to restart all the services to flush out any false DNS! out of the shared services..

May be a better suggestion would be available, if anyone can share it - that would be great.

Thanks in advance

John Goodwin said...

Using the Refresh Now is exactly the same as using the API code, it is the same code they both execute.