ALTER EXTRACT
Use ALTER EXTRACT for the following purposes:
-
To change the attributes of an Extract group created with the
ADD EXTRACTcommand. -
To increment a trail to the next file in the sequence.
-
To upgrade to an integrated capture configuration.
-
To downgrade from an integrated capture configuration.
-
To position any given Db2 for i journal at a specific journal sequence number.
Before using this command, stop the Extract with the STOP
EXTRACT
group_name command.
Syntax
ALTER EXTRACT group-name
[, BEGIN {NOW | yyyy-mm-dd[ hh:mi:[ss[.cccccc]]]} |
| [, EXTRBA archive-offset-number]
| [, ADD_EXTRACT_attribute | SCN value]
| [, LSN
| [, EOL
| [, DESC
| [ CRITICAL [ YES | NO ] ]
| [ ENCRYPTIONPROFILE encryption-profile-name]
| [ PROFILE
| [ AUTOSTART [ YES | NO ]
| [ DELAY delay-number ] ]
| [ AUTORESTART [ YES | NO ]
| [ RETRIES retries-number ]
| [ WAITSECONDS wait-number ]
| [ RESETSECONDS reset-number ]
| [ DISABLEONFAILURE [ YES | NO ] ] ] ]
| [ LOGNUM lognum]
| [ LOGPOS logpos
The following ALTER EXTRACT options are supported for Db2 for
i to position Extract for a given journal:
ALTER EXTRACT {BEGIN {NOW | yyyy-mm-ddT[ hh:mi:[ss[.cccccc]]Z]}
[JOURNAL journal_library/journal_name [JRNRCV receiver_library/
receiver_name]] |
, EOL [JOURNAL journal_library/journal_name
[JRNRCV receiver_library/receiver_name]] |
, SEQNO sequence_number [JOURNAL journal_library/journal_name
[JRNRCV receiver_library/receiver_name]]}
-
BEGIN {NOW |yyyy-mm-ddT[ hh:mi:[ss[.cccccc]]]Z} [JOURNALjournal_library/journal_name[JRNRCVreceiver_library/ receiver_name]] |, EOL [JOURNALjournal_library/journal_name[JRNRCVreceiver_library/receiver_name]] |, SEQNOsequence_number[JOURNALjournal_library/journal_name[JRNRCVreceiver_library/receiver_name]]-
These IBM for i options allow journal-specific Extract positioning after the global start point is issued with
ADD EXTRACT. A specific journal position set withALTER EXTRACTdoes not affect any global position that was previously set withADD EXTRACTorALTER EXTRACT; however a global position set withALTER EXTRACToverrides any specific journal positions that were previously set in the same Extract configuration.Note:
SEQNO, when used with a journal inALTER EXTRACT, is the journal sequence number that is relative to that specific journal, not the system sequence number that is global across journals.
-
group-name -
The name of the Extract group that is to be altered.
-
{BEGIN {NOW | Tyyyy-mm-dd[ hh:mi:[ss[.cccccc]]]Z} -
-
NOW -
For all databases except Db2 LUW,
NOWspecifies the time at which theALTER EXTRACTcommand is issued.NOWspecifies the time at which theALTER EXTRACTcommand is issued.For Db2 LUW, only commit and end transaction records contain timestamps, so the Extract starting position can only be calculated relative to those timestamps. This is a limitation of the API that is used by Oracle GoldenGate. It must be noted that positioning by timestamp is not accurate and can also take a long time. It is recommended to use
LRIorEOLoptions wherever possible. -
YYYY-MM-DDThh:mm:ssZ -
A date and time (timestamp) in the given form. For example,
2017-07-14T14:54:45Z. -
yyyy-mm-dd[ hh:mi:[ss[.cccccc]]] -
A date and time (timestamp) in the given form. For an Oracle Extract in integrated mode, the timestamp value must be greater than the timestamp at which the Extract was registered with the database.
Positioning by timestamp in a SQL Server transaction log is affected by the following characteristics of SQL Server:
-
The timestamps recorded in the SQL Server transaction log use a 3.3333 microsecond (ms) granularity. This level of granularity may not allow positioning by time between two transactions, if the transactions began in the same 3.3333 ms time interval.
-
Timestamps are not recorded in every SQL Server log record, but only in the records that begin and commit the transaction, as well as some others that do not contain data.
-
SQL Server timestamps are not from the system clock, but instead are from an internal clock that is specific to the individual processors in use. This clock updates several times a second, but between updates it could get out of sync with the system clock. This further reduces the precision of positioning by time.
-
Timestamps recorded for log backup files may not precisely correspond to times recorded inside the backup (however this imprecision is less than a second).
Positioning to an LSN is precise.
Positioning by timestamp in PostgreSQL includes the following scenarios:-
Scenario 1
Iftrack_commit_timestampisoff, the following output will be displayed when the Extract process starts irrespective of what positioning method is used:2020-04-29 02:15:54 INFO OGG-01517 Position of first record processed LSN: 0/2222C20, Jan 1, 1970 12:00:00 PM. -
Scenario 2
If thetrack_commit_timestampis enabled before Extract is registered then the correct timestamp will be displayed once the records are pushed in the source database as mentioned in the following example:2020-04-29 02:19:07 INFO OGG-01515 Positioning to begin time Apr 29,2020 2:18:38 AM. -
Scenario 3
Iftrack_commit_timestampis enabled after the Extract is registered, then there may be chances that the older records are available in the log for which the commit timestamp is not built up with the associatedtransaction ID. In that case, if Extract does not get the timestamp then it will fallback using the default timestamp mentioned in scenario 1. The output will be similar to the following:020-04-29 01:55:07 INFO OGG-01517 Position of first record processed LSN: 0/221D028, Jan 1, 1970 12:00:00 PM. -
Past timestamp cannot be specified if the replication slot has moved away.
-
-
-
START -
Valid for PostgreSQL.
Adds an Extract without mentioning
BEGIN NOWorLSN. Extract will start from the replication slot restart position automatically. -
ADD_EXTRACT_attribute -
You can change any of the attributes specified with the
ALTER EXTRACTcommand, except for the following:-
Altering an Extract specified with the
EXTTRAILSOURCEoption. -
Altering the number of RAC threads specified with the
THREADSoption.
For these exceptions, delete the Extract group and then add it again.
If using the
BEGINoption, do not combine other options in the statement. Issue separate statements, for example:ALTER EXTRACT exte, BEGIN 2019-01-01 ALTER EXTRACT exte, ETROLLOVER ALTER EXTRACT exte, SCN 789000If using the
SCNorBEGINoption for Integrated Extract, it requires aDBLOGIN, and the SCN or timestamp value specified cannot be below the outbound server's first SCN or timestamp. To find the outbound server's first SCN, issue the following command:INFO EXTRACTgroup_name, SHOWCH DETAILThe first SCN value is listed as shown in the following example:
Integrated Extract outbound server first scn: 0.665884 (665884) -
-
EXTRBAoffset_number -
Valid for Db2 z/OS.
Specifies the relative byte address within a transaction log at which to begin capturing data.
The required format is
0Xnnn, wherennnis a 1 to 20 digit hexadecimal number (the first character is the digit zero, and the second character can be upper or lower case letterx). -
EOL -
Valid for Db2 for i, Db2 LUW, MySQL, PostgreSQL, and SQL Server.
Configures processing to start at the end of the log files (or journals) that the next record will be written to. Any active transactions will not be captured.
For Db2 LUW, it configures processing to start at the active
LRIvalue in the log files. The activeLRIis the position at the end of the log files that the next record will be written to. Any active transactions will not be captured.For PostgreSQL,
DBLOGINis required for position byEOL.For MySQL, it finds the position corresponding to the end of the file and starts reading transactions from there. The EOL position is not exact, if data is continuously written to the binary log.
-
TRANLOG LRILRI_number -
(Db2 LUW) You can use this option for Db2 LUW systems to specify the LRI record value for the checkpoint transaction log.
For PostgreSQL,
DBLOGINis required for position byEOL. -
REPORTfile_name -
Specifies the full path name of an Extract report file in a location other than the default of
dirrptwithin the Oracle GoldenGate directory. -
SCNvalue -
Valid for Oracle.
Starts Extract at the transaction in the redo log that has the specified Oracle system change number (SCN). For Extract, the SCN value must be greater than the SCN at which the Extract was registered with the database. For SCN or
BEGINoption,DBLOGINis required, and the SCN or timestamp value specified cannot be below the outbound server's first SCN or timestamp. -
LSN value - Valid for Db2 z/OS, PostgreSQL, and SQL Server.
-
LOGNUM -
Valid for MySQL.
This is the log file number. For example, if the required log file name is test.000034, theLOGNUMvalue is 34. Extract will search for this log file.Note:
In Microservices Architecture,ALTER EXTRACTwill fail if theLOGNUMvalue contains zeroes preceding the value. For example,ALTER EXTRACT ext1, TRANLOG, LOGNUM 000001, LOGPOS 0will fail. Instead, setLOGNUMto 1 for this example to succeed. -
LOGPOS -
Valid for MySQL.
This is an event offset value within the log file that identifies a specific transaction record. Event offset values are stored in the header section of a log record. To position at the beginning of a
binlogfile, set theLOGPOSas 0. -
ETROLLOVER -
Use for manual recovery situations that require repositioning and regenerating trail files for a primary Extract and when upgrading Oracle GoldenGate from a previous version.
Causes Extract to create a new incarnation of the trail file and increments to the next file in the trail sequence when restarting, requiring readers such as pump or Replicat, to be manually repositioned to the new trail sequence number.
With
ETROLLOVER, Extract captures all records after the specified SCN with which Extract is starting irrespective of whether it was already captured and written to trail or not. WithoutETROLLOVER, Extract will skip the capture of any records that are already captured and written to trail.From 19c onwards, during Distribution Service processing:-
If the primary Extract on the source deployment is upgraded with target trail file
ETROLLOVER, then theDistribution Service automatically detects the source trail fileETROLLOVERand starts reading from the next input trail file. This is the same command as data pumpALTER EXTRACT groupname EXTSEQNO seqno+1 EXTRBA 0. -
After upgrading the Distribution Service, it automatically performs the
ETROLLOVERfor the output trail file upon restarting and writes the next trail file properly. This is the same as data pumpALTER EXTRACT groupname ETROLLOVER.
-
-
DESC 'description' -
Specifies a description of the group, such as
'Extracts account_tab on Serv1'. Enclose the description within single quotes. You may use the abbreviated keywordDESCor the full wordDESCRIPTION. -
ENCRYPTIONPROFILE - Specifies the name of the encryption profile for the Extract. This name
is case sensitive so you must use the exact name that you entered with
ADD EXTRACT. -
GTIDSET gtidset -
Valid for MySQL.
Specifies the initial positioning of of Extract by using the position type positiob ing the GTID set option for GTID-based capture for MySQL. The supported MySQL sources for GTID set are MySQL Server 8.0, MySQL Server 5.7, MySQL Database Service (MDS). The maximum supported GTID set size is 64 KB.
Syntax:
ALTER EXTRACT extract_name, TRANLOG, GTIDSET gtidset -
CRITICAL -
Indicates if the process is critical for the deployment.
-
PROFILE - Name of the auto start profile. This name is case sensitive so you must
use the exact name that you entered with
ALTER EXTRACT. -
AUTOSTART - Specifies whether the managed process has to be started automatically when
the Administration Service starts. The default value is
YES. -
RETRIES -
The maximum number of tries for restarting the task before canceling retry efforts. This is optional.
-
WAITSECONDS -
The duration (in seconds) in which the retries are counted.
-
RESETSECONDS - Resets the duration in which the retries are counted.
-
DISABLEONFAILURE -
If set to
TRUE, then the task is disabled when the number of retries is exhausted. -
INFO EXTRACT group-name, SHOWCH DETAIL -
The first SCN value is listed as shown in the following example:
Integrated Extract outbound server first scn: 0.665884 (665884)
Examples
-
The following alters Extract to start processing data from January 1, 2019.
ALTER EXTRACT exte, BEGIN 2019-01-01 -
The following alters Extract to start processing at a specific location in the trail.
ALTER EXTRACT exte, EXTSEQNO 26, EXTRBA 338 -
The following alters Extract in a SQL Server environment to start at a specific LSN.
ALTER EXTRACT exte, LSN 0Xd7e:36b:1 -
The following alters Extract to increment to the next file in the trail sequence.
ALTER EXTRACT exte, ETROLLOVER -
The following alters Extract to upgrade to integrated capture.
ALTER EXTRACT exte, UPGRADE INTEGRATED TRANLOG -
The following command uses
ETROLLOVERto prevent filtering of duplicate records with backward SCN 778899.ALTER EXTRACT exte, SCN 778899 ALTER EXTRACT exte ETROLLOVER START EXTRACT exteIf you do not useETROLLOVER, then if you alter Extract to the previous SCN value, it will not process duplicate records. The command to alter Extract to filter duplicate records is as follows:ALTER EXTRACT exte, SCN 778899 START EXTRACT exte -
The following shows
ALTER EXTRACTfor an IBM for i journal start point.ALTER EXTRACT exte, SEQNO 1234 JOURNAL accts/acctsjrn -
The following shows
ALTER EXTRACTfor an IBM for i journal and receiver start point.ALTER EXTRACT exte, SEQNO 1234 JOURNAL accts/acctsjrn JRNRCV accts/jrnrcv0005 -
The following example alters an Extract on a Db2 LUW system.
ALTER EXTRACT exte, TRANLOG LRI 8066.322711