Each database management system has its own characteristics that results in feature coverage in SymmetricDS. The following table shows which features are available by database.
|Database||Versions supported||Transaction Identifier||Fallback Update||Conditional Sync||Update Loop Prevention||BLOB Sync||CLOB Sync|
|Oracle||8.1.7 and above||Y||Y||Y||Y||Y||Y|
|MySQL||5.0.2 and above||Y||Y||Y||Y||Y||Y|
|PostgreSQL||8.2.5 and above||Y (8.3 and above only)||Y||Y||Y||Y||Y|
Table C.1. Support by Database
On Oracle Real Application Clusters (RAC), sequences should be ordered so data is processed in the correct order. To offset the performance cost of ordering, the sequences should also be cached.
alter sequence SEQ_SYM_DATA_DATA_ID cache 1000 order; alter sequence SEQ_SYM_OUTGOIN_BATCH_BATCH_ID cache 1000 order; alter sequence SEQ_SYM_TRIGGER_RIGGER_HIST_ID cache 1000 order; alter sequence SEQ_SYM_TRIGGER_TRIGGER_ID cache 1000 order;
While BLOBs are supported on Oracle, the LONG data type is not. LONG columns cannot be accessed from triggers.
Note that while Oracle supports multiple triggers of the same type to be defined, the order in which the triggers occur appears to be arbitrary.
The SymmetricDS user generally needs privileges for connecting and creating tables (including indexes), triggers, sequences, and procedures (including packages and functions). The following is an example of the needed grant statements:
GRANT CONNECT TO SYMMETRIC; GRANT RESOURCE TO SYMMETRIC; GRANT CREATE ANY TRIGGER TO SYMMETRIC; GRANT EXECUTE ON UTL_RAW TO SYMMETRIC;
Partitioning the DATA table by channel can help insert, routing and extraction performance on concurrent, high throughput systems. TRIGGERs should be organized to put data that is expected to be inserted concurrently on separate CHANNELs. The following is an example of partitioning. Note that both the table and the index should be partitioned. The default value allows for more channels to be added without having to modify the partitions.
CREATE TABLE SYM_DATA ( data_id INTEGER NOT NULL , table_name VARCHAR2(50) NOT NULL, event_type CHAR(1) NOT NULL, row_data CLOB, pk_data CLOB, old_data CLOB, trigger_hist_id INTEGER NOT NULL, channel_id VARCHAR2(20), transaction_id VARCHAR2(1000), source_node_id VARCHAR2(50), external_data VARCHAR2(50), create_time TIMESTAMP ) PARTITION BY LIST (channel_id) ( PARTITION P_CONFIG VALUES ('config'), PARTITION P_CHANNEL_ONE VALUES ('channel_one'), PARTITION P_CHANNEL_TWO VALUES ('channel_two'), ... PARTITION P_CHANNEL_N VALUES ('channel_n'), PARTITION P_DEFAULT VALUES (DEFAULT));
CREATE UNIQUE INDEX IDX_D_CHANNEL_ID ON SYM_DATA (DATA_ID, CHANNEL_ID) LOCAL ( PARTITION I_CONFIG, PARTITION I_CHANNEL_ONE, PARTITION I_CHANNEL_TWO, ... PARTITION I_CHANNEL_N, PARTITION I_DEFAULT );
MySQL supports several storage engines for different table types. SymmetricDS requires
a storage engine that handles transaction-safe tables. The recommended storage engine
is InnoDB, which is included by default in MySQL 5.0 distributions.
Either select the InnoDB engine during installation or modify your server configuration.
To make InnoDB the default storage engine, modify your MySQL server configuration file
my.ini on Windows,
my.cnf on Unix):
default-storage_engine = innodb
Alternatively, you can convert tables to the InnoDB storage engine with the following command:
alter table t engine = innodb;
On MySQL 5.0, the SymmetricDS user needs the SUPER privilege in order to create triggers.
grant super on *.* to symmetric;
On MySQL 5.1, the SymmetricDS user needs the TRIGGER and CREATE ROUTINE privileges in order to create triggers and functions.
grant trigger on *.* to symmetric;
grant create routine on *.* to symmetric;
Starting with PostgreSQL 8.3, SymmetricDS supports the transaction identifier. Binary Large Object (BLOB) replication is supported for both byte array (BYTEA) and object ID (OID) data types.
In order to function properly, SymmetricDS needs to use session variables.
On PostgreSQL, session variables are enabled using a custom variable class.
Add the following line to the
of PostgreSQL server:
custom_variable_classes = 'symmetric'
This setting is required, and SymmetricDS will log an error and exit if it is not present.
Before database triggers can be created by in PostgreSQL, the plpgsql language handler must be installed on the database. The following statements should be run by the administrator on the database:
CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler AS '$libdir/plpgsql' LANGUAGE C; CREATE FUNCTION plpgsql_validator(oid) RETURNS void AS '$libdir/plpgsql' LANGUAGE C; CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler VALIDATOR plpgsql_validator;
SQL Server was tested using the jTDS JDBC driver.
HSQLDB was implemented with the intention that the database be run embedded in the same JVM process as SymmetricDS. Instead of dynamically generating static SQL-based triggers like the other databases, HSQLDB triggers are Java classes that re-use existing SymmetricDS services to read the configuration and insert data events accordingly.
The transaction identifier support is based on SQL events that happen in a 'window' of time. The trigger(s) track when the last trigger fired. If a trigger fired within X milliseconds of the previous firing, then the current event gets the same transaction identifier as the last. If the time window has passed, then a new transaction identifier is generated.
The H2 database allows only Java-based triggers. Therefore the H2 dialect requires that the SymmetricDS jar file be in the database's classpath.
The Derby database can be run as an embedded database that is accessed by an application or a standalone server that can be accessed from the network. This dialect implementation creates database triggers that make method calls into Java classes. This means that the supporting JAR files need to be in the classpath when running Derby as a standalone database, which includes symmetric-ds.jar and commons-lang.jar.
The DB2 Dialect uses global variables to enable and disable node and trigger synchronization. These variables are created automatically during the first startup. The DB2 JDBC driver should be placed in the "lib" folder.
Currently, the DB2 Dialect for SymmetricDS does not provide support for transactional synchronization. Large objects (LOB) are supported, but are limited to 16,336 bytes in size. The current features in the DB2 Dialect have been tested using DB2 9.5 on Linux and Windows operating systems.
There is currently a bug with the retrieval of auto increment columns with the DB2 9.5 JDBC drivers that causes some of the SymmetricDS configuration tables to be rebuilt when auto.config.database=true. The DB2 9.7 JDBC drivers seem to have fixed the issue. They may be used with the 9.5 database.
A system temporary tablespace with too small of a page size may cause the following trigger build errors:
SQL1424N Too many references to transition variables and transition table columns or the row length for these references is too long. Reason code="2". LINE NUMBER=1. SQLSTATE=54040
Simply create a system temporary tablespace that has a bigger page size. A page size of 8k will probably suffice.
The Firebird Dialect requires the installation of a User Defined Function (UDF) library in order to provide functionality needed by the database triggers. SymmetricDS includes the required UDF library, called SYM_UDF, in both source form (as a C program) and as pre-compiled libraries for both Windows and Linux. The SYM_UDF library is copied into the UDF folder within the Firebird installation directory.
For Linux users:
cp databases/firebird/sym_udf.so /opt/firebird/UDF
For Windows users:
copy databases\firebird\sym_udf.dll C:\Program Files\Firebird\Firebird_2_0\UDF
The following limitations currently exist for this dialect:
The outgoing batch does not honor the channel size, and all outstanding data events are included in a batch.
Syncing of Binary Large Object (BLOB) is limited to 16K bytes per column.
Syncing of character data is limited to 32K bytes per column.
The Informix Dialect was tested against Informix Dynamic Server 11.50, but older versions
may also work. You need to download the Informix JDBC Driver (from the
IBM Download Site)
and put the
in the SymmetricDS
Make sure your database has logging enabled, which enables transaction support. Enable logging when creating the database, like this:
CREATE DATABASE MYDB WITH LOG;
Or enable logging on an existing database, like this:
ondblog mydb unbuf log ontape -s -L 0
The following features are not yet implemented:
Syncing of Binary and Character Large Objects (LOB) is disabled.
There is no transaction ID recorded on data captured, so it is possible for data to be committed within different transactions on the target database. If transaction synchronization is required, either specify a custom transaction ID or configure the synchronization so data is always sent in a single batch. A custom transaction ID can be specified with the tx_id_expression on TRIGGER. The batch size is controlled with the max_batch_size on CHANNEL. The pull and push jobs have runtime properties to control their interval.
The Interbase Dialect requires the installation of a User Defined Function (UDF) library in order to provide functionality needed by the database triggers. SymmetricDS includes the required UDF library, called SYM_UDF, in both source form (as a C program) and as pre-compiled libraries for both Windows and Linux. The SYM_UDF library is copied into the UDF folder within the Interbase installation directory.
For Linux users:
cp databases/interbase/sym_udf.so /opt/interbase/UDF
For Windows users:
copy databases\interbase\sym_udf.dll C:\CodeGear\InterBase\UDF
Interbase does not have a current_transaction function available, so SymmetricDS cannot track changes by transaction.