Use STATS EXTRACT to display statistics for one or more Extract groups.
The output includes DML and DDL operations that are included in the Oracle GoldenGate configuration.
Syntax
STATS EXTRACT group_name
[, statistic [DAILY. | .HOURLY | LATEST | RESET]
[, TABLE [container. | catalog.]schema.table]
[, TOTALSONLY [container. | catalog.]schema.table]
[, REPORTCDR]
[, REPORTCHARCONV]
[, REPORTFETCH | NOREPORTFETCH]
[, REPORTRATE time_units]
Examples
Resets the counters.
STATS EXTRACT EXT_01_S, RESET
Displays totals since the last RESET command.
STATS EXTRACT EXT_01_S, TABLE my_schema.my_table, LATEST
STATS EXTRACT EXT_01_S, TABLE my_schema.my_table, LATEST
Retrieve stats total since the last start of extract:
STATS EXTRACT EXT_01_S, TOTALSONLY my_schema.my_table
STATS EXTRACT EXT_01_S, TOTALSONLY my_schema.my_table
Displays totals since the start of the current day for one table.
STATS EXTRACT EXT_01_S, DAILY, TABLE my_schema.my_table
STATS EXTRACT EXT_01_S, DAILY, TABLE my_schema.my_table
Displays totals since the start of the current day for all tables:
STATS EXTRACT EXT_01_S, DAILY, TABLE my_schema.*
STATS EXTRACT EXT_01_S, DAILY, TABLE my_schema.*
Displays totals since the start of the current hour for all tables:
STATS EXTRACT EXT_01_S, HOURLY, TABLE my_schema.*
STATS EXTRACT EXT_01_S, HOURLY, TABLE my_schema.*
script to monitor stats
get_gg_stats.sh
#!/bin/bash
. /etc/sh/orash/oracle_login.sh igt
GG_HOME=/software/ogg/191
ORACLE_SID=igt
ORACLE_HOME=/software/oracle/122
HOME_DIR=/software/oracle/oracle/scripts/gg_stats_monitor
DAY_LOG_FILE="${HOME_DIR}/logs/gg_stats_daily.log"
HOUR_LOG_FILE="${HOME_DIR}/logs/gg_stats_hourly.log"
HOUR_LOG_FILE="${HOME_DIR}/logs/gg_stats_hourly.log"
TEMP_HR_LOG=/tmp/gg_stats_hr.log
TEMP_DAY_LOG=/tmp/gg_stats_day.log
SCHEMA_NAME=MY_SCHAME
RUN_DATE=`date +"%Y%m%d"_"%H%M%S"`
RUN_HOUR=`date +"%H"`
rm -f $TEMP_HR_LOG 2>/dev/null
rm -f $TEMP_DAY_LOG 2>/dev/null
$GG_HOME/ggsci > $TEMP_HR_LOG << EOD
STATS EXTRACT EXT_I_01, HOURLY
STATS EXTRACT EXT_P_01, HOURLY
STATS EXTRACT EXT_S_01, HOURLY
STATS REPLICAT REP_I_01, HOURLY
STATS REPLICAT REP_P_01, HOURLY
STATS REPLICAT REP_S_01, HOURLY
exit
EOD
if [[ $RUN_HOUR == "23" ]]; then
$GG_HOME/ggsci > $TEMP_DAY_LOG << EOD
STATS EXTRACT EXT_I_01, DAILY
STATS EXTRACT EXT_P_01, DAILY
STATS EXTRACT EXT_S_01, DAILY
STATS REPLICAT REP_I_01, DAILY
STATS REPLICAT REP_P_01, DAILY
STATS REPLICAT REP_S_01, DAILY
exit
EOD
fiecho "=======================" >> $LOG_FILE
echo $RUN_DATE >> $LOG_FILE
echo "=======================" >> $LOG_FILE
less ${TEMP_HR_LOG} | grep -v "Command Interpreter for Oracle" | grep -v OGGCORE | grep -v "Operating system" | grep -v Copyright | grep -v "character set" | grep -v "Linux, x64" | grep -v GGSCI >> $HOUR_LOG_FILE
if [[ -f $TEMP_DAY_LOG ]]; then
less ${TEMP_DAY_LOG} | grep -v "Command Interpreter for Oracle" | grep -v OGGCORE | grep -v "Operating system" | grep -v Copyright | grep -v "character set" | grep -v "Linux, x64" | grep -v GGSCI >> $DAY_LOG_FILE
fi
#=======================
# Keeps Logs for 1 Week
#=======================
if [[ $RUN_HOUR == "01" ]]; then
mv ${HOUR_LOG_FILE}_06 ${HOUR_LOG_FILE}_07 2>/dev/null
mv ${HOUR_LOG_FILE}_05 ${HOUR_LOG_FILE}_06 2>/dev/null
mv ${HOUR_LOG_FILE}_04 ${HOUR_LOG_FILE}_05 2>/dev/null
mv ${HOUR_LOG_FILE}_03 ${HOUR_LOG_FILE}_04 2>/dev/null
mv ${HOUR_LOG_FILE}_02 ${HOUR_LOG_FILE}_03 2>/dev/null
mv ${HOUR_LOG_FILE}_01 ${HOUR_LOG_FILE}_02 2>/dev/null
mv ${HOUR_LOG_FILE} ${HOUR_LOG_FILE}_01 2>/dev/null
mv ${DAY_LOG_FILE}_06 ${DAY_LOG_FILE}_07 2>/dev/null
mv ${DAY_LOG_FILE}_05 ${DAY_LOG_FILE}_06 2>/dev/null
mv ${DAY_LOG_FILE}_04 ${DAY_LOG_FILE}_05 2>/dev/null
mv ${DAY_LOG_FILE}_03 ${DAY_LOG_FILE}_04 2>/dev/null
mv ${DAY_LOG_FILE}_02 ${DAY_LOG_FILE}_03 2>/dev/null
mv ${DAY_LOG_FILE}_01 ${DAY_LOG_FILE}_02 2>/dev/null
mv ${DAY_LOG_FILE} ${DAY_LOG_FILE}_01 2>/dev/null
fi
crontab
59 * * * * /software/oracle/oracle/scripts/gg_stats_monitor/get_gg_stats.sh
No comments:
Post a Comment