CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI:
Need help on how to use Perl DBI script to poll logs from oracle databases?

 



remy06
New User

Jul 27, 2010, 7:52 AM

Post #1 of 2 (3852 views)
Need help on how to use Perl DBI script to poll logs from oracle databases? Can't Post

Hi,

Am not sure if this has anything to do with perl programming but would like to seek your advice.

I have 2 separate servers each with oracle database installed.I am trying to pull oracle logs from these 2 databases to my main linux server using perl DBI. On this linux server I have 1 dbipoll.pl script and 2 wrapper scripts that pass in parameters to dbipoll.pl.

The scripts I've used are found here: http://www.james.labocki.com/?p=153

Here is the sample wrapper script that I've used to call dbipoll.pl(separate script with different parameters for each databases used):

#!/bin/sh
#
export ORACLE_HOME=/ora-main/app/oracle/product/11.1.0.6/db
export ORACLE_SID=rmdev1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME
#
/usr/bin/dbipoll.pl -dbtype=oracle -server=servername1 -dbport=1521 -d +b=development -user=myuser -xpassword=/etc/dbipasswd -table=dba_audit +_trail -columns="OS_PROCESS,OS_USERNAME,USERNAME,USERHOST,ACTION,ACTI +ON_NAME,TRANSACTIONID,SCN,SQL_BIND,SQL_TEXT,TO_CHAR(EXTENDED_TIMESTAM +P,'MM/DD/YYYY HH24:MI:SS'),EXTENDED_TIMESTAMP" -countfile="/app/oracl +e/product/monitor/countfile1" -countkey="EXTENDED_TIMESTAMP" -o="/opt +/oracledb1.log"

As you can see,the script should retrieve logs and write to oracledb1.log and update the countfile1 with the latest timestamp.The wrapper scripts are scheduled to run at 5mins interval.

The first wrapper script,which I've named as call_dbipoll1.sh runs fine. I am able to retrieve events and both oracledb1.log and countfile1 are successfully updated.

However,the second wrapper script,call_dbipoll2.sh is successful only for the first run. For subsequent runs,I've noticed that countfile2 does not get updated with the latest timestamp(ie. the file returns to blank) and oracledb2.log returns to blank as well. Therefore,am unable to pull new events then. Unable to determine what went wrong here..

Here is sample of my second wrapper script that tries to retrieve events from the 2nd database:

#!/bin/sh
#
export ORACLE_HOME=/ora-main/app/oracle/product/11.1.0.6/db
export ORACLE_SID=rmdev2
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME
#
/usr/bin/dbipoll.pl -dbtype=oracle -server=servername2 -dbport=1521 -d +b=development -user=myuser -xpassword=/etc/dbipasswd -table=dba_audit +_trail -columns="OS_PROCESS,OS_USERNAME,USERNAME,USERHOST,ACTION,ACTI +ON_NAME,TRANSACTIONID,SCN,SQL_BIND,SQL_TEXT,TO_CHAR(EXTENDED_TIMESTAM +P,'MM/DD/YYYY HH24:MI:SS'),EXTENDED_TIMESTAMP" -countfile="/app/oracl +e/product/monitor/countfile2" -countkey="EXTENDED_TIMESTAMP" -o="/opt +/oracledb2.log"


Is there anything wrong with it?Anyone can advice on the problem or has any solutions/workarounds to solve it? Thanks in advance.


FishMonger
Veteran / Moderator

Jul 27, 2010, 8:21 AM

Post #2 of 2 (3850 views)
Re: [remy06] Need help on how to use Perl DBI script to poll logs from oracle databases? [In reply to] Can't Post

Cross posted: http://forums.devshed.com/perl-programming-6/need-help-on-how-to-use-perl-dbi-script-to-730389.html#post2506641

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives