Wednesday 30 March 2016

Auto DDL: delete obsolete columns from table

A quick one. In the past I used to generate ddl based on queries, like the following. But I find myself to re-invent them again. So to have it saved for my offspring: here's one on deleting obsolete columns as generated on importing an excel sheet in SQLDeveloper:

declare
  l_schema_name varchar2(30) := 'MY_SCHEMA';
  l_table_name varchar2(30) := 'A_TABLE';
  cursor c_cols is 
    select column_name 
    from all_tab_columns col 
    where col.table_name = l_table_name 
    and col.owner = l_schema_name
    and col.column_name like 'COLUMN%';
begin
  for r_cols in c_cols loop
    execute immediate 'alter table '||l_schema_name||'.'||l_table_name||' drop column '||r_cols.column_name;
  end loop;
end;
/

And here's one to generate a check constraint on all index colunns of a table:
declare
  l_schema_name varchar2(30) := 'MY_SCHEMA';
  l_table_name varchar2(30) := 'A_TABLE';
  l_constraint_name_pfx varchar2(30) := 'XXX_ALIAS_CHK';
  l_idx pls_integer := 1;
  cursor c_cols is 
    select column_name 
    from all_tab_columns col 
    where col.table_name = l_table_name 
    and col.owner = l_schema_name
    and col.column_name like 'IND_%'; 
begin
  for r_col in c_col loop
    execute immediate 'ALTER TABLE '||l_schema_name||'.'||l_table_name||' ADD CONSTRAINT '||l_constraint_name_pfx||l_idx||' CHECK ('||r_col.column_name||' in (''J'',''N''))ENABLE';
    l_idx := l_idx+1;
  end loop;
end;
/

Wednesday 23 March 2016

Real-Time Integration Business Insight Available

To day Real-Time Integration Business Insight is available. I wrote about it in my summary of the OPN FMW Community forum. I hope I can get into it in the near future.

Enable Process Analytics in BPM12c

To be able to use BAM12c together with BPM12c, you'll need to enable process analytics. This means that only when that is enabled BAM12c will write the sample data to the proces cubes/star schema.

To do so you'll need to go to the enterprise manager (eg. http://darlin-vce-db:7001/em). Then open up the System MBean Browser. This can be started from the soa-infra:

And than from the SOA Infrastructure -> Administration -> System MBean Browser:


However, you can also start it a little quicker from the Weblogic Domain menu:
In the MBean Browser look for 'Application Defined MBeans':
Than look for 'oracle.as.soainfra.config'-> 'your server' -> AnalyticsConfig -> analytics:

Then in the pane make sure that both 'DisableAnalytics' and 'DisableProcessMetrics' are set to false:


 And click 'Apply'.

Above you'll see the layout of 12.2.1, but in 12.1.3 it works the same. Restart the SOA Server after that.

I'm not the first one to write about these changes, but I found that you can only update these fields if you have started the BAM server at least once. Apparently the BAM Server registers itself so that only after that you can update and apply these attributes.




BAM 12c: Extent Data objects

BAM 12c is a huge improvement against 11g. Best thing I think is that it is quite a lot easier to create a dashboard. There are several tutorials on BAM, for instance at the BAM12c site, so I'm not going to explain how to create a dashboard here.

One thing however on business queries: the examples mostly start with a BPM process and then query from the Process of Activity Data Object as created on deployment of the particular process. How-ever, often you'll find that you want to filter on a certain date range, for instance process started less than a day or a week ago. Or activities running less than an hour, or between an hour and two hours, two and three hours or longer. But then you'll find that you can't filter in the Business Queries on a date function. For instance you can't filter on something like  '{process start date} < now() - 7'.

To solve that you can add extra Calculated Fields that return yes or no or  1 or 0 if a certain date calculation condition is met. To do so go to the administration tab of the BAM Composer (eg. http://darlin-vce-db:7006/bam/composer):

 Then you can expand the Data Objects and you'll find that the process that is deployed resulted in two Dataobjects, one for Activities and one or the Process-instances:

By the way, to get those you can need to have the process analytics enabled. I'll explain that in another blog.

Click for instance on the CustomerSurvey Activity, then on the tab 'Calculated Fields' and then on 'Add Calculated Field':
d

You need to provide a name that has no spaces but only lowercase or uppercase letters and underscores. Then you can provide a name that is shown in the designer and in flat queries. The column type can be measure, dimension or attribute, but in this case you'll want attribute, to be able to filter on it. In this case I returned 'J' or 'N' for 'Ja' (Yes) or 'Nee' (No). This is sufficient for filtering. But if you want to count/summarize instances that are running less than one hour, or between one or two hours, etc., then you might want to return 1 or 0.

Click on OK and then save:

By clicking on the pencil-icon you can edit the field.

I'll provide some other examples that I found helpfull for the activity dataobject:



Field NameDisplay NameColumn TypeExpressiondescription
activity_started_lt_week_agoActivity started less than week agoAttributeIF(DATEDIFF(SQL_TSI_DAY,{Activity Start Time},now())<=7)THEN("J")ELSE("N")Is the activity started at most 7 days ago? (J/N)
activity_started_lt_day_agoActivity started less than day agoAttributeIF(DATEDIFF(SQL_TSI_HOUR,{Activity Start Time},now())<=24)THEN("J")ELSE("N")Is the activity started at most 24 hours ago? (J/N)
Activiteit_Looptijd_minActiviteit Loop tijd (min)AttributeIF({Activity Instance Status}=="ACTIVE")THEN(DATEDIFF(SQL_TSI_MINUTE,{Activity Start Time},now()))ELSE(DATEDIFF(SQL_TSI_MINUTE,{Activity Start Time},{Activity End Time}))Actual running time of the activity instance. If the instance is active, than the result is the difference between the start time and the current time (NOW()), otherwise it is the difference between de  start time and the end time. The "Activity Running Time" is aparently different from the predefined runningtime field, because of the sampling moments. Sometimes the Running time is near to zero, while the instance is still active.
Activiteit_Looptijd_lt_1hrActiviteit Looptijd < 1 uurAttributeIF({Activity Instance Status}=="ACTIVE")&&(DATEDIFF(SQL_TSI_MINUTE,{Activity Start Time},now())<60 td="">Is Activity Running less than an hour?
Activiteit_Looptijd_lt_2hrActiviteit Looptijd < 2 uurAttributeIF({Activity Instance Status}=="ACTIVE")&&(DATEDIFF(SQL_TSI_MINUTE,{Activity Start Time},now())>=60&&DATEDIFF(SQL_TSI_MINUTE,{Activity Start Time},now())<120 td="">Is Activity Running more than one but less than two hours?
Activiteit_Looptijd_lt_3hrActiviteit Looptijd< 3 uurAttributeIF({Activity Instance Status}=="ACTIVE")&&(DATEDIFF(SQL_TSI_MINUTE,{Activity Start Time},now())>=120&&DATEDIFF(SQL_TSI_MINUTE,{Activity Start Time},now())<180 td="">Is Activity Running more than two but less than three hours?
Activiteit_Looptijd_gt_maxActiviteit Looptijd > maxAttributeIF({Activity Instance Status}=="ACTIVE")&&(DATEDIFF(SQL_TSI_MINUTE,{Activity Start Time},now())>180)THEN(1)ELSE(0)Is Activity Running 3 hours or longer?
Activiteit_is_openActiviteit is open?AttributeIF({Activity Instance Status}=="ACTIVE")THEN("J")ELSE("N")Is the activity still Open?

For the process Data Objects these are a good starting point:
Field NameDisplay NameColumn TypeExpressiondescription
Process_Running_Time_Min_attrProcess Running Time (Min) AttrAttribute{Process Running Time (millisecs)}/600000Number of minutes a process is executed. There is another comparable field already defined, but that is of type 'Measurement'. You can't use that for  analytid functions as AVG, MIN, MAX, etc.
process_started_lt_week_agoProcess started less than week agoAttributeIF(DATEDIFF(SQL_TSI_DAY,{Process Start Time},now())<=7)THEN("J")ELSE("N")Is the process instantie started at most 7 days ago? (J/N)
process_started_lt_day_agoProcess started less than day agoAttributeIF(DATEDIFF(SQL_TSI_HOUR,{Process Start Time},now())<=24)THEN("J")ELSE("N")Is the process instance started at most 24 hours ago? (J/N)
Process_Looptijd_in_minProcess Looptijd (min)AttributeIF({Process Instance Status}=="ACTIVE")THEN(DATEDIFF(SQL_TSI_MINUTE,{Process Start Time},now()))ELSE(DATEDIFF(SQL_TSI_MINUTE,{Process Start Time},{Process End Time}))Actual running time of the process instance. If the instance is active, than the result is the difference between the start time and the current time (NOW()), otherwise it is the difference between de  start time and the end time. The "Process Running Time" is aparently different from the predefined runningtime field, because of the sampling moments. Sometimes the Running time is near to zero, while the instance is still active.
So these help you in filter and aggregate on activity and process running times. Sorry for the dutch names, but I figure you can get the meaning.

The expressions are based on info I got from the user guide. You can find the 12.2.1 user guide over here. The 12.1.3 can be found here. Look for chapter 13.8 (in the 12.2.1 user guide) or 14.8 (in the 12.1.3 user guide).

Tuesday 22 March 2016

Unable to logon to BPM Workspace

Yesterday I tried to test a demo bpm process with a few tasks. But I couldn't logon to the workspace. I couln't find an error, except for:

<[ServletContext@452818297[app:OracleBPMWorkspace module:/bpm/workspace path:null spec-version:3.1]] Servlet failed with an Exception java.lang.IllegalStateException: Response already committed

I tried several optional solutions, like setting the listen-address, that did not work. What solved the issue was setting the ServerURL in the System MBean browser of the soa-infra.
To do so in BPM12cR2, go to the Enterprise Manager, (eg. http://darlin-vce-db:7001/em as it is in my VM) and go to the soa-infra:
Then in the SOA Infrastructure -> Administration menu open the System MBean Browser:
In the System MBean Browser look for the Application Defined MBeans and expand it:
Within the Application Defined MBeans, expand 'oracle.as.soainfra.config', then your server  and then 'SoaInfraConfig' and click on soa-infra:
Find the attribute ServerURL and edit it to the host:port of your soa-server, including the 'http://' protocol, eg. 'http://darlin-vce-db:7005':
 

Don't forget to hit the enter key and click on Apply:


Restart your server and it should be good to go.

Saturday 19 March 2016

OPN Fusion Middleware Community Forum 2016: my summary

I just boarded on my flight back to Amsterdam and  I'd grab a chance to put down my first impressions of this week.

Apart from catching a flu, it was a great event. As could be expected the word describing the weather fenomena I'm about to enter resonates throughout the whole event. (For those who didn't catch my vague description: it's 'Cloud, Cloud,  Cloud).

One of the presenters put that Oracle needs to go for 100% Cloud for a while to become a recognised Cloud provider. But in a few years it wil most probably turn out that in most cases we wil be in a hybrid environment. And then Oracle will have the best papers to provide for both Cloud and On-Premise.  By the way: Oracle will encounter the same problems with upgrades that customers have for years.  So it can be expected that upgrading Oracle software will improve over time as well.

The most interesting session on the first day for me was the session of Grant Ronald about Application Builder Cloud Service and Max: Mobile Application Accelerator.  The latter is a little like Forms Builder in the cloud to build an app the 4 GL way.  Very cool in my opinion and Grant was amusing as always.  Smart to give him the last slot of the day.

The second day started for me with an excellent introduction and demo of Real Integration Business Insight or in short Insight.  Although leveraging BAM it has a whole different approach.  With BAM you need to complete your composite with Business Indicator definitions and deploy it. Only then you can define your queries, views and dashboard.  But with Insight you can do it top down. You don't need to define any indicators or sensors in your composites or service bus projects.  You define a model with milestones and Business Indicators afterwards in Insight. Then you need to map the indicators and milestones to particular points in your services.  Probably this is done by a more technical person or architect, who knows the implementation of the services.  For the rest business users can implement it. Your model can even span composites that are not interrelated with an ECID, using a correlation key.  This comes in convenient in cases like where  one BPEL process writes something to a database and later another instance picks it up.  Logically you're still working on the same business process but for SOA Suite it wasn't the same flow anymore.  Did you get that I mentioned Service Bus?  Besides BPEL it works for SB as well.  And since BAM is leveraged you'll find the models back in the data sources so you'll be able to expand from there and use the BAM functionality to join it with other sources. 

I took some sessions on PCS. They announced a few new capabilities for the next few releases.  For me Correlation Sets is a highly appreciated addition.  We have it in BPEL from the first release.  In BPM it was added to to the second patchset and apparently they left it out of PCS. Probably because correlation is hard to grasp. But when you want to interact with a running process you need to indicate how the engine can conclude for which instance the incoming event is meant. 

There is a very native integration with DOCS so you can add documents to a folder related to the process instance.  But there will be a new start event to start an instance on arrival of a document in a certain folder.  This caters for an end 2 end document workflow.  Thight integration with Oracle Social Network allows you to interact with peers on an task.

Another thing I took from there was that apparently we still see PCS too much as a stripped down version of BPM Suite in the cloud.  So we tend to think in ways like: 'why is this piece of BPM functionality not in PCS' or 'In BPM we can do this, why can't we do that in PCS as well?'. But although BPM was the starting point I believe that we need to start seeing it as a whole separate product with its own purpose. So let's think from PCS and think on how this could be used and grown up  as a child on it's own legs. So that needed to come of my chest... ;).

The day ended with a nice ACE hacking event on how you could build a showcase with as many Cloud Services as you can.  Not everything went smooth but I think they did a good job.

I took the PCS Hybrid Applications track for the workshop.  It could have been a little more elaborate but it was nice. Got to play with the upcoming April release of PCS in a VM. It looked great. If I get the chance I'll post a little bit more on that later on.

Yesterday we went into the city of Valencia for the Fallas Festivities.  I learned this morning it had something to do with carpenters and to burn their waste.  The whole week there were lots of fireworks, even older people walk around with a box of fireworks and throw around fire-crackers: something we see only teenagers doing on the day before new year. And there were processions and funny statue groups. 

So that completes my overview I think.  I hope I'll be able to write about some subjects in a little more detail soon.

Friday 18 March 2016

BPM QuickStart 12c on Windows 10

As many people probably did, I upgraded my laptop to Windows 10. Actually after that I re-installed even windows 10, since I installed an SSD drive (a Samsung EVO 850, which is really fast).

Earlier I wrote about installing SOA/BPM QuickstartInstaller, using silent install. All goes well, but where in 12.1.3 you actually can succesfully create a domain, with 12.2.1 you can't. I don't know why I got it working with 12.1.3, but I found why it doesn't in 12.2.1.

I turns out to be a recurring problem that also arose in JDeveloper 11g and it is caused by jython being not able to recognize the OS.

If you open the jython-modules.jar that can be found here %FMW_HOME%\wlserver\common\wlst\modules, then you'll find a 'Lib' folder with in it the file javashell.py. You can open the jar file using an archiver, I used my favorite tool TotalCommander, with the key-combi <CTRL>-<PgDn>.

Copy the file out of it and find the part '_osTypeMap' and add the string 'Windows 10' to the 'nt' list:

_osTypeMap = (
        ( "nt", ( 'nt', 'Windows NT', 'Windows NT 4.0', 'WindowsNT',
                  'Windows 2000', 'Windows 2003', 'Windows XP', 'Windows CE',
                  'Windows Vista', 'Windows Server 2008', 'Windows 7', 'Windows 8', 
                  'Windows Server 2012', 'Windows 10' )),
        ( "dos", ( 'dos', 'Windows 95', 'Windows 98', 'Windows ME' )),
        ( "mac", ( 'mac', 'MacOS', 'Darwin' )),
        ( "None", ( 'None', )),
        )

Just copy it back in to the jar file, overwriting the older version. By the way, although I found out earlier that the fault was in the jython install, the real thanks should go to Christos Vezalis, for his great explanation and the actual solution (I did not know what the string should be).

By the way, this same solution works for JDeveloper 12c as well.

Update dd. september 25th 2016: apparently there's a patch for this now. Read ' Unable to start the JDeveloper Integrated WebLogic server in 12.2.1.0.0 on Windows 10, 'Failed to get environment' (Doc ID 2123739.1)'. The patch is 22138883, that solves just that. Found this in an answer by Anshul on the community forum.