MySQL mysqlbinlog vs. Oracle logmnr

MySQL provides the mysqlbinlog utility to parse binary transaction logs for any number of purposes which may include replication, auditing, or troubleshooting. Oracle also provides this functionality through a PL/SQL package called dbms_logmnr, more commonly referred to as “Log Miner”.

MySQL is very convenient in that all you need to enter at the command line is…

mysqlbinlog log_file_name

With Oracle, you must do some more “work”, but it is arguably more flexible since it is an API that you can call from any number of front end applications. See the article on using python for an example. It can also be run from a remote server to aid in flexibility.

begin
  dbms_logmnr.add_logfile(logfilename => '&log_file_name');
  dbms_logmnr.start_logmnr(options => dbms_logmnr.dict_from_online_catalog + dbms_logmnr.no_rowid_in_stmt);
  for cur in (select *
                from v$logmnr_contents) loop
    --do something with data
  end loop;
end;
/

Each has its own merits, and each are immensely useful.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.