Wednesday, October 30, 2013

Teamworks Localhost Access Log - 6.2 and JBoss

How To Configure Localhost Access log in Teamworks 6.2 on JBoss

Teamworks localhost access log provides a means to track the requests and responses passing through the JBoss server. This includes access to all the static files (images, JS and CSS) as well as the dynamic resources (JSP, Servlets). 

This configuration can be found in the file process-server/deploy/jbossweb-tomcat55.sar/server.xml. In this file locate the entry <Valve className="org.apache.catalina.valves.FastCommonAccessLogValve", un-comment this tag to enable the logging. For various aspects of logging available, please refer the link given below.


Note: Tomcat does not support automatic house keeping of the logs, i.e. if you need to keep only "n" days worth of log, you would need to schedule jobs to delete the logs jobs. Tomcat does not handle this.

Tuesday, October 29, 2013

Oracle Automatic Segment Advisor - Read Advisor findings

Oracle Automatic Segment Advisor runs during maintenance window and collects information regarding various facets of your database, namely SQL optimization, table segment fragmentation, I/O wait reduction methods, ...

You can use a combination of DBA_ADVISOR_FINDINGS, DBA_ADVISOR_OBJECTS AND DBA_ADVISOR_LOG to read those findings.

The underlying query gives you the findings related to tables.
SELECT TO_CHAR(log.execution_start, 'YYYY-MM-DD') AS "ADVISOR DATE",
  af.task_name,
  ao.owner,
  ao.attr2 segname,
  ao.attr3 partition,
  ao.type,
  af.message
FROM dba_advisor_findings af,
  dba_advisor_objects ao,
  dba_advisor_log log
WHERE ao.task_id        = af.task_id
AND ao.task_id          = log.task_id
AND ao.object_id        = af.object_id
AND ao.type             = 'TABLE'
AND log.execution_start > SYSDATE-1
ORDER BY log.execution_start DESC, ao.attr2;

Friday, October 25, 2013

Setup a node as Event Manager on Lombardi 6.2

Event manager nodes are used to process system tasks and move tokens between tasks. In a high performance system its desirable to have a cluster of servers, some of which serve user traffic (User Nodes) and others dedicated for system activities (Event Manager Nodes). 

The config file 80EventManager.xml located at process-server/resources/config/system determines if a node has an event manager instance. There is a boolean flag on the xpath "/properties/event-manager/enable" that governs if an event manger instance is set up or not. 
Caution: Never modify any system configuration directly. Always use a overriding configuration file.

Check the table "LSW_EM_INSTANCE" in the process-server database to check which instances are setup as event-manager nodes, in a clustered environment.

Wednesday, October 23, 2013

Connect to Oracle RAC Database server

Oracle RAC database uses service-name instead of service-id. Hence, you would need a connection string formatted for using service-name.

Lets say your non-RAC server was hosted on "abc.xyz.com" @ port 1521 and your SID is oradb01, then your connection string would have been :
  jdbc:oracle:thin:@abc.xyz.com:1521:oradb01

On a oracle RAC database server with service-name as oradb01, your connection string would be :
 jdbc:oracle:thin:@//abc.xyz.com:1521/oradb01

Note : I assume you are using Oracle thin driver for Java.

Friday, September 27, 2013

Oracle Convert CSV to ROW

Allow Only Numeric values in the CSV : 
WITH parameter_csv AS (select :1 as val from dual)
SELECT  REGEXP_REPLACE(REGEXP_SUBSTR( val, '[^,]+', 1, LEVEL ),'[^0-9]','')  AS id
           FROM    parameter_csv
           CONNECT BY LEVEL <=
                LENGTH( REGEXP_REPLACE(val, '[^,]+', '' ) ) + 1


If you can afford it not to be parametrized (no ? marks in SQL) Needs Oracle 11g:
select * from xmltable('"this","is","my","csv"');
or 
select * from xmltable('1,2,3,4');

Tuesday, September 10, 2013

How to Refresh Coach Designer HTML (TW 6.2.2)

Problem Statement
You want to refresh the HTML generated by combining the Coach's XML and CoachDesigner.xsl

How To Do That?
Use "touch" command on *nix platforms to update timestamp of CoachDesigner.xsl file. The HTML will be refreshed next time any user requests for that Coach.

Useful SQL
select
 pi.name,
 p.last_modified AS "Service Modified On",
 pi.twcomponent_id,
 pi.process_item_id,
 pi.last_modified AS "Coach Last Modified On",
 cr.resource_data,
 cr.virtual_name,
 cr.last_modified AS "Coach XML/HTML Modified",
 cr.coach_resource_id
from
 tw_proc.lsw_process_item pi,
 tw_proc.lsw_process p,
 TW_PROC.lsw_coach_resource cr
where
  pi.process_id = p.process_id and
  pi.twcomponent_name = 'Coach' and
  p.name = '<NAME OF SERVICE>' and
  pi.twcomponent_id = cr.coach_id;