Monitor Oracle Golden Gate from SQL
One of my presentations at Collaborate 14 this year revolves around how many different ways there are to monitor Oracle Golden Gate. As I was putting the presentation together, I was listing out the different ways for monitoring. I have covered a few of the ways already in earlier posts. What I want to show you here is how to execute a simple “info all” command and see the results from SQL*Plus or SQL Developer using SQL.
First, a script (shell, Perl, etc..) needs to be written to write the output of the “info all” command to a text file. In this case, I’m going to write the text file in /tmp since I’m on Linux.
#!/usr/bin/perl -w # #Author: Bobby Curtis, Oracle ACE #Copyright: 2014 #Title: gg_monitor_sqldev.pl # use strict; use warnings; #Static Variables my $gghome = "/oracle/app/product/12.1.2/oggcore_1"; my $outfile = "/tmp/gg_process_sqldev.txt"; #Program my @buf = `$gghome/ggsci << EOF info all EOF`; open (GGPROC, ">$outfile") or die "Unable to open file"; foreach (@buf) { if(/MANAGER/||/JAGENT/||/EXTRACT/||/REPLICAT/) { no warnings 'uninitialized'; chomp; my ($program, $status, $group, $lagatchkpt, $timesincechkpt) = split(" "); if ($group eq "") { $group = $program; } if ($lagatchkpt eq "" || $timesincechkpt eq "") { $lagatchkpt = "00:00:00"; $timesincechkpt = "00:00:00"; } print GGPROC "$program|$status|$group|$lagatchkpt|$timesincechkpt\n"; } } close (GGPROC);
Next, is the text file needs to be placed into a table to be read by SQL*Plus or SQL Developer. External Tables are great for this.
create directory TEMP as '/tmp'; grant read on directory TEMP to PUBLIC; drop table ggate.os_process_mon; create table ggate.os_process_mon ( process char(15), status char(15), group char(15), lagatchk char(15), timelastchk char(15) ) organization external (type oracle_loader default directory TEMP access parameters ( RECORDS DELIMITED BY NEWLINE FIELDS TERMINATED BY '|' MISSING FIELD VALUES ARE NULL ( process char(15), status char(15), ggroup char(15), lagatchk char(15), timelastchk char(15) ) ) location ('gg_process_sqldev.txt') ); select * from ggate.os_process_mon;
Lastly, with these two pieces in place, I can now select the status from SQL*Plus or SQL Developer using SQL. Image 1 shows a sample from my testing environment, I’m building.
Image 1:
Enjoy!
twitter: @dbasolved
blog: http://dbasolved.com
Current Oracle Certs
Bobby Curtis
I’m Bobby Curtis and I’m just your normal average guy who has been working in the technology field for awhile (started when I was 18 with the US Army). The goal of this blog has changed a bit over the years. Initially, it was a general blog where I wrote thoughts down. Then it changed to focus on the Oracle Database, Oracle Enterprise Manager, and eventually Oracle GoldenGate.
If you want to follow me on a more timely manner, I can be followed on twitter at @dbasolved or on LinkedIn under “Bobby Curtis MBA”.
Hey! Do you know if they make any plugins to assist with Search Engine Optimization? I’m
trying to get my blog to rank for some targeted keywords
but I’m not seeing very good gains. If you know of any please share.
Cheers! I saw similar art here: Eco product
For instance, the RC truck beneath has a label designating it as a 27-MHz mannequin.
This has profound implications for how we develop drugs and how we use them where to buy priligy
This medication can affect the normal levels of electrolytes potassium, magnesium, calcium, phosphorous, etc priligy reddit
Take the Infertility Quiz to learn the risks and treatment of infertility cytotec generic
This is a topic which is near to my heart… Thank you! Exactly where are your contact details though?
I must thank you for the efforts you’ve put in writing this blog. I’m hoping to check out the same high-grade blog posts from you in the future as well. In fact, your creative writing abilities has encouraged me to get my very own blog now 😉
This is the perfect blog for anyone who hopes to understand this topic. You know so much its almost tough to argue with you (not that I really would want to…HaHa). You definitely put a brand new spin on a subject which has been discussed for ages. Excellent stuff, just wonderful.
Can I simply just say what a comfort to uncover an individual who actually knows what they’re talking about on the net. You certainly realize how to bring a problem to light and make it important. A lot more people have to check this out and understand this side of the story. It’s surprising you are not more popular since you surely have the gift.
Greetings! Very useful advice in this particular post! It is the little changes which will make the greatest changes. Thanks for sharing!
Howdy sir, you have a really nice blog layout “
I blog frequently and I seriously thank you for your content. This great article has really peaked my interest. I will book mark your blog and keep checking for new information about once per week. I subscribed to your RSS feed as well.