public class LogMinerHelper extends Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
LogMinerHelper.DATATYPE |
| Modifier and Type | Field and Description |
|---|---|
private static org.slf4j.Logger |
LOGGER |
private static String |
UNKNOWN |
| Constructor and Description |
|---|
LogMinerHelper() |
| Modifier and Type | Method and Description |
|---|---|
(package private) static void |
buildDataDictionary(Connection connection)
This builds data dictionary objects in redo log files.
|
(package private) static void |
checkSupplementalLogging(OracleConnection connection,
String pdbName)
This method checks if supplemental logging was set on the database level.
|
(package private) static void |
createAuditTable(Connection connection) |
(package private) static void |
endMining(Connection connection)
This call completes log miner session.
|
private static void |
executeCallableStatement(Connection connection,
String statement) |
(package private) static Set<String> |
getCurrentRedoLogFiles(Connection connection,
LogMinerMetrics metrics)
This method query the database to get CURRENT online redo log file(s).
|
static long |
getCurrentScn(Connection connection)
This method returns current SCN from the database
|
(package private) static long |
getEndScn(Connection connection,
long startScn,
LogMinerMetrics metrics)
This method returns next SCN for mining and also updates MBean metrics
We use a configurable limit, because the larger mining range, the slower query from Log Miner content view.
|
(package private) static long |
getFirstOnlineLogScn(Connection connection)
This method fetches the oldest SCN from online redo log files
|
(package private) static Optional<Long> |
getLastScnFromTheOldestOnlineRedo(Connection connection,
Long offsetScn)
This method returns SCN as a watermark to abandon long lasting transactions.
|
private static Map<String,Long> |
getLogFilesForOffsetScn(Connection connection,
Long offsetScn)
This method returns all online log files, starting from one which contains offset SCN and ending with one containing largest SCN
18446744073709551615 on Ora 19c is the max value of the nextScn in the current redo todo replace all Long with BigInteger for SCN
|
private static Map<String,String> |
getMap(Connection connection,
String query,
String nullReplacement) |
private static int |
getRedoLogGroupSize(Connection connection)
get size of online REDO groups
|
private static Map<String,String> |
getRedoLogStatus(Connection connection)
This fetches online redo log statuses
|
private static Object |
getSingleResult(Connection connection,
String query,
LogMinerHelper.DATATYPE type) |
private static int |
getSwitchCount(Connection connection)
This fetches REDO LOG switch count for the last day
|
(package private) static Duration |
getTimeDifference(Connection connection)
Calculate time difference between database and connector timers.
|
(package private) static void |
logError(TransactionalBufferMetrics metrics,
String format,
Object... args) |
(package private) static void |
logWarn(TransactionalBufferMetrics metrics,
String format,
Object... args) |
(package private) static void |
setNlsSessionParameters(io.debezium.jdbc.JdbcConnection connection)
Sets NLS parameters for mining session.
|
(package private) static void |
setRedoLogFilesForMining(Connection connection,
Long lastProcessedScn)
This method substitutes CONTINUOUS_MINE functionality for online files only
|
(package private) static void |
startOnlineMining(Connection connection,
Long startScn,
Long endScn,
OracleConnectorConfig.LogMiningStrategy strategy,
boolean isContinuousMining)
This method builds mining view to query changes from.
|
private static void |
updateRedoLogMetrics(Connection connection,
LogMinerMetrics metrics,
Set<String> fileNames)
This is to update MBean metrics associated with REDO LOG groups
|
private static final String UNKNOWN
private static final org.slf4j.Logger LOGGER
static void buildDataDictionary(Connection connection) throws SQLException
connection - connection to the database as log miner user (connection to the container)SQLException - any exceptionpublic static long getCurrentScn(Connection connection) throws SQLException
connection - container level database connectionSQLException - if anything unexpected happensstatic void createAuditTable(Connection connection) throws SQLException
SQLExceptionstatic long getEndScn(Connection connection, long startScn, LogMinerMetrics metrics) throws SQLException
connection - container level database connectionmetrics - MBean accessible metricsstartScn - start SCNSQLException - if anything unexpected happensstatic Duration getTimeDifference(Connection connection) throws SQLException
connection - connectionDurationSQLExceptionstatic void startOnlineMining(Connection connection, Long startScn, Long endScn, OracleConnectorConfig.LogMiningStrategy strategy, boolean isContinuousMining) throws SQLException
connection - container level database connectionstartScn - the SCN to mine fromendScn - the SCN to mine tostrategy - this is about dictionary locationisContinuousMining - works < 19 version onlySQLException - if anything unexpected happensstatic Set<String> getCurrentRedoLogFiles(Connection connection, LogMinerMetrics metrics) throws SQLException
connection - connection to reusemetrics - MBean accessible metricsSQLException - if anything unexpected happensstatic long getFirstOnlineLogScn(Connection connection) throws SQLException
connection - container level database connectionSQLException - if anything unexpected happensstatic void setNlsSessionParameters(io.debezium.jdbc.JdbcConnection connection)
throws SQLException
connection - session level database connectionSQLException - if anything unexpected happensprivate static void updateRedoLogMetrics(Connection connection, LogMinerMetrics metrics, Set<String> fileNames)
connection - connectionfileNames - name of current REDO LOG filesmetrics - current metricsprivate static Map<String,String> getRedoLogStatus(Connection connection) throws SQLException
connection - privileged connectionSQLException - if anything unexpected happensprivate static int getSwitchCount(Connection connection)
connection - privileged connectionstatic void checkSupplementalLogging(OracleConnection connection, String pdbName) throws SQLException
connection - oracle connection on logminer levelpdbName - pdb nameSQLException - if anything unexpected happensstatic void endMining(Connection connection)
connection - container level database connectionstatic void setRedoLogFilesForMining(Connection connection, Long lastProcessedScn) throws SQLException
connection - connectionlastProcessedScn - current offsetSQLException - if anything unexpected happensstatic Optional<Long> getLastScnFromTheOldestOnlineRedo(Connection connection, Long offsetScn) throws SQLException
connection - connectionoffsetScn - current offsetSQLException - if anything unexpected happensstatic void logWarn(TransactionalBufferMetrics metrics, String format, Object... args)
static void logError(TransactionalBufferMetrics metrics, String format, Object... args)
private static int getRedoLogGroupSize(Connection connection) throws SQLException
connection - connectionSQLExceptionprivate static Map<String,Long> getLogFilesForOffsetScn(Connection connection, Long offsetScn) throws SQLException
SQLExceptionprivate static void executeCallableStatement(Connection connection, String statement) throws SQLException
SQLExceptionprivate static Map<String,String> getMap(Connection connection, String query, String nullReplacement) throws SQLException
SQLExceptionprivate static Object getSingleResult(Connection connection, String query, LogMinerHelper.DATATYPE type) throws SQLException
SQLExceptionCopyright © 2020 JBoss by Red Hat. All rights reserved.