Contents
This sample demonstrates the use of the Oracle CDC LogMiner Connection and Parser adapters.
Note
Oracle Corporation does not include its LogMiner feature on Oracle 19c, which means this adapter cannot work with that Oracle release.
In StreamBase Studio, import this sample with the following steps:
-
From the top menu, click
> . -
Enter
logminer
to narrow the list of options. -
Select
from the Native Database Connectivity Adapters list. -
Click
.
StreamBase Studio creates a project for this sample.
-
Make sure your database is set up correctly and has supplemental logging enabled.
-
Enable LogMiner:
-
Log onto your database using a user with DBA privileges.
-
Check the current log level by executing
select log_mode from v$database;
If the command returnsLOG_MODE
ofARCHIVELOG
then logging is already enabled and you can skip the following steps. If the command returnsNOARCHIVELOG
then you must enable logging. -
To enable logging, first shut down the database using
shutdown immediate;
. -
Then start up and mount the database using
startup mount;
. -
Now configure the database to enable archive log using
alter database archivelog;
andalter database open;
.
-
-
Enabled Supplemental Logging using
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
-
If you require primary key information, you can enable logging for each table with
ALTER TABLE 'schema'.'table name' ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;
or for the entire databaseALTER DATABASE ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;
-
You can also enable full logging for each table with
ALTER TABLE 'schema'.'table name' ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
or for the entire databaseALTER DATABASE ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
-
Submit the changes using
ALTER SYSTEM SWITCH LOGFILE;
-
-
This sample provides scripts to create a SAMPLE table and perform insert/update/delete tasks on the table. The adapters in the sample are set up for the SAMPLE table; the Oracle CDC LogMiner Connection adapter properties do need to be updated with the correct database information in order to connect.
The following scripts are provided:
-
CreateSampleTable.sql
— This SQL script creates the SAMPLE table which the adapters are set up to capture CDC information. -
InsertSampleData.sql
— This SQL script inserts 10 demo records into the SAMPLE table. -
UpdateSampleData.sql
— This SQL script updates the 10 demo records in the SAMPLE table with new values. -
DeleteSampleData.sql
— This SQL script deletes the 10 demo records from the SAMPLE table.
-
-
Load the JAR file containing the JDBC driver for your database into the Maven dependency system as described in Using External JAR Files.
-
In the Project Explorer, double-click
Sample.sbapp
to open the sample application. -
Select the Connection adapter and open its Properties view.
-
Open the Connection tab and configure the connection for your database.
-
Click the Run button. This opens the SB Test/Debug perspective and starts the application.
-
In the Studio's Output Streams view, observe tuples emitted on the adapter's Status output ports, indicating a connection was made to the database and tables are being monitored.
-
Using a tool such as Oracle SQL Developer, use the supplied script files to create the
SAMPLE
table and perform CRUD operations. -
In Studio's Output Streams view, observe tuples emitted on the TestTableData and AllGenericData output ports indicating changes were made to the
SAMPLE
table. -
When done, press F9 or click the Stop Running Application button.
When you load the sample into StreamBase Studio, Studio copies the sample project's files to your Studio workspace, which is normally part of your home directory, with full access rights.
Important
Load this sample in StreamBase Studio, and thereafter use the Studio workspace copy of the sample to run and test it, even when running from the command prompt.
Using the workspace copy of the sample avoids permission problems. The default workspace location for this sample is:
studio-workspace
/adapter/embedded/oracle-cdc-logminer
See Default Installation
Directories for the default location of studio-workspace
on your system.