Domain logic in database

Hi.
I know this is off topic, but I need some feedback.
My company is relativly new to J2EE. We are currently moving our existing application portfolio to J2EE from a two tier client-server architecture developed on Centura and Oracle. Our data model is pretty strong, and much of the domain logic of the application has been moved to the database over the course of the last few years, so there is quite a bit of PL/SQL code in there.
Now there is a heated discussion internally about the validity of making the transition to J2EE with the databases intact and reusing this PL/SQL based domain logic. We have individual proclaiming that every operation on data is domain logic and all domain logic should reside on the application server with J2EE.
I personally feel that J2EE fully allows for keeping domain logic in the database, and that one should always apply the principle of the "best technology for the job" in each case. For instance data intensive transformations and calculations belong on the database.
Please provide me with some support to use in our internal discussions as I feel overpowered by the "darker forces", and would very much like to know how the industry at large feels about this issue.
Regards,
Jorn Olmheim
Senior Java Developer

The purpose of getting the license and joining local and national Realtor associations is to get closer to the target audience. In order to build an effective marketing strategy, a business must learn as much as possible about their target audience. As a Realtor I will be able to easily network with potential clients. Another benefit of getting the license is that it greatly supports the business requirements gathering process for the applications. Actually, many of the features that we are building into the application will enable the broker to streamline business operations and reduce transaction costs. They could then feasilbly reduce the number of sales agents and maintain steady profit margins.
Very interesting.
Whatever happens in the markets, real estate is here to stay and there will always be land and property to buy and sell. Brokers that operate smartly and utilize technology efficiently will survive. Brokers that still maintain antiquated business models and still are in "legal pad" mode might experience difficulties with their business.
Good points, and a good attitude. I only asked because the bursting of the bubble will result in realtors leaving the field, not entering. But in your case it sounds like you've got a plan and a backup.
>
In regards to the math, there are equations for :
calculating the capitalization rate on income-generating properties
calculating annual taxes, monthly taxes and assessed value
finding a sellers net proceeds and sales price of property to meet specificed goals
rent per square foot
determining front footage and find the sales price off of these measurements
amortization of specified loan numbersThis one is usually a problem for folks.
>
measuring lot size and room dimensions with odd shapes
/>You can handle the rest. Not much more than multiplication and addition.
PS - Take these if you think they'll help:
AmortizationCalculatorForm.java
package finance.model;
import java.util.List;
import java.util.ArrayList;
* AmortizationCalculator
* User: Michael
* Date: Jul 16, 2007
* Time: 10:38:16 PM
public class AmortizationCalculator
   private static final int INITIAL_BUILDER_CAPACITY = 2048;
   private double principle;
   private double ratePercentage;
   private int numberOfPayments;
   private double payment;
   private List<AmortizationLineItem> amortizationLineItems;
    * Constructor
    * @param principle to start; must be greater than zero.
    * @param ratePercentage interest rate as a percentage (e.g., 10% interest means a value of 10.0)
    * @param numberOfPayments to be made.  A thirty-year mortgage with monthly payments would have 30*12 = 360 payments
   public AmortizationCalculator(double principle, double ratePercentage, int numberOfPayments)
      this.principle = principle;
      this.ratePercentage = ratePercentage;
      this.numberOfPayments = numberOfPayments;
      this.calculateAmortizationSchedule();
   private void calculateAmortizationSchedule()
      this.payment = calculatePayment(this.principle, this.ratePercentage, this.numberOfPayments);
      this.amortizationLineItems = calculateAmortizationTable(this.principle, this.ratePercentage, this.numberOfPayments, this.payment);
   public static List<AmortizationLineItem> calculateAmortizationTable(double principle, double ratePercentage, int numberOfPayments, double payment)
      List<AmortizationLineItem> amortizationLineItems = new ArrayList<AmortizationLineItem>(numberOfPayments);
      double balance = principle;
      for (int i = 0; i < numberOfPayments; ++i)
         int period = i+1;
         double interest = balance*ratePercentage/100.0;
         double principleReduction = payment-interest;
         amortizationLineItems.add(new AmortizationLineItem(period, balance, payment, principleReduction, interest));
         balance -= principleReduction;
      return amortizationLineItems;
    * Calculate the periodic payment
    * @param principle to be paid; should be a currency type; must be greater than zero
    * @param ratePercentage interest rate as a percentage (e.g., 10% rate means a value of 10.0 here)
    * @param numberOfPayments to complete payment; must be greater than zero.
    * @return periodic payment amount
    * @link http://en.wikipedia.org/wiki/Amortization_schedule
   public static double calculatePayment(double principle, double ratePercentage, int numberOfPayments)
      if (principle < 0.0)
         throw new IllegalArgumentException("Principle must be greater than zero");
      if (numberOfPayments <= 0)
         throw new IllegalArgumentException("Number of payments must be greater than zero");
      double rate = ratePercentage/100.0;
      double mult = Math.pow((1.0 + rate), numberOfPayments);
      return rate*mult*principle/(mult-1.0);
   public double getPrinciple()
      return principle;
   public void setPrinciple(double principle)
      this.principle = principle;
   public double getRatePercentage()
      return ratePercentage;
   public void setRatePercentage(double ratePercentage)
      this.ratePercentage = ratePercentage;
   public int getNumberOfPayments()
      return numberOfPayments;
   public void setNumberOfPayments(int numberOfPayments)
      this.numberOfPayments = numberOfPayments;
   public double getPayment()
      return payment;
    * Given a period number, return the AmortizationLineItem
    * @param period, starting with 1 and going up to numberOfPayments
    * @return AmortizationLineItem for the given period
   public AmortizationLineItem getLineItem(int period)
      return this.amortizationLineItems.get(period-1);
   public String toString()
      StringBuilder builder = new StringBuilder(INITIAL_BUILDER_CAPACITY);
      String newline = System.getProperty("line.separator");
      for (AmortizationLineItem amortizationLineItem : amortizationLineItems)
         builder.append(amortizationLineItem).append(newline);
      return builder.toString();
}AmortizationCalculatorTest.java
package finance.model;
import org.junit.Assert;
import org.junit.Test;
* AmortizationCalculatorTest
* User: Michael
* Date: Jul 16, 2007
* Time: 11:09:37 PM
public class AmortizationCalculatorTest
   public static final double TOLERANCE = 1.0E-3;
   @Test
   public void testCalculatePayment()
      double principle = 100.0;
      double ratePercentage = 10.0;
      int numberOfPayments = 5;
      double expected = 26.38;
      double actual = AmortizationCalculator.calculatePayment(principle, ratePercentage, numberOfPayments);
      Assert.assertEquals("Wrong period payment returned", expected, actual, TOLERANCE);
   @Test(expected = IllegalArgumentException.class)
   public void testNegativePrinciple()
      double principle = -100.0;
      double ratePercentage = 10.0;
      int numberOfPayments = 5;
      AmortizationCalculator.calculatePayment(principle, ratePercentage, numberOfPayments);
   @Test(expected = IllegalArgumentException.class)
   public void testNegativeNumberOfPayments()
      double principle = 100.0;
      double ratePercentage = 10.0;
      int numberOfPayments = -5;
      AmortizationCalculator.calculatePayment(principle, ratePercentage, numberOfPayments);
   @Test
   public void testAmortizationTable()
      double principle = 100.0;
      double ratePercentage = 10.0;
      int numberOfPayments = 5;
      AmortizationLineItem [] expected =
         new AmortizationLineItem(1, 100.0, 26.38, 16.38, 10.0),
         new AmortizationLineItem(2, 83.62, 26.38, 18.02, 8.36),
         new AmortizationLineItem(3, 65.60, 26.38, 19.82, 6.56),
         new AmortizationLineItem(4, 45.78, 26.38, 21.80, 4.58),
         new AmortizationLineItem(5, 23.98, 26.38, 23.98, 2.40),
      AmortizationCalculator calculator = new AmortizationCalculator(principle, ratePercentage, numberOfPayments);
      for (int i = 0; i < expected.length; ++i)
         Assert.assertEquals("Expected " + i + " does not equal actual", expected, calculator.getLineItem(i+1));
AmortizationLineItem.java
package finance.model;
import java.text.NumberFormat;
* AmortizationLineItem
* User: Michael
* Date: Jul 17, 2007
* Time: 11:40:38 AM
public class AmortizationLineItem
   public static final double TOLERANCE = 5.0e-3;
   private final int period;
   private final double outstandingBalance;
   private final double payment;
   private final double principle;
   private final double interest;
   public AmortizationLineItem(int period, double outstandingBalance, double payment, double principle, double interest)
      this.period = period;
      this.outstandingBalance = outstandingBalance;
      this.payment = payment;
      this.principle = principle;
      this.interest = interest;
   public int getPeriod()
      return period;
   public double getOutstandingBalance()
      return outstandingBalance;
   public double getPayment()
      return payment;
   public double getPrinciple()
      return principle;
   public double getInterest()
      return interest;
   public boolean equals(Object o)
      if (this == o)
         return true;
      if (o == null || getClass() != o.getClass())
         return false;
      AmortizationLineItem that = (AmortizationLineItem) o;
      if (Math.abs(that.interest - interest) > TOLERANCE)
         return false;
      if (Math.abs(that.outstandingBalance - outstandingBalance) > TOLERANCE)
         return false;
      if (Math.abs(that.payment - payment) > TOLERANCE)
         return false;
      if (period != that.period)
         return false;
      if (Math.abs(that.principle - principle) > TOLERANCE)
         return false;
      return true;
   public int hashCode()
      int result;
      long temp;
      result = period;
      temp = outstandingBalance != +0.0d ? Double.doubleToLongBits(outstandingBalance) : 0L;
      result = 31 * result + (int) (temp ^ (temp >>> 32));
      temp = payment != +0.0d ? Double.doubleToLongBits(payment) : 0L;
      result = 31 * result + (int) (temp ^ (temp >>> 32));
      temp = principle != +0.0d ? Double.doubleToLongBits(principle) : 0L;
      result = 31 * result + (int) (temp ^ (temp >>> 32));
      temp = interest != +0.0d ? Double.doubleToLongBits(interest) : 0L;
      result = 31 * result + (int) (temp ^ (temp >>> 32));
      return result;
   public String toString()
      return
         "period=" + period +
         ", balance=" + NumberFormat.getCurrencyInstance().format(outstandingBalance) +
         ", payment=" + NumberFormat.getCurrencyInstance().format(payment) +
         ", principle=" + NumberFormat.getCurrencyInstance().format(principle) +
         ", interest=" + NumberFormat.getCurrencyInstance().format(interest);
}SimpleInterestCalculator.java
package finance.model;
import java.text.DecimalFormat;
* A simple interest calculator
* @link http://mathforum.org/dr.math/faq/faq.interest.html
public class SimpleInterestCalculator
    public static final double DEFAULT_PRINCIPAL = 6000.0;
    public static final double DEFAULT_AMOUNT = 7680.0;
    public static final double DEFAULT_PERCENT = 0.04;
    public static final int DEFAULT_PERIODS = 7;
    public static final DecimalFormat DEFAULT_FORMAT = new DecimalFormat("0.00");
     * Command line driver
     * @param args command line
    public static void main(String [] args)
        try
            double principal = ((args.length > 0) ? Double.parseDouble(args[0]) : DEFAULT_PRINCIPAL);
            double amount   = ((args.length > 1) ? Double.parseDouble(args[1]) : DEFAULT_AMOUNT);
            double percent = ((args.length > 2) ? Double.parseDouble(args[2]) : DEFAULT_PERCENT);
            int numPeriods = ((args.length > 3) ? Integer.parseInt(args[3]) : DEFAULT_PERIODS);
            System.out.println("amount   : " + DEFAULT_FORMAT.format(SimpleInterestCalculator.calcAmount(principal, percent, numPeriods)));
            System.out.println("principal: " + DEFAULT_FORMAT.format(SimpleInterestCalculator.calcPrincipal(amount, percent, numPeriods)));
            System.out.println("interest : " + DEFAULT_FORMAT.format(SimpleInterestCalculator.calcInterest(principal, amount, numPeriods)));
            System.out.println("# periods: " + DEFAULT_FORMAT.format(SimpleInterestCalculator.calcNumPeriods(principal, amount, percent)));
        catch (Exception e)
            e.printStackTrace();
     * Calculate the amount after a number of periods for a given
     * starting principal and interest rate
     * @param principal at start
     * @param percent interest rate (e.g., percent = 0.10 for 10% interest)
     * @param numPeriods number of periods
     * @return amount accumulated after numPeriods
     * @throws IllegalArgumentException if the number of periods is negative
    public static double calcAmount(double principal, double percent, int numPeriods)
        if (numPeriods < 0)
            throw new IllegalArgumentException("Scalar of periods must be positive");
        // A = P(1+ni)
        return principal*(1.0 + percent*numPeriods);
     * Calculate the principal to start with given a desired amount,
     * interest rate, and number of periods
     * @param amount at end
     * @param percent interest rate (e.g., percent = 0.10 for 10% interest)
     * @param numPeriods number of periods
     * @return principal at start
     * @throws IllegalArgumentException if the number of periods is negative
    public static double calcPrincipal(double amount, double percent, int numPeriods)
        if (numPeriods < 0)
            throw new IllegalArgumentException("Scalar of periods must be positive");
        // P = A/(1+ni)
        return amount/(1.0 + percent*numPeriods);
     * Calculate the interest rate for a given amount, principal, and number of periods
     * @param principal at start
     * @param amount at end
     * @param numPeriods number of periods
     * @return interest rate
     * @throws IllegalArgumentException if the number of periods is non-positive
    public static double calcInterest(double principal, double amount, int numPeriods)
        if (numPeriods <= 0)
            throw new IllegalArgumentException("Scalar of periods must be greater than zero");
        // i = ([A/P]-1)/n.
        return ((amount/principal) - 1.0)/numPeriods;
     * Calculate the number of periods for a given amount, principal, and rate
     * @param principal at start
     * @param amount at end
     * @param percent rate
     * @return number of periods
    public static double calcNumPeriods(double principal, double amount, double percent)
        //n = ([A/P]-1)/i
        return ((amount/principal) - 1.0)/percent;

Similar Messages

  • Domain logic in the database

    Hi.
    Don't know if this fits the topic, but I need some feedback.
    My company is relativly new to J2EE. We are currently moving our existing application portfolio to J2EE from a two tier client-server architecture developed on Centura and Oracle. Our data model is pretty strong, and much of the domain logic of the application has been moved to the database over the course of the last few years, so there is quite a bit of PL/SQL code in there.
    Now there is a heated discussion internally about the validity of making the transition to J2EE with the databases intact and reusing this PL/SQL based domain logic. We have individual proclaiming that every operation on data is domain logic and all domain logic should reside on the application server with J2EE.
    I personally feel that J2EE fully allows for keeping domain logic in the database, and that one should always apply the principle of the "best technology for the job" in each case. For instance data intensive transformations and calculations belong on the database.
    Please provide me with some support to use in our internal discussions as I feel overpowered by the "darker forces", and would very much like to know how the industry at large feels about this issue.
    Regards,
    Jorn Olmheim
    Senior Java Developer

    Hey Jorn.
    Sorry, but I would have to side with the dark forces you mention. In moving to an 'n' tier architecture, the Business logic should be contained in server side components, not the database. This will allow re-use of componenents across other applications(think Enterprise here), as well as providing a layer of abstraction for accessing the database.
    Also, What if you change db vendors? All your pl/sql code will need to be ported. Very messy.

  • Creating a new schema in a Logical Standby Database

    Hi All,
    I am experimenting with logical standby databases for the purpose of reporting, and have not been able to create a new schema in the logical standby database - one of the key features of logical standbys.
    I have setup primary and logical standby databases, and they seem to be running just fine - changes are moved from the primary to the standby and queries on the standby seem to run ok.
    However, If I try to create a new schema on the logical standby, that does not exist on the primary, I get "ORA-01031: insufficient privileges" errors when I try to create new objects.
    Show below are the steps I have taken to create the new schema on the logical standby. Any help would be greatly appreciated.
    SYS@UATDR> connect / as sysdba
    Connected.
    SYS@UATDR>
    SYS@UATDR> select name, log_mode, database_role, guard_status, force_logging, flashback_on, db_unique_name
    2 from v$database
    3 /
    NAME LOG_MODE DATABASE_ROLE GUARD_S FOR FLASHBACK_ON DB_UNIQUE_NAME
    UATDR ARCHIVELOG LOGICAL STANDBY ALL YES YES UATDR
    SYS@UATDR>
    SYS@UATDR> create tablespace ts_new
    2 /
    Tablespace created.
    SYS@UATDR>
    SYS@UATDR> create user new
    2 identified by new
    3 default tablespace ts_new
    4 temporary tablespace temp
    5 quota unlimited on ts_new
    6 /
    User created.
    SYS@UATDR>
    SYS@UATDR> grant connect, resource to new
    2 /
    Grant succeeded.
    SYS@UATDR> grant unlimited tablespace, create table, create any table to new
    2 /
    Grant succeeded.
    SYS@UATDR>
    SYS@UATDR> -- show privs given to new
    SYS@UATDR> select * from dba_sys_privs where grantee='NEW'
    2 /
    GRANTEE PRIVILEGE ADM
    NEW CREATE ANY TABLE NO
    NEW CREATE TABLE NO
    NEW UNLIMITED TABLESPACE NO
    SYS@UATDR>
    SYS@UATDR> -- create objects in schema
    SYS@UATDR> connect new/new
    Connected.
    NEW@UATDR>
    NEW@UATDR> -- prove ability to create tables
    NEW@UATDR> create table new
    2 (col1 number not null)
    3 tablespace ts_new
    4 /
    create table new
    ERROR at line 1:
    ORA-01031: insufficient privileges
    NEW@UATDR>
    NEW@UATDR>

    HI Daniel,
    I appreciate your quick response.
    My choice of name may not have been ideal, however changing new to another name - like gav - does not solve the problem.
    SYS@UATDR> connect / as sysdba
    Connected.
    SYS@UATDR>
    SYS@UATDR> select name, log_mode, database_role, guard_status, force_logging, flashback_on, db_unique_name
    2 from v$database
    3 /
    NAME LOG_MODE DATABASE_ROLE GUARD_S FOR FLASHBACK_ON DB_UNIQUE_NAME
    UATDR ARCHIVELOG LOGICAL STANDBY ALL YES YES UATDR
    SYS@UATDR>
    SYS@UATDR> create tablespace ts_gav
    2 /
    Tablespace created.
    SYS@UATDR>
    SYS@UATDR> create user gav
    2 identified by gav
    3 default tablespace ts_gav
    4 temporary tablespace temp
    5 quota unlimited on ts_gav
    6 /
    User created.
    SYS@UATDR>
    SYS@UATDR> grant connect, resource to gav
    2 /
    Grant succeeded.
    SYS@UATDR> grant unlimited tablespace, create table, create any table to gav
    2 /
    Grant succeeded.
    SYS@UATDR>
    SYS@UATDR> -- show privs given to gav
    SYS@UATDR> select * from dba_sys_privs where grantee='GAV'
    2 /
    GRANTEE PRIVILEGE ADM
    GAV CREATE TABLE NO
    GAV CREATE ANY TABLE NO
    GAV UNLIMITED TABLESPACE NO
    SYS@UATDR>
    SYS@UATDR> -- create objects in schema
    SYS@UATDR> connect gav/gav
    Connected.
    GAV@UATDR>
    GAV@UATDR> -- prove ability to create tables
    GAV@UATDR> create table gav
    2 (col1 number not null)
    3 tablespace ts_gav
    4 /
    create table gav
    ERROR at line 1:
    ORA-01031: insufficient privileges
    GAV@UATDR>

  • Logical Standby Database in NOARCHIVE Mode

    Hi,
    I have configured a Logical Standby Database for Reporting purposes. A Physical Standby Database is running for MAA. i.e. in case of Role Transition (switch/Failover) the Physical Stdby Db will get the role of the Primary.
    The logical standby database is creating a lot of Archive Redologs files, nearly every minute. Redolog files are 50MB and there is no work done in db during the time. I'm NOT using Standby Redolog files.
    Is there a need for logical standby database to be in NOARCHIVELOG mode? The Primary is definatley in ARCHIVELOG mode.
    Thanks for any responses.
    regards
    Sahba

    hi,
    well there are two things to the above:-
    1. there was an archive file nearly every minute:
    this is due to a db recovery. for some reason, the db was in inconsistent state, after a sudden shutdownof the OS. I was on a test environment, on windows vista, unfortunately. unimportant ... a reboot solved it.
    2. Logical standby db in NOARCHIVE MODE when setup for the purpose of Reporting.
    As long as the MAA configured for the primary db, such as physical standby db, and a second, the logical standby db setup purely for the purpose of reporting, which then can run with NOARCHIVELOG mode, after converting the physical standby db to logical.
    logical standby db uses Streams architecture, so this method brings cost, time and performance advantages to the customer.
    regards
    Sahba

  • How to delete the foreign archivelogs in a Logical Standby database

    How do I remove the foreign archive logs that are being sent to my logical standby database. I have files in the FRA of ASM going back weeks ago. I thought RMAN would delete them.
    I am doing hot backups of the databases to FRA for both databases. Using ASM, FRA, in a Data Guard environment.
    I am not backing up anything to tape yet.
    The ASM FRA foreign_archivelog directory on the logical standby FRA keeps growing and nothing is get deleted when
    I run the following command every day.
    delete expired backup;
    delete noprompt force obsolete;
    Primary database RMAN settings (Not all of them)
    CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 9 DAYS;
    CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
    CONFIGURE DB_UNIQUE_NAME 'WMRTPRD' CONNECT IDENTIFIER 'WMRTPRD_CWY';
    CONFIGURE DB_UNIQUE_NAME 'WMRTPRD2' CONNECT IDENTIFIER 'WMRTPRD2_CWY';
    CONFIGURE DB_UNIQUE_NAME 'WMRTPRD3' CONNECT IDENTIFIER 'WMRTPRD3_DG';
    CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
    Logical standby database RMAN setting (not all of them)
    CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 9 DAYS;
    CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
    CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
    How do I cleanup/delete the old ASM foreign_archivelog files?

    OK, the default is TRUE which is what it is now
    from DBA_LOGSTDBY_PARAMETERS
    LOG_AUTO_DELETE     TRUE          SYSTEM     YES
    I am not talking about deleting the Archive logs files for the Logical database that it is creating, but the Standby archive log files being sent to the Logical Database after they have been applied.
    They are in the alert log as follows under RFS LogMiner: Registered logfile
    RFS[1]: Selected log 4 for thread 1 sequence 159 dbid -86802306 branch 763744382
    Thu Jan 12 15:44:57 2012
    *RFS LogMiner: Registered logfile [+FRA/wmrtprd2/foreign_archivelog/wmrtprd/2012_01_12/thread_1_seq_158.322.772386297] to LogM*
    iner session id [1]
    Thu Jan 12 15:44:58 2012
    LOGMINER: Alternate logfile found. Transition to mining archived logfile for session 1 thread 1 sequence 158, +FRA/wmrtprd2/
    foreign_archivelog/wmrtprd/2012_01_12/thread_1_seq_158.322.772386297
    LOGMINER: End mining logfile for session 1 thread 1 sequence 158, +FRA/wmrtprd2/foreign_archivelog/wmrtprd/2012_01_12/threa
    d_1_seq_158.322.772386297
    LOGMINER: Begin mining logfile for session 1 thread 1 sequence 159, +DG1/wmrtprd2/onlinelog/group_4.284.771760923                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Sql Apply issue in logical standby database--(10.2.0.5.0) x86 platform

    Hi Friends,
    I am getting the following exception in logical standby database at the time of Sql Apply.
    After run the command alter database start logical standby apply sql apply services start but after few second automatically stop and getting following exception.
    alter database start logical standby apply
    Tue May 17 06:42:00 2011
    No optional part
    Attempt to start background Logical Standby process
    LOGSTDBY Parameter: MAX_SERVERS = 20
    LOGSTDBY Parameter: MAX_SGA = 100
    LOGSTDBY Parameter: APPLY_SERVERS = 10
    LSP0 started with pid=30, OS id=4988
    Tue May 17 06:42:00 2011
    Completed: alter database start logical standby apply
    Tue May 17 06:42:00 2011
    LOGSTDBY status: ORA-16111: log mining and apply setting up
    Tue May 17 06:42:00 2011
    LOGMINER: Parameters summary for session# = 1
    LOGMINER: Number of processes = 4, Transaction Chunk Size = 201
    LOGMINER: Memory Size = 100M, Checkpoint interval = 500M
    Tue May 17 06:42:00 2011
    LOGMINER: krvxpsr summary for session# = 1
    LOGMINER: StartScn: 0 (0x0000.00000000)
    LOGMINER: EndScn: 0 (0x0000.00000000)
    LOGMINER: HighConsumedScn: 2660033 (0x0000.002896c1)
    LOGMINER: session_flag 0x1
    LOGMINER: session# = 1, preparer process P002 started with pid=35 OS id=4244
    LOGSTDBY Apply process P014 started with pid=47 OS id=5456
    LOGSTDBY Apply process P010 started with pid=43 OS id=6484
    LOGMINER: session# = 1, reader process P000 started with pid=33 OS id=4732
    Tue May 17 06:42:01 2011
    LOGMINER: Begin mining logfile for session 1 thread 1 sequence 1417, X:\TANVI\ARCHIVE2\ARC01417_0748170313.001
    Tue May 17 06:42:01 2011
    LOGMINER: Turning ON Log Auto Delete
    Tue May 17 06:42:01 2011
    LOGMINER: End mining logfile: X:\TANVI\ARCHIVE2\ARC01417_0748170313.001
    Tue May 17 06:42:01 2011
    LOGMINER: Begin mining logfile for session 1 thread 1 sequence 1418, X:\TANVI\ARCHIVE2\ARC01418_0748170313.001
    LOGSTDBY Apply process P008 started with pid=41 OS id=4740
    LOGSTDBY Apply process P013 started with pid=46 OS id=7864
    LOGSTDBY Apply process P006 started with pid=39 OS id=5500
    LOGMINER: session# = 1, builder process P001 started with pid=34 OS id=4796
    Tue May 17 06:42:02 2011
    LOGMINER: skipped redo. Thread 1, RBA 0x00058a.00000950.0010, nCV 6
    LOGMINER: op 4.1 (Control File)
    Tue May 17 06:42:02 2011
    LOGMINER: End mining logfile: X:\TANVI\ARCHIVE2\ARC01418_0748170313.001
    Tue May 17 06:42:03 2011
    LOGMINER: Begin mining logfile for session 1 thread 1 sequence 1419, X:\TANVI\ARCHIVE2\ARC01419_0748170313.001
    Tue May 17 06:42:03 2011
    LOGMINER: End mining logfile: X:\TANVI\ARCHIVE2\ARC01419_0748170313.001
    Tue May 17 06:42:03 2011
    LOGMINER: Begin mining logfile for session 1 thread 1 sequence 1420, X:\TANVI\ARCHIVE2\ARC01420_0748170313.001
    Tue May 17 06:42:03 2011
    LOGMINER: End mining logfile: X:\TANVI\ARCHIVE2\ARC01420_0748170313.001
    Tue May 17 06:42:03 2011
    LOGMINER: Begin mining logfile for session 1 thread 1 sequence 1421, X:\TANVI\ARCHIVE2\ARC01421_0748170313.001
    LOGSTDBY Analyzer process P004 started with pid=37 OS id=5096
    Tue May 17 06:42:03 2011
    LOGMINER: End mining logfile: X:\TANVI\ARCHIVE2\ARC01421_0748170313.001
    LOGSTDBY Apply process P007 started with pid=40 OS id=2760
    Tue May 17 06:42:03 2011
    Errors in file x:\oracle\product\10.2.0\admin\tanvi\bdump\tanvi_p001_4796.trc:
    ORA-00600: internal error code, arguments: [krvxbpx20], [1], [1418], [2380], [16], [], [], []
    LOGSTDBY Apply process P012 started with pid=45 OS id=7152
    Tue May 17 06:42:03 2011
    LOGMINER: Begin mining logfile for session 1 thread 1 sequence 1422, X:\TANVI\ARCHIVE2\ARC01422_0748170313.001
    Tue May 17 06:42:03 2011
    LOGMINER: End mining logfile: X:\TANVI\ARCHIVE2\ARC01422_0748170313.001
    Tue May 17 06:42:03 2011
    LOGMINER: Begin mining logfile for session 1 thread 1 sequence 1423, X:\TANVI\ARCHIVE2\ARC01423_0748170313.001
    Tue May 17 06:42:03 2011
    LOGMINER: End mining logfile: X:\TANVI\ARCHIVE2\ARC01423_0748170313.001
    Tue May 17 06:42:03 2011
    LOGMINER: Begin mining logfile for session 1 thread 1 sequence 1424, X:\TANVI\ARCHIVE2\ARC01424_0748170313.001
    LOGMINER: session# = 1, preparer process P003 started with pid=36 OS id=5468
    Tue May 17 06:42:03 2011
    LOGMINER: End mining logfile: X:\TANVI\ARCHIVE2\ARC01424_0748170313.001
    Tue May 17 06:42:04 2011
    LOGMINER: Begin mining logfile for session 1 thread 1 sequence 1425, X:\TANVI\ARCHIVE2\ARC01425_0748170313.001
    LOGSTDBY Apply process P011 started with pid=44 OS id=6816
    LOGSTDBY Apply process P005 started with pid=38 OS id=5792
    LOGSTDBY Apply process P009 started with pid=42 OS id=752
    Tue May 17 06:42:05 2011
    krvxerpt: Errors detected in process 34, role builder.
    Tue May 17 06:42:05 2011
    krvxmrs: Leaving by exception: 600
    Tue May 17 06:42:05 2011
    Errors in file x:\oracle\product\10.2.0\admin\tanvi\bdump\tanvi_p001_4796.trc:
    ORA-00600: internal error code, arguments: [krvxbpx20], [1], [1418], [2380], [16], [], [], []
    LOGSTDBY status: ORA-00600: internal error code, arguments: [krvxbpx20], [1], [1418], [2380], [16], [], [], []
    Tue May 17 06:42:06 2011
    Errors in file x:\oracle\product\10.2.0\admin\tanvi\bdump\tanvi_lsp0_4988.trc:
    ORA-12801: error signaled in parallel query server P001
    ORA-00600: internal error code, arguments: [krvxbpx20], [1], [1418], [2380], [16], [], [], []
    Tue May 17 06:42:06 2011
    LogMiner process death detected
    Tue May 17 06:42:06 2011
    logminer process death detected, exiting logical standby
    LOGSTDBY Analyzer process P004 pid=37 OS id=5096 stopped
    LOGSTDBY Apply process P010 pid=43 OS id=6484 stopped
    LOGSTDBY Apply process P008 pid=41 OS id=4740 stopped
    LOGSTDBY Apply process P012 pid=45 OS id=7152 stopped
    LOGSTDBY Apply process P014 pid=47 OS id=5456 stopped
    LOGSTDBY Apply process P005 pid=38 OS id=5792 stopped
    LOGSTDBY Apply process P006 pid=39 OS id=5500 stopped
    LOGSTDBY Apply process P007 pid=40 OS id=2760 stopped
    LOGSTDBY Apply process P011 pid=44 OS id=6816 stopped
    Tue May 17 06:42:10 2011

    Errors in file x:\oracle\product\10.2.0\admin\tanvi\bdump\tanvi_p001_4796.trc:
    ORA-00600: internal error code, arguments: [krvxbpx20], [1], [1418], [2380], [16], [], [], []submit an SR to ORACLE SUPPORT.
    refer these too
    *ORA-600/ORA-7445 Error Look-up Tool [ID 153788.1]*
    *Bug 6022014: ORA-600 [KRVXBPX20] ON LOGICAL STANDBY*

  • Creating logical standby database

    Hi all,
    10.2.0.1
    Following this link
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/create_ls.htm
    Where do i need to issue these statements:
    SQL> EXECUTE DBMS_LOGSTDBY.BUILD;
    SQL> ALTER DATABASE RECOVER TO LOGICAL STANDBY db_name;
    on physical standby or primary database.
    I issued the first stament on primary and second on physical standby .
    IN the alert log of standby,i have the following entries.
    Wed Jan 20 15:34:28 2010
    Converting standby mount to primary mount.
    Wed Jan 20 15:34:28 2010
    ACTIVATE STANDBY: Complete - Database mounted as primary (treasury)
    *** DBNEWID utility started ***
    DBID will be changed from 306589979 to new DBID of 330710340 for database
    .........................I am trying to create a logical standby database after creating a physical standby database.
    It seems standby changed to primary which was not desired.
    Thanks

    Not tried myself, but you might want to have a look at this URL.
    It appears to suggest that you need to change names of datafiles as well as value db_name explcitly on standby.

  • Creation of Logical Standby Database Using RMAN ACTIVE DATABASE COMMAND

    Hi All,
    I am in confusion how to create logical standby database from primary database using rman active database command.
    What i did:-
    Create primary database on machine 1 on RHEL 5 with Oracle 11gR2
    Create standby database on machine 2 on RHEL 5 With Oracle 11gR2 from primary using RMAN active database command
    Trying to create logical standby database on machine 3 on RHEL 5 with Oracle 11gR2 using RMAN active database command from primary.
    The point which confuse me is to start the logical standby in nomount mode on machine 3 with which pfile like i create the pfile for standby database do i need to create the pfile for logical standby db.
    I done the creation of logical standby database by converting physical standby to logical standby database
    I am following the below mentioned doc for the same:
    Creating a physical and a logical standby database in a DR environment | Chen Guang&amp;#039;s Blog
    Kindly guide me how to work over the same or please provide me the steps of the same.
    Thanks in advance.

    Thanks for your reply
    I already started the logical standby database with pfile in nomount mode. And successfully completed the duplication of database. by mentioning the DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT parameter.
    But i am not able to receive the logs on the above mentioned blog i run the sql command to check the logs but getting "no rows selected"
    My primary database pfile is:
    pc01prmy.__db_cache_size=83886080
    pc01prmy.__java_pool_size=12582912
    pc01prmy.__large_pool_size=4194304
    pc01prmy.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
    pc01prmy.__pga_aggregate_target=79691776
    pc01prmy.__sga_target=239075328
    pc01prmy.__shared_io_pool_size=0
    pc01prmy.__shared_pool_size=134217728
    pc01prmy.__streams_pool_size=0
    *.audit_file_dest='/u01/app/oracle/admin/pc01prmy/adump'
    *.audit_trail='db'
    *.compatible='11.1.0.0.0'
    *.control_files='/u01/app/oracle/oradata/PC01PRMY/controlfile/o1_mf_91g3mdtr_.ctl','/u01/app/oracle/flash_recovery_area/PC01PRMY/controlfile/o1_mf_91g3mf6v_.ctl'
    *.db_block_size=8192
    *.db_create_file_dest='/u01/app/oracle/oradata'
    *.db_domain=''
    *.db_file_name_convert='/u01/app/oracle/oradata/PC01SBY/datafile','/u01/app/oracle/oradata/PC01PRMY/datafile'
    *.db_name='pc01prmy'
    *.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
    *.db_recovery_file_dest_size=2147483648
    *.diagnostic_dest='/u01/app/oracle'
    *.dispatchers='(PROTOCOL=TCP) (SERVICE=pc01prmyXDB)'
    *.fal_client='PC01PRMY'
    *.fal_server='PC01SBY'
    *.log_archive_config='DG_CONFIG=(pc01prmy,pc01sby,pc01ls)'
    *.log_archive_dest_1='LOCATION=/u01/app/oracle/flash_recovery_area/PC01PRMY/ VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=pc01prmy'
    *.log_archive_dest_2='SERVICE=pc01sby LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=pc01sby'
    *.log_archive_dest_3='SERVICE=pc01ls LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME=pc01ls'
    *.log_archive_dest_state_1='ENABLE'
    *.log_archive_dest_state_2='DEFER'
    *.log_archive_dest_state_3='DEFER'
    *.log_archive_max_processes=30
    *.log_file_name_convert='/u01/app/oracle/oradata/PC01SBY/onlinelog','/u01/app/oracle/oradata/PC01PRMY/onlinelog'
    *.open_cursors=300
    *.pga_aggregate_target=78643200
    *.processes=150
    *.remote_login_passwordfile='EXCLUSIVE'
    *.sga_target=236978176
    *.undo_tablespace='UNDOTBS1'
    My logical standby pfile is:-
    pc01ls.__db_cache_size=92274688
    pc01ls.__java_pool_size=12582912
    pc01ls.__large_pool_size=4194304
    pc01ls.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
    pc01ls.__pga_aggregate_target=79691776
    pc01ls.__sga_target=239075328
    pc01ls.__shared_io_pool_size=0
    pc01ls.__shared_pool_size=125829120
    pc01ls.__streams_pool_size=0
    *.audit_file_dest='/u01/app/oracle/admin/pc01ls/adump'
    *.audit_trail='db'
    *.compatible='11.1.0.0.0'
    *.control_files='/u01/app/oracle/oradata/PC01LS/controlfile/o1_mf_91g3mdtr_.ctl','/u01/app/oracle/flash_recovery_area/PC01LS/controlfile/o1_mf_91g3mf6v_.ctl'
    *.db_block_size=8192
    *.db_create_file_dest='/u01/app/oracle/oradata'
    *.db_domain=''
    *.db_file_name_convert='/u01/app/oracle/oradata/PC01SBY/datafile','/u01/app/oracle/oradata/PC01PRMY/datafile'
    *.db_name='pc01prmy'
    *.db_unique_name='pc01ls'
    *.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
    *.db_recovery_file_dest_size=2147483648
    *.diagnostic_dest='/u01/app/oracle'
    *.dispatchers='(PROTOCOL=TCP) (SERVICE=pc01prmyXDB)'
    *.log_archive_config='DG_CONFIG=(pc01prmy,pc01sby,pc01ls)'
    *.log_archive_dest_1='LOCATION=/u01/app/oracle/flash_recovery_area/PC01PRMY/ VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=pc01prmy'
    *.log_archive_dest_2='LOCATION=/u01/app/oracle/flash_recovery_area/PC01LS/ VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=pc01ls'
    *.log_archive_dest_3='SERVICE=pc01ls LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES, PRIMARY_ROLE) DB_UNIQUE_NAME=pc01ls'
    *.log_archive_dest_state_1='ENABLE'
    *.log_archive_dest_state_2='ENABLE'
    *.log_archive_max_processes=30
    *.log_file_name_convert='/u01/app/oracle/oradata/PC01SBY/onlinelog','/u01/app/oracle/oradata/PC01PRMY/onlinelog'
    *.open_cursors=300
    *.pga_aggregate_target=78643200
    *.processes=150
    *.remote_login_passwordfile='EXCLUSIVE'
    *.sga_target=236978176
    *.undo_tablespace='UNDOTBS1'
    Kindly advice over the same

  • Logical Standby Database and XMLDB

    I couldn't find a proper group to post this message and thought I would try here.
    I want to set up a Logical Standby Database for our production database server 9.2.0.4.0 with XMLDB. I am having problem with some system tables that were created when I registered some XML schemas.
    These tables are in the standby database but Oracle complains the object does not exist.
    Any idea?

    >
    The "may be" is because I have tested flashback of a physical standby to before resetlogs, but not a logical standby.
    >
    A physical standby keeps the DBID of the primary - a logical standby does not. That is exactly the problem that restricts the reconversion into physical from logical, and you did not encounter that problem.
    >
    I haven't used "keep identity" but from what I read it relates to "convert to physical" not "flashback database".
    >
    Exactly. And that is what the OP wants to do: convert to physical (from logical).
    You mentioned that this might be possible with flashback.
    Problem: During the conversion from physical to logical, the DBID gets changed unless you specify (in 11g) KEEP IDENTITY. This would make it possible to reconvert into phyiscal from logical.
    In short: If there is no solution for the changed DBID of the logical standby in order to flashback it into physical as you suggested, then it is not possible .
    When I saw your first answer, I thought that you might have a solution in mind in order to solve that obvious problem. Sorry for having bothered you.
    Kind regards
    Uwe
    http://uhesse.wordpress.com

  • Logical Standby databases

    Hi,
    When we say "Logical Standby Databases are logically identical to primary databases although the physical organization and structure of the data can be different." what does it exactly means?
    Does it mean that in logical standby tablespace name, schema name, table name, column names etc can be different and still has the same data as primary?
    Does it mean that we can exclude indexes and constraints as present in primary?
    Only the data should match with primary word by word, value by value?
    I am asking this as i have never worked in a logical standby database but i seriously want to know.
    Please answer.
    Regards,
    SID

    Physical standby differs from logical standby:
    Physical standby schema matches exactly the source database.
    Archived redo logs and FTP'ed directly to the standby database which is always running in "recover" mode. Upon arrival, the archived redo logs are applied directly to the standby database.
    Logical standby is different from physical standby:
    Logical standby database does not have to match the schema structure of the source database.
    Logical standby uses LogMiner techniques to transform the archived redo logs into native DML statements (insert, update, delete). This DML is transported and applied to the standby database.
    Logical standby tables can be open for SQL queries (read only), and all other standby tables can be open for updates.
    Logical standby database can have additional materialized views and indexes added for faster performance.
    Installing Physical standbys offers these benefits:
    An identical physical copy of the primary database
    Disaster recovery and high availability
    High Data protection
    Reduction in primary database workload
    Performance Faster
    Installing Logical standbys offer:
    Simultaneous use for reporting, summations and queries
    Efficient use of standby hardware resources
    Reduction in primary database workload
    Some limitations on the use of certain datatypes

  • Logical standby database problem

    i have setup logical standby database on my pc . Everything was working fine . Logs were applied.
    But i tried testing few things on standby and issued few commands on that.
    After that the logs were not applied. i tried to restart that also dint work.
    what should i do so that things r back to normal or i need to create the standby again .
    Thanks

    The output is as follows .
    SQL> SELECT APPLIED_SCN, NEWEST_SCN, READ_SCN, NEWEST_SCN-APPLIED_SCN FROM DBA_LOGSTDBY_PROGRESS;
    APPLIED_SCN NEWEST_SCN READ_SCN NEWEST_SCN-APPLIED_SCN
    179493 194423 179497 14930
    SQL> SELECT TYPE, HIGH_SCN, STATUS FROM V$LOGSTDBY;
    no rows selected
    SQL> select operation, options, object_name, cost
    2 from v$sql_plan, v$session, v$logstdby
    3 where v$sql_plan.hash_value = v$session.sql_hash_value
    4 and v$session.serial# = v$logstdby.serial#
    5 and v$logstdby.status_code=16113;
    no rows selected

  • Logical standby database

    Guys,
    Is it possible to create a logical standby database without installing Oracle Data Guard.And if yes how sync. is performed.
    Thanks

    Hi,
    Is it possible to create a logical standby database without installing Oracle Data Guard.In a sense Oracle Streams and Quest Shareplex created a logical standby, but you can have them open too . . . Madhu Tumma explains this in his Oracle Streams book, but it's only conceptually similar to logical standby in Data Guard:
    http://www.rampant-books.com/book_2004_2_streams.htm
    Hope this helps. . .
    Don Burleson
    Oracle Press author
    Author of “Oracle Tuning: The Definitive Reference”
    http://www.dba-oracle.com/bp/s_oracle_tuning_book.htm

  • Logical standby database SE

    In the past we creating and maintaining physical standby database in SE (without DataGuard, via scripts).
    Is possible create and maintain LOGICAL standby database in SE without DataGard (any example are welcome!)
    Thanks in advance!
    Diego.

    According to Metalink Note:271886.1
    "Message queuing and apply features of Oracle Streams are available in Standard Edition and Standard Edition One, but change capture is available only in Enterprise Edition."
    HTH
    Thanks
    Chandra Pabba

  • Logical standby database to physical standby database

    I already start my logical standby database and I want to return it again to physical standby database. So what should I do?

    >
    The "may be" is because I have tested flashback of a physical standby to before resetlogs, but not a logical standby.
    >
    A physical standby keeps the DBID of the primary - a logical standby does not. That is exactly the problem that restricts the reconversion into physical from logical, and you did not encounter that problem.
    >
    I haven't used "keep identity" but from what I read it relates to "convert to physical" not "flashback database".
    >
    Exactly. And that is what the OP wants to do: convert to physical (from logical).
    You mentioned that this might be possible with flashback.
    Problem: During the conversion from physical to logical, the DBID gets changed unless you specify (in 11g) KEEP IDENTITY. This would make it possible to reconvert into phyiscal from logical.
    In short: If there is no solution for the changed DBID of the logical standby in order to flashback it into physical as you suggested, then it is not possible .
    When I saw your first answer, I thought that you might have a solution in mind in order to solve that obvious problem. Sorry for having bothered you.
    Kind regards
    Uwe
    http://uhesse.wordpress.com

  • Logical Standby Database with 10g+ASM on both sides??

    Hi out there,
    is there a known way to establish a logical standby database on 10g, if both
    sides are running with an ASM setup?
    I've tried to create one out of a physical standby database (which is set up
    and running w/o any problems), like a book suggested me to do.
    The procedure was:
    1. switch on supplemental logging
    2. prepare initiation parameters (for archive logging etc.) on both sides for
    logical stb.
    3. shut down the phyiscal standby
    4. alter database create logical standby controlfile as '<path>'; on the
    primary, transfer the controlfile to the standby db. Here I had to use RMAN
    to copy the controlfile into the ASM System, and modify the initfile/spfile
    in order to use the controlfile. No problem so far.
    5. mount the standby database, alter database recover managed standby database
    disconnect; -> At this point, the alert log complained about non-available
    datafiles.
    6. alter database activate standby database; --> fails ("needs recovery") due
    to last point.
    The trouble is, the controlfile created at point 4 cointains wrong paths to
    the datafiles. Since I can not have the same disk group name on the standby
    system, and since ASM renames the stored datafiles by its own, the complaints
    of point 5 are comprehensible, but nevertheless annoying.
    I tried to backup a controlfile to trace and change the paths, but at after
    mounting the standby with this controlfile and proceeding at point 5, the
    system says "<path> is not a standby controlfile"
    Is there a different way of creating a "Logical Standby Database with 10g+ASM
    on both sides"? Metalink said nothing about LogStby and ASM.
    Best regards and thanks in advance,
    Martin

    I'm not sure if this will work but try:
    1. create trace control file (you did it)
    2. change paths (you did it)
    3. recrate control file (you did it)
    ... there was error occured during mount before
    so mount database (not as standby)
    4. create standby control file (from recreated control file)
    5. shutdown instance, replace control file with new standby control file or replace the control filename in parameter file.
    6. mount as standby
    What happend?
    Update: Tested on my side and it has worked fine... How about you?
    Message was edited by:
    Ivan Kartik

Maybe you are looking for