Class LogMinerHelper


  • public class LogMinerHelper
    extends Object
    This class contains methods to configure and manage LogMiner utility
    • Constructor Detail

      • LogMinerHelper

        public LogMinerHelper()
    • Method Detail

      • setLogFilesForMining

        public static void setLogFilesForMining​(OracleConnection connection,
                                                Scn lastProcessedScn,
                                                Duration archiveLogRetention,
                                                boolean archiveLogOnlyMode,
                                                String archiveDestinationName,
                                                int maxRetries)
                                         throws SQLException,
                                                InterruptedException
        This method substitutes CONTINUOUS_MINE functionality
        Parameters:
        connection - connection
        lastProcessedScn - current offset
        archiveLogRetention - the duration that archive logs will be mined
        archiveLogOnlyMode - true to mine only archive lgos, false to mine all available logs
        archiveDestinationName - configured archive log destination name to use, may be null
        maxRetries - the number of retry attempts before giving up and throwing an exception about log state
        Throws:
        SQLException - if anything unexpected happens
        InterruptedException
      • hasNoLogFilesStartingBeforeScn

        private static boolean hasNoLogFilesStartingBeforeScn​(List<LogFile> logs,
                                                              Scn scn)
      • getMinimumScn

        private static Scn getMinimumScn​(List<LogFile> logs)
      • getLogFilesForOffsetScn

        public static List<LogFile> getLogFilesForOffsetScn​(OracleConnection connection,
                                                            Scn offsetScn,
                                                            Duration archiveLogRetention,
                                                            boolean archiveLogOnlyMode,
                                                            String archiveDestinationName)
                                                     throws SQLException
        Get all log files that should be mined.
        Parameters:
        connection - database connection
        offsetScn - offset system change number
        archiveLogRetention - duration that archive logs should be mined
        archiveLogOnlyMode - true to mine only archive logs, false to mine all available logs
        archiveDestinationName - archive destination to use, may be null
        Returns:
        list of log files
        Throws:
        SQLException - if a database exception occurs
      • getScnFromString

        private static Scn getScnFromString​(String value)
      • removeLogFilesFromMining

        public static void removeLogFilesFromMining​(OracleConnection conn)
                                             throws SQLException
        This method removes all added log files from mining
        Parameters:
        conn - connection
        Throws:
        SQLException - something happened
      • getColumnIndexByName

        public static int getColumnIndexByName​(String columnName,
                                               Table table)
        Returns a 0-based index offset for the column name in the relational table.
        Parameters:
        columnName - the column name, should not be null.
        table - the relational table, should not be null.
        Returns:
        the 0-based index offset for the column name