GoldenGate monitoring. - GoldenGate

In our environment we have completely dumped streams and useless dataguard. We have been very very pleased with goldengate software and it really does work well (as advertised). However to get monitoring or realtime stats on goldengate we would need to purchase the dashboard. This software is extremely expensive. So I am wondering if anyone has come up with a good way to monitor your goldengate processes?
I am currently working on creating a python script to pump out to Grid Control but as usual Grid Control is not working correctly. So maybe I will send it out to Nagios. Anyway I am not a python programmer but I like the language so if you can improve upon this script by all means let it fly.
Requirements
*goldengate
*Python 2.3-2.4 (tested on 2.3 and 2.4)
*Linux might work on windows never tried never will
Note:Python is very dependent on indentation so it looks like this forum doesn't support whitespace.
#!/usr/bin/python
####################
#Author: Some Guy
#Rev: Initial
#Date: June 24 2010
####################
#!/usr/bin/python
import sys
import getopt
import os
import re
import popen2
def run_ggsci(obey):
pipe = popen2.Popen4("./ggsci")
pid = pipe.pid
pipe.tochild.write(obey + "\n")
pipe.tochild.close() # programm will get EOF on STDIN
return pipe.fromchild.readlines()
if len(sys.argv) < 3:
print 'Usage ',sys.argv[0], ' lag|checkpoint|broken db_instance_name rep|ext'
sys.exit(2)
#Set the oracle_sid env
#Check the oratab for it
oratab=open('/etc/oratab','rb')
db = re.compile(sys.argv[2],re.IGNORECASE)
found = 'N'
for instance in oratab:
if db.match(instance):
os.putenv('ORACLE_SID',sys.argv[2])
found = 'Y'
#if db instance not found exit. Make sure your rac instances are in your oratab
if found == 'N':
print "Error database instance ",sys.argv[2]," not found in oratab."
print 'Usage ',sys.argv[0], ' lag|checkpoint|broken db_instance_name rep|ext'
sys.exit(3)
if sys.argv[3] == "rep":
rep_ext = re.compile(r"REPLICAT")
elif sys.argv[3] == "ext":
rep_ext = re.compile(r"EXTRACT")
else:
print "Read the usage rep or ext not ",sys.argv[3]
print 'Usage ',sys.argv[0], ' lag|checkpoint|broken db_instance_name rep|ext'
sys.exit(3)
for line in run_ggsci("info all"):
if rep_ext.match(line):
#not going to explain this line too deeply read regexp this looks line breaks out each column and then some
match = re.search('^([A-Z]+)[\t ]+([A-Z]+)[\t ]+([A-Z0-9]+)[\t ]+(..):(..):(..)[\t ]+(..):(..):(..)', line)
if match:
if sys.argv[1] == 'lag':
lag_sec = int(match.group(4))*3600+int(match.group(5))*60+int(match.group(6))
if lag_sec > 100 and lag_sec < 500:
print 'em_result=LAG ',match.group(3),lag_sec
elif lag_sec > 500:
print 'em_result=LAGBAD ',match.group(3),lag_sec
sys.exit(2)
#print 'LAG ', match.group(3), int(match.group(4))*3600+int(match.group(5))*60+int(match.group(6))
elif sys.argv[1] == 'checkpoint':
chk_sec = int(match.group(7))*3600+int(match.group(8))*60+int(match.group(9))
if chk_sec > 100 and chk_sec < 500:
print 'em_result=CHECKPOINT ',match.group(3),chk_sec
elif chk_sec > 500:
print 'em_result=CHECKPOINTBAD ',match.group(3),chk_sec
sys.exit(3)
#print 'Checkpoint ', match.group(3), int(match.group(7))*3600+int(match.group(8))*60+int(match.group(9))
elif sys.argv[1] == 'broken':
if match.group(2) == 'ABENDED':
print 'em_result=ABENDED ',match.group(1),match.group(2)
sys.exit(4)
else:
print 'Usage ',sys.argv[0], ' lag|checkpoint|broken db_instance_name rep|ext'
sys.exit(3)
else:
print 'Error ',data
Edited by: user5827076 on Jun 24, 2010 2:36 PM
Edited by: user5827076 on Jun 24, 2010 2:37 PM
Edited by: user5827076 on Jul 5, 2010 10:47 AM 

Hi
Maybe this could help -- try using the GG management pack
http://www.oracle.com/us/products/middleware/data-integration/059249.html
Golden Gate is an Oracle product now ... 

Thanks for the reply but that is the product that is crazy amounts of money to buy. So we are opting for a cheaper way out. 

go to
http://oracleabout.blogspot.com/2010/08/golden-gate-lag-monitoring.html 

I'm using Nagios check_log to monior ggserr.log, grep the keyword "ERROR", very sensitive.

Related

Plotting Trellis chart using ORE script..results in no data

Hi,
I'm intending to plot trellis charts in OBIEE using ORE. The sql script results in no data. Since trellis chart requires library(lattice) to be included, is there a method to include it or other workaround ?
R script used is as follows
begin
sys.rqScriptDrop('HCM_TO_TRELLIS');
sys.rqScriptCreate('HCM_TO_TRELLIS',
'function(dat,plant,switchcase){
ore.sync()
ore.attach()> # Based on parameter passed either plot scatter or trellis
>
> if(switchcase=="single"){
**Keeping it short: code to plot a scatter chart and return PNG as output**
}else{
**Keeping it short: code to plot Trellis chart and return PNG as output**
}
}
');
end;****sql to extract
select id, image
from table(rqTableEval(
cursor(select * from HCM_SCATTER where JOB='Crane Operator'),
cursor(select 1 "ore.connect", 'Mumbai' as "plant", 'trellis' as "switchcase" from dual),
'PNG',
'HCM_TO_TRELLIS'))** Else part contains the trellis chart which results in no data.
Edited by: Kedar Gupte on May 20, 2013 7:18 AM
Edited by: Kedar Gupte on May 20, 2013 11:47 AM 
Hi Kedar,
Invoke library(lattice) within the R script. See the following example:
R> ore.doEval(function(){Depth <- equal.count(quakes$depth, number=8, overlap=.1)
+                                xyplot(lat ~ long | Depth, data = quakes) })
Error in .oci.GetQuery(conn, statement, data = data, prefetch = prefetch, :
ORA-20000: RQuery error
Error in function () : could not find function "equal.count"
ORA-06512: at "RQSYS.RQEVALIMPL", line 104
ORA-06512: at "RQSYS.RQEVALIMPL", line 101
R> ?equal.count ## from lattice package
R> ore.doEval(function(){ *library(lattice)*
+ Depth <- equal.count(quakes$depth, number=8, overlap=.1)
+ xyplot(lat ~ long | Depth, data = quakes) })
In my environment, this second returned the graph in the R client. I often find it useful to invoke the R script first using the R API (ore.*Apply) before invoking it through SQL.
Mark
Edited by: mhornick on May 20, 2013 7:49 AM 
Hi Mark,
The script runs perfectly fine on R client, the 'lattice' library gets included when using ore.doEval on R Client (mentioned lattice, rqconnect etc in RProfile.site).
I've to use rqScript ( R Server ) stored as a procedure on oracle 11g and execute using the select sql used in the physical table of the RPD.
The connection details for it are available from connection pool of the physical layer .
Final goal is to get this trellis from 'PNG' format to OBIEE dashboard.
Here in the above R script if I include library("lattice", lib.loc="C:/Program Files/R/R-2.15.2/library")
even then it gives no result. Result is retrieved for normal scatter chart, fails for trellis alone.
Could you please help me out in including this lattice library in rqScript stored in the DB, or any other workaround to help achieve it ?
Thanks you for support,
Kedar 
Hi Kedar,
One other detail is that you need to include the graphics call within a "print" call. Try the following:
# R
ore.scriptCreate("lattice.test2",
function(){library(lattice)
Depth <- equal.count(quakes$depth, number=8, overlap=.1)
print(xyplot(lat ~ long | Depth, data = quakes))})
-- SQL
select *
from table(rqEval(NULL,
'PNG',
'lattice.test2'));
Regards,
Mark 
Thanks Mark,
print option worked like magic :)

How to cut text and automate through scripts

Hi,
Can somebody please help me cut some pattern of text using a shell script. I know how to do it in java but we have to write a script too just in case the java program fails.
Here is what the out of the file looks like:
<Nov 1, 2005 12:17:07 AM EST> <Info> <Enterprise> <000000> <Login creating session for user taotruba with sessionId Dm6TZwntthnD7J7h
qCJBcntJ200z6ZvpJGHpkmCF1BRvCYVXzd3h!-1978413885!1130822227905>I wanted to show as ........
Time = <Nov 1, 2005 12:17:07 AM EST>
User = taotruba
SessionId = Dm6TZwntthnD7J7h
qCJBcntJ200z6ZvpJGHpkmCF1BRvCYVXzd3h!-1978413885!1130822227905My java program works fine and thanks for your help early on letting me learn java ... :)
sangita 
And you ask this at a Java forum exactly why? And what would the script language be anyway? 
Unix Shell Script.
Well, iam asking here because i have high hopes and iam used to this forum.. also, i have learned java from this forum too..or atleast a lot of contexts. 
There are a lot of options under Unix. I usually opt for AWK 
For your specific case, here's a crude way of doing it. I'm sure there must be a better option but Unix is not my forte. :)
awk '/^<(.*?)>$/ {print "Time = " $1, $2, $3, $4, $5, $6 "\n\nUser = " $15 "\n\nSessionId = " $18}' testfile | sed 's/>$//' | sed 's/<//'
The input is kept is the file named testfile

Inline assembler causing a problem?

Hi.
I was making a program in C with inline assembler (x86) and was using the Sun Studio compiler to compile it. I've noticed though that when I turn on optimization (-xO3) it doesn't seem to work right (it crashes with a segfault, or doesn't give the right result.). And if I remove the inline assembler stuff and replace it with equivalent "vanilla" C code, it does... what's up with that, anyway? The inline asm. stuff seems to work OK though if I don't use the optimizer. What could I do to resolve this problem?
Edited by: mike3 on Feb 15, 2009 6:17 PM 
What compiler version are you using? Run the command "cc -V" and show the output.
Please also provide an example of the kind of code that doesn't work. 
I got this with "cc -V":
---
$ cc -V
cc: Sun C 5.9 SunOS_i386 Patch 124868-01 2007/07/12
usage: cc [ options] files. Use 'cc -flags' for details
--
There are several pieces of code involved, however one of them is this:
--
static void VectorModMul(mod63 *v0, mod63 *v1, u64 len) {
    asm("0:"
            "movq  (%0), %%rax;"
            "movq  (%1), %%rbx;"
            "mulq %%rbx;"
            "divq %2;"
            "movq %%rdx,  (%0);"
            "movq 8(%0), %%rax;"
            "movq 8(%1), %%rbx;"
            "mulq %%rbx;"
            "divq %2;"
            "movq %%rdx, 8(%0);"
            "addq $8, %0;"
            "addq $8, %1;"
            "subq $1, %3;"
            "cmpq $0, %3;"
            "jne 0b;" :
                : "r" (v0), "r" (v1), "r" (Prime), "r" (len)
                : "%rax", "%rbx", "%rdx");
}---
What it's supposed to do is multiply the elements of v0 by those of v1 reduced
modulo the prime number "Prime".
Edited by: mike3 on Feb 15, 2009 11:25 PM 
That's really odd... I can usually only get away with using inline asm with optimizations, e.g. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6769052 
Hello.
Have you had a look on the disassembly of the object file ?
Martin 
mike3 wrote:
Hi.
I was making a program in C with inline assembler (x86) and was using the Sun Studio compiler to compile it. I've noticed though that when I turn on optimization (-xO3) it doesn't seem to work right (it crashes with a segfault, or doesn't give the right result.). And if I remove the inline assembler stuff and replace it with equivalent "vanilla" C code, it does... what's up with that, anyway? The inline asm. stuff seems to work OK though if I don't use the optimizer. What could I do to resolve this problem?
Edited by: mike3 on Feb 15, 2009 6:17 PMHi
First of all please try to compile your code with the latest SunStudioExpress and report results here (latest SSX-release contains improved processing of x86/64 inline assembler)
Alex 
Martin_Rosenau wrote:
Hello.
Have you had a look on the disassembly of the object file ?
MartinI got this:
   0x0000000000401e60:  VectorModMul       :     pushq    %rbp
   0x0000000000401e61:  VectorModMul+0x0001:     movq     %rsp,%rbp
   0x0000000000401e64:  VectorModMul+0x0004:     movq     0x000000000001430d     [ 0x1430d ](%rip),%r8
   0x0000000000401e6b:  VectorModMul+0x000b:     movq     (%rdi),%rax
   0x0000000000401e6e:  VectorModMul+0x000e:     movq     (%rsi),%rbx
   0x0000000000401e71:  VectorModMul+0x0011:     mulq     %rbx
   0x0000000000401e74:  VectorModMul+0x0014:     divq     %r8,%rax
   0x0000000000401e77:  VectorModMul+0x0017:     movq     %rdx,(%rdi)
   0x0000000000401e7a:  VectorModMul+0x001a:     movq     0x0000000000000008(%rdi),%rax
   0x0000000000401e7e:  VectorModMul+0x001e:     movq     0x0000000000000008(%rsi),%rbx
   0x0000000000401e82:  VectorModMul+0x0022:     mulq     %rbx
   0x0000000000401e85:  VectorModMul+0x0025:     divq     %r8,%rax
   0x0000000000401e88:  VectorModMul+0x0028:     movq     %rdx,0x0000000000000008(%rdi)
   0x0000000000401e8c:  VectorModMul+0x002c:     addq     $0x0000000000000008,%rdi
   0x0000000000401e90:  VectorModMul+0x0030:     addq     $0x0000000000000008,%rsi
   0x0000000000401e94:  VectorModMul+0x0034:     subq     $0x0000000000000001,%rdx
   0x0000000000401e98:  VectorModMul+0x0038:     cmpq     $0x0000000000000000,%rdx
   0x0000000000401e9c:  VectorModMul+0x003c:     jne      VectorModMul+0xb     [ 0x401e6b, .-0x31 ]
   0x0000000000401e9e:  VectorModMul+0x003e:     leave   
   0x0000000000401e9f:  VectorModMul+0x003f:     ret      Hmmmmm..... 
Obviously the C compiler assumes that the %0...%3 registers are read-only.
%0 and %1 are rsi and rdi which are typically not modified.
%2 and %3 are both rdx so the compiler thinks the register is only read...
Martin 
Martin_Rosenau wrote:
Obviously the C compiler assumes that the %0...%3 registers are read-only.
%0 and %1 are rsi and rdi which are typically not modified.
%2 and %3 are both rdx so the compiler thinks the register is only read...
MartinThat would sure explain the problem: then when it goes to read/write to the
addresses in those registers, it won't go to the right places but instead to some
unpredictable address (basically, whatever the heck happened to be in
there at the time.). Is there any way to get the compiler to stop making that
assumption and to get the code working, other than by turning off optimizations?
Edited by: mike3 on Feb 19, 2009 12:16 AM 
I would ask you again to try latest SunStudioExpress: it works much better with gnu inline x86 asm and probably your problem has been fixed there. If latest SSX produces wrong code as well as your 5.9 version, then please file bug. If SSX prodices correct code please use it. If you are not permitted to use SSX in your work (due to license or support issues) please send me preprocessed source I will look at it and probably provide you some workaround for your version of SunStudio (email alexey<dot>shubin<at>sun<dot>com)
Thanks
Alex 
alexey_shubin wrote:
I would ask you again to try latest SunStudioExpress: it works much better with gnu inline x86 asm and probably your problem has been fixed there. If latest SSX produces wrong code as well as your 5.9 version, then please file bug. If SSX prodices correct code please use it. If you are not permitted to use SSX in your work (due to license or support issues) please send me preprocessed source I will look at it and probably provide you some workaround for your version of SunStudio (email alexey<dot>shubin<at>sun<dot>com)
Thanks
AlexI looked at the license agreement and saw a dreaded time limit. No can do on that, sorry. And you sure this is a problem with the compiler and not the way the code was written? 
I looked at the license agreement and saw a dreaded time limit. No can do on that, sorry.Too sad.
And you sure this is a problem with the compiler and not the way the code was written?As far as I see the problem in compiler: incorrect processing of clobber constraints.
As workaround I would recommend you to use fake input parameters instead clobbers:
            long fake_long;
...........
            "jne 0b;" :
                : "r" (v0), "r" (v1), "r" (Prime), "r" (len),
                 "a"(fake_long), "b"(fake_long), "d"(fake_long));
}Probably it will work
This problem is already fixed in current development version so I think you will be able to use upcoming release.

High score in an applet

I wrote a game and I'd like to be able to implement a high score. I've alreaedy looked at the other posts for the same problem, and it looks like I have to do it using PHP and SQL. I've looked at PHP sample code and I think I understand how to get that to work. My question is how do I create the database in mySQL? Everywhere I look, it just says to type certain commands in to create the database, but what confuses me is where do I type the commands? Is there a program I need to download? Do I do it on command line?
Thanks - Any help would be greatly appreciated 
Is the game a network game? If you just want the high score to be present on the user's computer (as in a high score for just that user), then just use a text file:
try {
  int score = [xx];
  LineNumberReader lnr = new LineNumberReader(new FileReader("FILE NAME");
  int high = Integer.parseInt(lnr.readLine());
  if(score > high) {
    //OUTPUT YOU GOT HIGH SCORE!!!
    FileWriter.write(score + "");
  }
} catch(IOException ioe) {ioe.printStackTrace();}Edited by: Student_Coder on Oct 21, 2007 6:21 PM 
I think it's
mysql -p That'll prompt you for your password, and you should be in the shell (assuming that the user you're logged in as is a valid user for mysql--otherwise use -u I think).
Once you're in, you should use the CREATE DATABASE SQL statement to create the database (look at the mysql ref). You can then use CONNECT databaseName to connect to your database, or, from the command line, use
mysql -p databaseName However, I agree with coder that there may be better alternatives, especially if it's already a Java game.
Edited by: endasil on Oct 21, 2007 7:34 PM 
well MySQL comes with a client part you can use that from the command line. `mysql -p` is the command i believe
there is a project in sourceforge.net called phpMyAdmin <http://sourceforge.net/projects/phpmyadmin/>
you can use that if you want web based admin facilities.
i can't help notice that your problem domain is in the SQL and MySQL and
PHP. MySQL forums can help you better i believe.

Resource Templates : need to return json response from POST, PUT and DELETE

Hi,
I'm writing an application that requires that {success:true] is returned from POST, PUT and DELETE requests
in the response body.
The client side framework I'm using does not read the HTTP status codes.
I know that I can return anything in the header but this won't work for me, I need to respond with JSON.
I have tried the following,
Handler for DELETE:
Type = PL/SQL Block
begin
delete from debug
where test = ;
select 'true' success from dual;
end;
AND
Handler for DELETE:
Type = Query
begin
delete from debug
where test = ;
select 'true' success from dual;
end;
Both throw 500 errors. Is there anything I can do here to get this to work?
Thanks in advance,
Edited by: mwrf on Feb 14, 2011 2:00 AM
Edited by: mwrf on Feb 14, 2011 2:01 AM 
Try this:
Add a parameter to the DELETE handler with the following values:
name: success, source: URI, access: OUT, type: String
and then the following as the content of the PL/SQL block
begin
... do whatever you need to do here ...
{success} := 'true';
end; 
Thanks Colm,
Works fine. Didn't realise that passing an out param as a URI would
generate JSON like that. 
Hi Colm,
This has been working fine, but I've encountered a small problem when dealing with exceptions.
This does not work:
begin
update x set y = 'y';
:success := 'true';
exception when others then
:success := 'false';
end;
:success is never bound as it's declared twice, nothing is returned.
I know that the listener does not understand pl/sql so can't really do any better,
the solution here is to have a second var in the exception block with a different name.
Is there any other way to catch exceptions and return them in the same variable as above?
Thanks for any help,

Categories

Resources