Ipurge

No, it’s not another Apple app, it’s an handy tool that comes with the Cyrus mailserver package to delete mail from IMAP mailboxes. I have setup two entries to get rid of unnecessary messages from the spam and trash folders for all users.
The following rules have been added to the EVENTS list on /etc/cyrus.conf.


# purge trash messages older than 2 weeks
purgetrash      cmd="/usr/sbin/ipurge -X -d 14 -f user.*.Trash" at=0600
# purge spam messages older than 4 weeks
purgetrash      cmd="/usr/sbin/ipurge -X -d 28 -f user.*.Spam" at=0630

It took me some time to figure out the correct matching pattern and at first I was a little bit scared to use the -f option. The man page for ipurge says "-f Force deletion of mail in all mailboxes." But you'll need it, without it won't work.

I like this way of cleaning up!

Oracle RAC connect string for JDBC

For a Tomcat installation I needed to connect to a Oracle RAC database backend. I figured out the correct connection string, shown below:

jdbcUrl="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac01)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=rac02)(PORT=1521))(LOAD_BALANCE=on)(FAILOVER=on)(CONNECT_DATA=(SERVICE_NAME=orcl)))"

Secured by CAcert

In oder to secure this personal website I have recently joined the CAcert community. This community driven certificate authority issues free public key certificates. After signing up I created two server certificates, one for the webserver and the other one for secure mail and ldap services.
So if you are using any web or mail related service on the vleeuwen.net domain I would recommend to import the CAcert root certificate. See the CAcert site for more information.

Hopefully one day Mozilla will make the right decision and include the CAcert root keys in their products.

tracing SQL in Oracle

If you want to know what SQL statements are actually being executed by an application because something goes wrong and there is no clear error message explaining what’s happening you can use SQL Trace. SQL Trace can be enabled on the current session, the session of another user or the complete database.

To enable SQL Trace on the current session

alter session set sql_trace = true;

You can find the output of the trace in the udump directory of the database (see the value of parameter user_dump_dest). You can chose to give the tracefile another name, see the next example:

alter session set sql_trace = true;
alter session set tracefile_identifier = customname;

When done tracing you’ll need to stop the trace:

alter session set sql_trace = false;

To enable SQL trace on another session
You’ll first need to know which session to trace, by looking up the sid and serial#:

select s.sid,
s.serial#,
s.osuser,
s.program
from v$session s;

Start the trace on sid number 8 and serial 13607:

alter system set timed_statistics = true;
execute dbms_system.set_sql_trace_in_session(8, 13607, true);

Carry out the to trace actions and stop the trace:

execute dbms_system.set_sql_trace_in_session(8,13607, false);

You can find the output again in the udump destination.

Trace the complete database

Start SQL Trace on the complete database:

alter system set sql_trace = true scope=memory;

Stop SQL Trace on the complete database:

alter system set sql_trace = false scope=memory;