Sunday, December 13, 2015

Cleaning up the EJBTimers DB


WebSphere will use an internal derby database for EJBTimers to persist .
The ejbtimers will survive the server crash as well as server restart as they are persisted in database.
EJB Timer service settings can be changed via the WebSphere console. The description for settings can be easily found in the IBM knowledge center. 
Below is one of the links for WebSphere 8.5.5
EJBTimer can also be easily configured to persist in a different database like oracle. What we need to define is just a different DataSource with an authentication alias. While server is restarted , WebSphere will automatically create the 4 tables required by EJBTimer service. You may use any DataSource available as EJBTimer tables will not interfere with other schema and table’s .You can also define a prefix for the EJBTimer tables in the EJBTimer service settings. Make sure to have the create table permission for authentication alias you are using.
There are also some other important parameters for EJBTimer like poll interval, number of timer threads which can be used to customize the behavior of EJBTimer as per your requirements.
In case, you are using the default EJBTimer DB which is derby. Then, how can you clean the DB. This is an unanswered question in IBM knowledge center.
The procedure is simple which I have found by trial and error methods.
Stop the server. This server is the server for which you are planning to clean the EJBTimer db.
Go to
WAS_INSTALL_ROOT/profiles/Profile Name/databases/EJBTimers/Server Name/EJBTimerDB
and rename the existing directory EJBTimerDB to  EJBTimerDB_bak.
Later you can remove this directory after few days of testing. I am recommending this as this is a solution I found by trial and error and there is no official documentation for it.
Start the server.
You can verify that after server is restarted, a new directory EJBTimerDB is created
Location of an example directory on windows operating system is shown below.
I have tested the proposed solution in Solaris as well as windows operating system.




1 comment:

Anonymous said...

Great answer