Thursday, January 29, 2009

No Data Found Error with Oracle Logical Standby

New wiki entry posted for an issue that I encountered with replication stalling between the primary and logical standby databases that I am configuring using Oracle Database 10g Data Guard. There were errors stating that "no data found" when trying to complete the SQL Apply statements to the logical standby and I was able to reinstantiate the object having the issue (a table in this case) from the primary server to get the replication processing again. It took a bit of resource, but the procedure was clearly stated in the Oracle documentation, that I have been very pleased with thus far.

Wednesday, January 28, 2009

Oracle Database 10gR2 Data Guard Logical Standby Configuration

I've completed my "easier to follow" walkthrough of a logical standby database using Oracle 10g Data Guard on Solaris 10. I installed this configuration for a new Remedy ARS configuration that we are migrating to that will offer replication to a failover database instance that can be open for reporting at all times and used as a redundant server in the event that the primary fails.

Although it is a bit more work to create a logical standby (you have to configure it as a physical standby first and then convert to a logical standby), the benefit of having the standby database always open for read-only queries far outweighs the work involved. A physical standby database can be put in a read-only mode to be able to query, but this pauses all redo log application from the primary until it is taken out of read-only mode. Anyway, here is the link to the wiki article that contains this configuration and the steps to manually switchover the roles of the two servers: http://www.amcpu.org/wiki/index.php?title=Oracle_Database_10_Data_Guard_Logical_Standby

Monday, January 19, 2009

Using awk to transpose flat files

Here's a pretty nifty awk script that will take a flat file database that has entries segmented in stanzas rather than single lines. By stanzas I mean a group of lines, in which each entry is delimited by a blank line. Here's how it works:

Here is your flat file database:

Name:Tony Cesaro
Age:25
E-mail:acesaro@gmail.com

Name:Jim Jones
Age:22
E-mail:jim@gmail.com

Here is the file that you are trying to create:

Tony Cesaro,25,acesaro@gmail.com
Jim Jones,22,jim@gmail.com

Here is the script, utilizing the power of awk, showing how to achieve this:

#!/usr/bin/ksh

FFDB=/home/acesaro/people.txt
awk -F"\n" 'BEGIN { RS=""} {print $1" "$2" "$3" "$4}' $FFDB | awk '{print $2","$4","$6"}'

Now let's dissect this quickly:

Obvious, setting the variable:
FFDB=/home/acesaro/people.txt

Transpose the stanzas to single lines; the $1, $2, etc. are set to the values of each line in each stanza:
awk -F"\n" 'BEGIN { RS=""} {print $1" "$2" "$3" "$4}' $FFDB

And finally, use a typical awk line to only print out the values on each line that we want, using -f: to specify ":" as the delimiter and separating each variable with a comma to create a CSV:

awk -F: '{print $2","$4","$6"}'

This is a handy way to translate flat files between formats that previously seemed pretty difficult...to me at least. :)

I utilized this at work to take the flat file DBs that NerveCenter uses to store the nodes that it polls and their associated properties and convert them into a tab delimited lookup file for Netcool.