GET_STATISTICS
Valid For
Extract and Replicat
Description
Use the GET_STATISTICS
function to retrieve the current processing statistics for the Extract or Replicat process. For example, the user exit can output statistics to a custom report should a fatal error occur during Extract or Replicat processing.
Statistics are automatically handled based on which process type has requested the data:
-
The Extract process will always treat the request as a source table, counting that table once regardless of the number of times output.
-
The Replicat process will always treat the request as a set of target tables. The set includes all counts to the target regardless of the number of source tables.
If the database is case-sensitive, object names must be specified in the same letter case as they are defined in the hosting database; otherwise, the case does not matter.
Syntax
#include "usrdecs.h" short result_code; statistics_def statistics; ERCALLBACK (GET_STATISTICS, &statistics, &result_code);
Buffer
typedef struct { char *table_name; short group; exit_timestamp_string start_datetime; long num_inserts; long num_updates; long num_befores; long num_deletes; long num_discards; long num_ignores; long total_db_operations; long total_operations; /* Version 2 CALLBACK_STRUCT_VERSION */ long num_truncates; } statistics_def;
Input
-
table_name
-
A null-terminated string specifying the fully qualified name of the source table. Statistics are always recorded against the source records. If the character session of the user exit is set with
SET_SESSION_CHARSET
to a value other than the default character set of the operating system, as defined inULIB_CS_DEFAULT
in theucharset.h
file, the table name and the date are interpreted in the session character set. -
group
-
Can be one of the following:
-
EXIT_STAT_GROUP_STARTUP
-
Retrieves statistics since the Oracle GoldenGate process was last started.
-
EXIT_STAT_GROUP_DAILY
-
Retrieves statistics since midnight of the current day.
-
EXIT_STAT_GROUP_HOURLY
-
Retrieves statistics since the start of the current hour.
-
EXIT_STAT_GROUP_RECENT
-
Retrieves statistics since the statistics were reset using GGSCI.
-
EXIT_STAT_GROUP_REPORT
-
Retrieves statistics since the last report was generated.
-
EXIT_STAT_GROUP_USEREXIT
-
Retrieves statistics since the last time the user exit reset the statistics with
RESET_USEREXIT_STATS
.
-
Output
-
start_datetime
-
A null-terminated string in the format of
YYYY-MM-DD HH:MI:SS
indicating the local date and time that statistics started to be recorded for the specified group. -
num_inserts
-
The returned number of inserts processed by Extract or Replicat.
-
num_updates
-
The returned number of updates processed by Extract or Replicat.
-
num_befores
-
The returned number of update before images processed by Extract or Replicat.
-
num_deletes
-
The returned number of deletes processed by Extract or Replicat.
-
num_discards
-
The returned number of records discarded by Extract or Replicat.
-
num_ignores
-
The returned number of records ignored by Extract or Replicat.
-
total_db_operations
-
The returned number of total database operations processed by Extract or Replicat.
-
total_operations
-
The returned number of total operations processed by Extract or Replicat, including discards and ignores.
-
num_truncates
-
The returned number of truncates processed by Extract or Replicat.
Return Values
EXIT_FN_RET_INVALID_CONTEXT EXIT_FN_RET_INVALID_PARAM EXIT_FN_RET_TABLE_NOT_FOUND EXIT_FN_RET_OK