Вы находитесь на странице: 1из 5

1.

Monitoring Shareplex using scripts


Scripts are located in prod/util folder SharePlex provides scripts for monitoring replication: Sp_eventmon monitors the Shareplex event log and scan for errors and report them # Usage: # sp_eventmon -t(interval) -p(path) -n(name) -s(sp_cop name) -m & # where # -t specifies the time interval between successive scans every n seconds. # This parameter is optional and if not specified defaults to 60 seconds. # -p specifies the path to the SharePlex event log file. # This parameter is mandatory, the script will fail if not specified. # -n specifies the name of the event log file if different from default. # This parameter is optional and if not specified defaults to event_log. # -m specifies that a user should be notified via e-mail. # This parameter is optional and by default no mail will be sent. # -s specifies the unique name for each instance of sp_cop on the same host. # This parameter is mandatory, the script will fail if not specified. # & If the program is not started as a background process then the user # will not regain control of the shell. # # Dependencies: # iwgrep should be installed along with this script and the error_list file which # contains a list of errors to be monitored should also be installed in the same # directory as the script. A marker file called 'splex.mrk' will be created in the # same directory as well and should not be deleted. If deleted the script will start # scanning the file from the begining.The script uses mailx program to send e-mails. # Before using the script make sure the mailx is configured on the host on which this # will be deployed and can successfully send mail. Sp_logmon - monitor the redo log that Oracle is writing to and Shareplex is reading from and report it. Monitors how well Capture is keeping peace with the changes entering the redo logs # Usage: # sp_logmon -p(port) -t(interval) -l(integer) -m & # where # -p specifies the port number that the sp_cop is listening to on. # -t specifies the time interval between successive scans every n seconds. # This parameter is optional and if not specified defaults to 60 seconds. # -l specifies the threshold value for the number of redo logs. # This parameter is optional, will default to 2 if not specified. # -m specifies that a user should be notified via e-mail. # This parameter is optional and by default no mail will be sent. # & If the program is not started as a background process then the user # will not regain control of the shell. # # Dependencies: # The script uses mailx program to send e-mails. Before using the script make # sure the mailx is configured on the host on which this script will be deployed # and can successfully send mail.

Page 1

din 5

Sp_ps monitors shareplex processes and notifies if one, or more are stopped # Startmode: # nohup sp_ps 'sp_cop' MULTI_SOURCE >/dev/null 2>&1 # Usage: # sp_ps 'sp_cop -uname' CONFIGURATION & # where # 'sp_cop -uname' is the name of a specific sp_cop with the -u notation and typically # the port number that particular sp_cop is listening on. # CONFIGURATION The valid values are MULTI_SOURCE, SOURCE, and TARGET. This refers to # the configuration of the SharePlex instance being monitored. # A particular SharePlex instance can be configured to be SOURCE or # ,a TARGET or slave and MULTI_SOURCE in which case it send and receive changes. # & If the program is not started as a background process then the user # will not regain control of the shell. # # Dependencies: # The script uses mailx program to send e-mails. Before using the script make # sure the mailx is configured on the host on which this script will be deployed # and can successfully send mail.

Sp_qstatmon - monitors the Shareplex qstatus and report the backlog if it crosses the threshold. This enables you to take corrective actions before queues exceed available disk space. # Usage: # sp_qstatmon [-t n] [-v path] [-p port number] [-c integer] [-d integer] [-e integer] [-m] # where # -t specifies the time interval between successive scans every n seconds. # This parameter is optional and if not specified defaults to 60 seconds. # -p specifies the port number that SharePlex instance is attached to. # This parameter is optional and if not specified defaults to 2100. # -v specifies the path to the appropriate data directory for SharePlex. # This parameter is mandatory, the script will fail if not specified. # -m specifies that a user should be notified via e-mail. # This parameter is optional and by default no mail will be sent. # -c specifies the threshold number for the messages in capture queue. # This parameter is optional and if not specified defaults to 100. # -d specifies the threshold number for the messages in post queue. # This parameer is optional and if not specified defaults to 100. # -e specifies the threshold number for the messages in export queue. # This parameer is optional and if not specified defaults to 100. # & If the program is not started as a background process then the user # will not regain control of the shell. # # # Dependencies: # The script uses mailx program to send e-mails. Before using the script make # sure the mailx is configured on the host on which this script will be deployed # and can successfully send mail. Make sure that sp_ctrl utility is also installed # into the same directory as this script, since this script is dependent on sp_ctrl

Page 2

din 5

# # #

for functioning. Also, it creates a couple of temp files in the same directory as the one in which it resides. make sure the executing the script has write permission to that directory.

2. Monitoring SharePlex using replicated tables and dbms_job


SharePlex replication can be also monitored using dummy tables for measuring the replication delay for each defined queue. Create is shareplex schema, or in any other schema the following objects: On the source: DROP TABLE DEMO_SRC CASCADE CONSTRAINTS; --- heartbeat (Table) -CREATE TABLE heartbeat ( ID NUMBER, TIMESTAMP DATE ) LOGGING NOCOMPRESS NOCACHE NOPARALLEL NOMONITORING; --- dbms_job for populating source table -DECLARE X NUMBER; BEGIN SYS.DBMS_JOB.SUBMIT ( job => X ,what => 'BEGIN INSERT INTO heartbeat (ID, TIMESTAMP ) VALUES (0, SYSDATE ); COMMIT ; END ; ' ,next_date => to_date('04/10/2008 11:08:55','mm/dd/yyyy hh24:mi:ss') ,interval => 'SYSDATE+1/1440 ' ,no_parse => FALSE );

Page 3

din 5

END;

On the destination: On the destination you must create as many tables as post queues defined. DROP TABLE heartbeat_q1 CASCADE CONSTRAINTS; --- heartbeat_q1 (Table) -CREATE TABLE heartbeat_q1 ( ID NUMBER, TIMESTAMP DATE, DELAY NUMBER ) LOGGING NOCOMPRESS NOCACHE NOPARALLEL NOMONITORING; CREATE OR REPLACE TRIGGER T_CALC_DELAY BEFORE INSERT OR UPDATE ON heartbeat_q1 REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW DECLARE tmpvar NUMBER; /****************************************************************************** NAME: PURPOSE: REVISIONS: Ver Date Author Description --------- ---------- --------------- -----------------------------------1.0 4/10/2008 Mihai Ghita 1. Created this trigger. NOTES: ******************************************************************************/ BEGIN tmpvar := 0; SELECT (SYSDATE - :NEW.TIMESTAMP) * 24 * 60 * 60 INTO tmpvar FROM DUAL; :NEW.DELAY := tmpvar; EXCEPTION WHEN OTHERS

Page 4

din 5

THEN NULL; END; / Modify the configuration file to add the following lines:
SPLEX.HEARTHBEAT SPLEX.HEARTHBEAT SPLEX.HEARTHBEAT SPLEX.HEARTHBEAT SPLEX.HEARTHBEAT SPLEX.HEARTHBEAT SPLEX.HEARTHBEAT SPLEX.HEARTHBEAT SPLEX.HEARTHBEAT SPLEX.HEARTHBEAT_ Q_DAY_1 SPLEX.HEARTHBEAT_ Q_DAY_2 SPLEX.HEARTHBEAT_ Q_DAY_3 SPLEX.HEARTHBEAT_ Q_DAY_4 SPLEX.HEARTHBEAT_ Q_DAY_5 SPLEX.HEARTHBEAT_ Q_MONTHLY_1 SPLEX.HEARTHBEAT_ Q_BILLDAY_1 SPLEX.HEARTHBEAT_ Q_BILLDAY_2 SPLEX.HEARTHBEAT_ Q_BILLDAY_3 hebe.mis.orange.intra:Q_DAY_1@o.dwdx hebe.mis.orange.intra:Q_DAY_2@o.dwdx hebe.mis.orange.intra:Q_DAY_3@o.dwdx hebe.mis.orange.intra:Q_DAY_4@o.dwdx hebe.mis.orange.intra:Q_DAY_5@o.dwdx hebe.mis.orange.intra: Q_MONTHLY_1@o.dwdx hebe.mis.orange.intra: Q_BILLDAY_1@o.dwdx hebe.mis.orange.intra: Q_BILLDAY_2@o.dwdx hebe.mis.orange.intra: Q_BILLDAY_3@o.dwdx

Page 5

din 5

Вам также может понравиться