lunedì 1 dicembre 2014

Unix Tip: executing processes in serial/parallel mode

I am working for a customer that has set up tons of processes that are executed periodically by a scheduler.
We are currently applying modifications to these scripts and we need to execute them frequently to check results. The scheduler is a very old fashioned one and the quickest way to simulate an execution is to create a Unix script that execute processes in the same way, which means simulating serial and parallel executions.

Let's think about the following situation:

We want to execute first the script A.sh and then in parallel the scripts B.sh and C.sh and finally the script D.sh.
The following script does the job:

serial_parallel_scripting.sh

./A.sh &
wait
./B.sh &
./C.sh &
wait
./D.sh

The ampersand symbol (&) executes the job in background and the wait command will wait for the script to terminate. The script will first execute the A.sh script and wait for it to end. Later it will execute B.sh and C.sh scripts in parallel. Finally, when both of them terminate, it will execute the D.sh script.

lunedì 13 ottobre 2014

Oracle Tip: enabling GRANTS in SQL generation in Oracle SQL Developer

It is quite an annoying thing when you copy DDL generated code for a table in Oracle SQL Developer and you forget GRANTS. This is because in SQL Developer GRANTS are not showed by default.
To show permissions in the code, you have to change the default settings of the product.
In the Tools -> Preferences, locate the Database -> Export node and tick the "Grants" option.


mercoledì 16 luglio 2014

Oracle Tip: Error in BI Publisher Desktop Installation and issue with Microsoft Office 2013

I tried to install Oracle BI Publisher Desktop 11.1.1.7 on my Windows 64 laptop for Microsoft Office 2013 32bits and I got the following error:

"Please make sure JRE version 1.6 or later is installed"

I had Java 1.6 45 32 bit installed and working fine. After struggling in understanding what was wrong, I did the following:

  • Uninstall all Java JRE and JDK from your laptop
  • Install Java JDK 32 bit
  • Install Java JDK 64 bit
  • Reboot the laptop 
  • Install BI Publisher Desktop
The installation went through with no issues, but when I opened Microsoft Word I could not see the BI Publisher tab. The Add-in was not even in the list of available Add-ins for Word.
Google helped me once more and I found a note saying that you have to look for Program Files (x86)\Oracle\BI Publisher\BI Publisher Desktop\DotNetInstallFiles folder and execute setup.exe (close any Office application before starting the installation). I just followed the instructions and at the end the BI Publisher tab was finally there.


martedì 27 maggio 2014

Unix Tip: How to format LS output

Issue
I want to use Unix ls command output and write it to a well-formatted file
Solution:
I just used the following command:

ls -ltra | awk -v OFS=";" '$1=$1'

in a bash script.
OFS parameter is used for specifying the separator for the file.


You can redirect the output to a file and then process it as it was a semicolon delimited file.




martedì 18 marzo 2014

Oracle Tip: Make OBIEE Answers open on Criteria tab

If you are working with a "not so quick" environment (it takes more than a few seconds to show results), it could be annoying waiting for the results to appear until you can switch to the 'Criteria' tab.
To change the default option, go to My Account and select Analysis Editor -> Start on Criteria.



mercoledì 12 marzo 2014

Oracle Tip: Exception in thread "DwgCmdScheduler"

A customer had an issue with a StandAlone ODI Agent. Apparently the agent was up and running, but it was not possible to schedule any job.
ODI version was 11.1.1.6 installed on Unix Server.
I manually stopped the agent and restarted it using the following commands:


./agentstop.sh -NAME=<AGENT_NAME> -PORT=<PORT_NUMBER>



./agent.sh -NAME=<AGENT_NAME> -PORT=<PORT_NUMBER>

2014-03-11 10:36:33.325 NOTIFICATION ODI-1128 Agent <AGENT_NAME> is starting. Application Server: STANDALONE. Agent Version: 11.1.1.6.0 - 19/12/2011. Port: 20910. JMX Port: 21910.
2014-03-11 10:36:36.132 NOTIFICATION ODI-1136 Starting Schedulers on Agent <AGENT_NAME>.
2014-03-11 10:36:36.538 NOTIFICATION ODI-1111 Agent <AGENT_NAME> started. Agent version: 11.1.1.6.0 - 19/12/2011. Port: 20910. JMX Port: 21910.
Exception in thread "DwgCmdScheduler-WORK_REP_PRO" java.lang.NullPointerException
at com.sunopsis.timer.filterbased.SnpsBetweenHoursFilter.equals
(SnpsBetweenHoursFilter.java:112)
at java.util.AbstractList.equals(AbstractList.java:524)
at com.sunopsis.timer.filterbased.FilterBasedTaskScheduleDefinition.equals
(FilterBasedTaskScheduleDefinition.java:50)
at com.sunopsis.timer.SnpsTaskManager.updateDefinitionList(SnpsTaskManager.java:94)
at com.sunopsis.timer.SnpsAbstractScheduler.run(SnpsAbstractScheduler.java:161)
at oracle.odi.runtime.agent.scheduler.OdiAgentScheduler.run(OdiAgentScheduler.java:138)
at java.lang.Thread.run(Thread.java:679)
2014-03-11 10:36:36.805 NOTIFICATION ODI-1137 Scheduler started for work repository WORK_REP on Agent <AGENT_NAME>

The error shows an issue with starting scheduler components of the agent. I googled the error and I did not find anything useful. So I tried creating a new agent with the same parameters (server and port number) and I could start it and schedule jobs. Then, what was wrong with the original agent?
Thanks to Oracle Support, I found out that there is a bug that raises this issue whenever just one column out of S_BEGIN_HOUR and S_END_HOUR in table SNP_PLAN_AGENT of the Work Repository has values in it.



“Problem Description

-------------------

There are two columns in the SNP_PLAN_AGENT, S_BEGIN_HOUR and S_END_HOUR.

Generally, S_BEGIN_HOUR and S_END_HOUR columns either both shows the correct 

time value or both NULL.

However, our ODI customer has faced major problems due to only one of the 

columns showed NULL and the other column showed the time value.”
 

I connected to the Work Repository and executed the following query:



select *
from SNP_PLAN_AGENT
where LAGENT_NAME = <AGENT_NAME>

and I have detected a line having S_BEGIN_HOUR = '01/01/70' and S_END_HOUR = null. 
I have updated the line setting S_BEGIN_HOUR to null in order to have both columns set to null. 


update SNP_PLAN_AGENT 
set S_BEGIN_HOUR = NULL  
where LAGENT_NAME = <AGENT_NAME> AND S_BEGIN_HOUR IS NOT NULL;  
COMMIT;  

I then tried to start the agent and it worked. No warnings and scheduling back up and running!