WebLogic Server – Using JDBC TLOG Store

Peter Lorenzen
10/09-2013

From WebLogic Server 10.3.6 and onwards it is possible to store JTA transaction logs (TLOG) in a database persistent store instead of in a file store.

Overview

Create database user

create user tlog identified by welcome1;
grant connect, resource to tlog;

Create Data Source via Admin Console

Domain Structure => Services => Data Sources




You cannot use a XA JDBC driver.


You cannot select Supports Global Transactions.



Test the connection.


Create Data Source via WLST

Execute the dataSource.py script.

. /u01/app/oracle/product/wls103/wlserver_10.3/server/bin/setWLSEnv.sh
java weblogic.WLST -skipWLSModuleScanning
connect(username='weblogic',password='welcome1',url='t3://wintermute:7001')
execfile('dataSource.py')

Configure JDBC TLOG store via Admin Console

Domain Structure => Environment => Servers => managed01 => Services

Restart the server. It will automatically create a TLOG_TEST_WLSTORE table.

Configure JDBC TLOG store via WLST

Execute the tlogJDBCstore.py script.

. /u01/app/oracle/product/wls103/wlserver_10.3/server/bin/setWLSEnv.sh
java weblogic.WLST -skipWLSModuleScanning
connect(username='weblogic',password='welcome1',url='t3://wintermute:7001')
execfile('tlogJDBCstore.py')

Restart the server. It will automatically create a TLOG_TEST_WLSTORE table.

LONG RAW => BLOB => SecureFiles

The WebLogic server will default create a TLOG table that contains a LONG RAW column.This is true for version 10.3.6, 12.1.1 and 12.1.2.

SQL> desc TLOG_TEST_WLSTORE
 Name                          Null?    Type
 ----------------------------- -------- -----------
 ID                            NOT NULL NUMBER(38)
 TYPE                          NOT NULL NUMBER(38)
 HANDLE                        NOT NULL NUMBER(38)
 RECORD                        NOT NULL LONG RAW

LONG RAWs can make your DBA cry and should be avoided like the plague!

The are many restrictions for the use of LONG RAWs. There is also many restrictions on which tools and operations your DBA can use when LONG RAWs are in play.

Oracle has warned against these problems since at least version 9i and maybe even 8i. LONG RAW has been depreciated since 9i.

Luckily WebLogic contains scripts to create tables that uses a BLOB or a SecureFile BLOB instead.
SecureFile was introduced with the 11g database, and is an reimplementation of LOB storage that performs better and is more secure.

To use BLOB/SecureFile you can configure WebLogic to use a different script when creating the TLOG table.

Domain Structure => Environment => Servers => managed01 => Services

You can use these values for the “Create Tables from DLL file” field.

/oracle_blob.ddl
/oracle_blob_securefile.ddl

You need to stop the WebLogic server and drop any existing table. When you start the server again it will create the table again with the alternative script.

Unfortunately this does not work because of a bug. Check MOS note:
“WebLogic Server throwing “weblogic.store.io.jdbc.JDBCStoreException” errors during startup with JDBC persistent store using oracle_blob.ddl (Doc ID 1083924.1)”

I have tested with version 10.3.6, 12.1.1 and 12.1.2 and it does not work in any of them.

It is not a big problem to get around since you can just extract the file yourself and input an absolute path to it in “Create Tables from DLL file”.

It is easier to just execute the script manually via SQL*Plus.

Extracting the files.

cd /tmp
/u01/app/oracle/product/java_current/bin/jar xvf /u01/app/oracle/product/wls103/modules/com.bea.core.store.jdbc_1.3.1.0.jar weblogic/store/io/jdbc/ddl/oracle_blob_securefile.ddl
/u01/app/oracle/product/java_current/bin/jar xvf /u01/app/oracle/product/wls103/modules/com.bea.core.store.jdbc_1.3.1.0.jar weblogic/store/io/jdbc/ddl/oracle_blob.ddl 

Use one of the scripts to create a LONG RAW free table. If you use SQL*Plus you need to change the table name in the script.

SQL> desc TLOG_TEST_WLSTORE
 Name                          Null?    Type
 ----------------------------- -------- -----------
 ID                            NOT NULL NUMBER(38)
 TYPE                          NOT NULL NUMBER(38)
 HANDLE                        NOT NULL NUMBER(38)
 RECORD                        NOT NULL BLOB

Leave a Comment

Previous post:

Next post: