public class LogMinerHelper extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
LogMinerHelper.DATATYPE |
| Modifier and Type | Field and Description |
|---|---|
private static String |
ALL_COLUMN_LOGGING |
private static String |
CURRENT |
private static org.slf4j.Logger |
LOGGER |
private static Map<String,OracleConnection> |
racFlushConnections |
private static String |
TOTAL |
private static String |
UNKNOWN |
| Constructor and Description |
|---|
LogMinerHelper() |
| Modifier and Type | Method and Description |
|---|---|
(package private) static void |
buildDataDictionary(OracleConnection connection)
This builds data dictionary objects in redo log files.
|
(package private) static void |
checkSupplementalLogging(OracleConnection connection,
String pdbName,
OracleDatabaseSchema schema)
This method validates the supplemental logging configuration for the source database.
|
private static OracleConnection |
createFlushConnection(JdbcConfiguration config,
String host) |
(package private) static void |
createFlushTable(OracleConnection connection) |
static void |
endMining(OracleConnection connection)
This call completes LogMiner session.
|
private static void |
executeCallableStatement(OracleConnection connection,
String statement) |
(package private) static void |
flushLogWriter(OracleConnection connection,
JdbcConfiguration config,
boolean isRac,
Set<String> racHosts)
It is critical to flush LogWriter(s) buffer
|
private static void |
flushRacLogWriters(Scn currentScn,
JdbcConfiguration config,
Set<String> racHosts)
Oracle RAC has one LogWriter per node (instance), we have to flush them all
We cannot use a query like from gv_instance view to get all the nodes, because not all nodes could be load balanced.
|
static List<LogFile> |
getArchivedLogFilesForOffsetScn(OracleConnection connection,
Scn offsetScn,
Duration archiveLogRetention)
This method returns all archived log files for one day, containing given offset scn
|
(package private) static Set<String> |
getCurrentRedoLogFiles(OracleConnection connection)
This method query the database to get CURRENT online redo log file(s).
|
static Scn |
getCurrentScn(OracleConnection connection)
This method returns current SCN from the database
|
(package private) static Scn |
getEndScn(OracleConnection connection,
Scn startScn,
OracleStreamingChangeEventSourceMetrics streamingMetrics,
int defaultBatchSize)
This method returns next SCN for mining and also updates streaming metrics.
|
(package private) static Scn |
getFirstOnlineLogScn(OracleConnection connection,
Duration archiveLogRetention)
This method fetches the oldest SCN from online redo log files
|
static Optional<Scn> |
getLastScnToAbandon(OracleConnection connection,
Scn offsetScn,
Duration transactionRetention)
This method calculates SCN as a watermark to abandon long lasting transactions.
|
static Map<String,String> |
getMap(OracleConnection connection,
String query,
String nullReplacement) |
static List<LogFile> |
getOnlineLogFilesForOffsetScn(OracleConnection connection,
Scn 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
|
private static Map<String,String> |
getRedoLogStatus(OracleConnection connection)
This fetches online redo log statuses
|
private static Scn |
getScnFromString(String value) |
static Object |
getSingleResult(OracleConnection connection,
String query,
LogMinerHelper.DATATYPE type) |
private static int |
getSwitchCount(OracleConnection connection)
This fetches REDO LOG switch count for the last day
|
(package private) static OffsetDateTime |
getSystime(OracleConnection connection)
Get the database time in the time zone of the system this database is running on
|
(package private) static void |
instantiateFlushConnections(JdbcConfiguration config,
Set<String> hosts) |
(package private) static boolean |
isTableSupplementalLogDataAll(OracleConnection connection,
TableId tableId) |
private static void |
logDatabaseState(OracleConnection connection)
Helper method that will dump the state of various critical tables used by the LogMiner implementation
to derive state about which logs are to be mined and processed by the Oracle LogMiner session.
|
(package private) static void |
logError(OracleStreamingChangeEventSourceMetrics streamingMetrics,
String format,
Object... args) |
private static void |
logQueryResults(OracleConnection connection,
String query)
Helper method that dumps the result set of an arbitrary SQL query to the connector's logs.
|
(package private) static void |
logWarn(OracleStreamingChangeEventSourceMetrics streamingMetrics,
String format,
Object... args) |
static void |
removeLogFilesFromMining(OracleConnection conn)
This method removes all added log files from mining
|
(package private) static void |
setNlsSessionParameters(JdbcConnection connection)
Sets NLS parameters for mining session.
|
static void |
setRedoLogFilesForMining(OracleConnection connection,
Scn lastProcessedScn,
Duration archiveLogRetention)
This method substitutes CONTINUOUS_MINE functionality
|
(package private) static void |
startLogMining(OracleConnection connection,
Scn startScn,
Scn endScn,
OracleConnectorConfig.LogMiningStrategy strategy,
boolean isContinuousMining,
OracleStreamingChangeEventSourceMetrics streamingMetrics)
This method builds mining view to query changes from.
|
private static final String CURRENT
private static final String UNKNOWN
private static final String TOTAL
private static final String ALL_COLUMN_LOGGING
private static final org.slf4j.Logger LOGGER
private static Map<String,OracleConnection> racFlushConnections
static void instantiateFlushConnections(JdbcConfiguration config, Set<String> hosts)
static void buildDataDictionary(OracleConnection connection) throws SQLException
connection - connection to the database as LogMiner user (connection to the container)SQLException - any exceptionpublic static Scn getCurrentScn(OracleConnection connection) throws SQLException
connection - container level database connectionSQLException - if anything unexpected happensstatic void createFlushTable(OracleConnection connection) throws SQLException
SQLExceptionstatic Scn getEndScn(OracleConnection connection, Scn startScn, OracleStreamingChangeEventSourceMetrics streamingMetrics, int defaultBatchSize) throws SQLException
connection - container level database connectionstartScn - start SCNstreamingMetrics - the streaming metricsSQLException - if anything unexpected happensstatic void flushLogWriter(OracleConnection connection, JdbcConfiguration config, boolean isRac, Set<String> racHosts) throws SQLException
connection - container level database connectionconfig - configurationisRac - true if this is the RAC systemracHosts - set of RAC hostSQLException - exceptionstatic OffsetDateTime getSystime(OracleConnection connection) throws SQLException
connection - connectionSQLExceptionstatic void startLogMining(OracleConnection connection, Scn startScn, Scn endScn, OracleConnectorConfig.LogMiningStrategy strategy, boolean isContinuousMining, OracleStreamingChangeEventSourceMetrics streamingMetrics) 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 onlystreamingMetrics - the streaming metricsSQLException - if anything unexpected happensstatic Set<String> getCurrentRedoLogFiles(OracleConnection connection) throws SQLException
connection - connection to reuseSQLException - if anything unexpected happensstatic Scn getFirstOnlineLogScn(OracleConnection connection, Duration archiveLogRetention) throws SQLException
connection - container level database connectionarchiveLogRetention - duration that archive logs are minedSQLException - if anything unexpected happensstatic void setNlsSessionParameters(JdbcConnection connection) throws SQLException
connection - session level database connectionSQLException - if anything unexpected happensprivate static Map<String,String> getRedoLogStatus(OracleConnection connection) throws SQLException
connection - privileged connectionSQLException - if anything unexpected happensprivate static int getSwitchCount(OracleConnection connection)
connection - privileged connectionprivate static void flushRacLogWriters(Scn currentScn, JdbcConfiguration config, Set<String> racHosts)
private static OracleConnection createFlushConnection(JdbcConfiguration config, String host) throws SQLException
SQLExceptionstatic void checkSupplementalLogging(OracleConnection connection, String pdbName, OracleDatabaseSchema schema) throws SQLException
connection - oracle connection on LogMiner levelpdbName - pdb nameschema - oracle schemaSQLException - if anything unexpected happensstatic boolean isTableSupplementalLogDataAll(OracleConnection connection, TableId tableId) throws SQLException
SQLExceptionpublic static void endMining(OracleConnection connection)
connection - container level database connectionpublic static void setRedoLogFilesForMining(OracleConnection connection, Scn lastProcessedScn, Duration archiveLogRetention) throws SQLException
connection - connectionlastProcessedScn - current offsetarchiveLogRetention - the duration that archive logs will be minedSQLException - if anything unexpected happenspublic static Optional<Scn> getLastScnToAbandon(OracleConnection connection, Scn offsetScn, Duration transactionRetention)
connection - connectionoffsetScn - current offset scntransactionRetention - duration to tolerate long running transactionsstatic void logWarn(OracleStreamingChangeEventSourceMetrics streamingMetrics, String format, Object... args)
static void logError(OracleStreamingChangeEventSourceMetrics streamingMetrics, String format, Object... args)
public static List<LogFile> getOnlineLogFilesForOffsetScn(OracleConnection connection, Scn offsetScn) throws SQLException
SQLExceptionprivate static void logDatabaseState(OracleConnection connection)
connection - the database connectionprivate static void logQueryResults(OracleConnection connection, String query) throws SQLException
connection - the database connectionquery - the query to executeSQLException - thrown if an exception occurs performing a SQL operationpublic static List<LogFile> getArchivedLogFilesForOffsetScn(OracleConnection connection, Scn offsetScn, Duration archiveLogRetention) throws SQLException
connection - connectionoffsetScn - offset scnarchiveLogRetention - duration that archive logs will be minedSQLException - if something happenspublic static void removeLogFilesFromMining(OracleConnection conn) throws SQLException
conn - connectionSQLException - something happenedprivate static void executeCallableStatement(OracleConnection connection, String statement) throws SQLException
SQLExceptionpublic static Map<String,String> getMap(OracleConnection connection, String query, String nullReplacement) throws SQLException
SQLExceptionpublic static Object getSingleResult(OracleConnection connection, String query, LogMinerHelper.DATATYPE type) throws SQLException
SQLExceptionCopyright © 2021 JBoss by Red Hat. All rights reserved.