Setting Logging Parameters
To capture from the MySQL transaction logs, the Oracle GoldenGate Extract process must be able to find the index file, which contains the paths of all binary log files.
Extract expects that all of the table columns are in the binary log. As a result, binlog_row_image
set as full is supported and this is the default. Other values of binlog_row_image
are not supported.
Note:
Oracle recommends that the binary log is retained for at least 24 hours.
In MySQL 5.7, the server_id
option must be specified along with log-bin
, otherwise the server will not start. For MySQL 8.0, the server_id
is enabled by default.
Extract checks the following parameter settings to get this index file path:
-
Extract
TRANLOGOPTIONS
parameter with theALTLOGDEST
option. If this parameter specifies a location for the log index file, Extract accepts this location over any default that is specified in the MySQL Server configuration file. WhenALTLOGDEST
is used, the binary log index file must also be stored in the specified directory. This parameter should be used if the MySQL configuration file does not specify the full index file path name, specifies an incorrect location, or if there are multiple installations of MySQL on the same machine. From Oracle GoldenGate 21c onwards,ALTLOGDEST
parameter is optional for local Extract, however, for remote Extract this parameter is mandatory. WhenALTLOGDEST
is not specified, the binary log index and binary log filepaths will be fetched from the database directly. The paths thus fetched are also subject to same accessibilitychecks as in the existing process.To specify the index file path using
TRANLOGOPTIONS
withALTLOGDEST
, use a command similar to the following:TRANLOGOPTIONS ALTLOGDEST "/mnt/rdbms/mysql/data/logs/binlog.index"
To capture from a remote server or in case of remote capture, you only need to specify the
REMOTE
option instead of the index file path on the remote server. For remote capture, specify the following in the Extract parameter file:TRANLOGOPTIONS ALTLOGDEST REMOTE
-
The MySQL Server configuration file: The configuration file stores default startup options for the MySQL server and clients. On Windows, the name of the configuration file is
my.ini
. On other platforms, it ismy.cnf
. In the absence ofTRANLOGOPTIONS
withALTLOGDEST
, Extract gets information about the location of the log files from the configuration file. However, even withALTLOGDEST
, these Extract parameters must be set correctly:-
binlog-ignore-db=oggddl
: This prevents DDL logging history table entries in thebinlog
and is set in themy.cnf
ormy.ini
file. -
log-bin
: This parameter is used to enable binary logging. This parameter also specifies the location of the binary log index file and is a required parameter for Oracle GoldenGate, even ifALTLOGDEST
is used. Iflog-bin
is not specified, binary logging will be disabled and Extract returns an error. -
log-bin-index
: This parameter specifies the location of the binary log index. If it is not used, Extract assumes that the index file is in the same location as the log files. If this parameter is used and specifies a different directory from the one that contains the binary logs, the binary logs must not be moved once Extract is started. -
max_binlog_size
: This parameter specifies the size, in bytes, of the binary log file.Note:
The server creates a new binary log file automatically when the size of the current log reaches the
max_binlog_size
value, unless it must finish recording a transaction before rolling over to a new file. -
binlog_format
: This parameter sets the format of the logs. It must be set to the value ofROW
, which directs the database to log DML statements in binary format. Extract silently ignores thebinlog
events that are not written in theROW
format instead of abending when it detects abinlog_format
other thanROW
.Note:
MySQL binary logging does not allow logging to be enabled or disabled for specific tables. It applies globally to all tables in the database.
-
mysql.rds_set_configuration
: When capturing from MySQL Amazon RDS instance, you need to call themysql.rds_set_configuraton
stored procedure on MySQL command line, to retain the binary logs for a specific duration. By default, the default value ofbinlog_retention_hours
for MySQL Amazon RDS is set to NULL, which implies that the binary logs are not retained.The following example shows the command to preserve the binary log for 24 hours:
mysql > call mysql.rds_set_configuration('binlog retention hours', 24);
To locate the configuration file, Extract checks the MYSQL_HOME environment variable: If MYSQL_HOME is set, Extract uses the configuration file in the specified directory. If MYSQL_HOME is not set, Extract queries the
information_schema.global_variables
table to determine the MySQL installation directory. If a configuration file exists in that directory, Extract uses it. -
-
For MariaDB version 10.2 and later, Oracle GoldenGate works in the same way as for MySQL but a new variable needs to be configured in the
my.cnf
ormy.ini
file. The variable that needs to be added is "binlog-annotate-row-events=OFF
". Restart MariaDB after configuring this variable and then start the Extract process.