Toplink Sequence - Preallocation in Oracle

In my application , we are using Oc4j and Toplink. Some times when we
restart the app server , breaks in sequences are observer. We are using native
sequence provided by Oracle. In toplink doc , it is specified that preallocation
is happening and preallocation size will be equvalent to increment size of Sequence created in Oracle. We haven't specified increment size of the sequence and hence it will take default value .. ie 1.. Apprx there is a 20 count difference. This is not happening always...
Any idea about this issue ?

So is this a terminology mismatch?
The Oracle DB's CACHE xxx parameter of CREATE SEQUENCE will "Specify how many values of the sequence the database preallocates and keeps in memory for faster access.".
But TopLink's doc implies that it is the INCREMENT BY parameter that is analagous to TopLink's "preallocation size" (i.e. "To avoid sequencing errors in the application, set the TopLink preallocation size and the Oracle SEQUENCE object INCREMENT to the same value. ).
If I specify "...CACHE 20 INCREMENT BY 1" in the database, and preallocation size 1 in TopLink (for a brand new sequence starting from 1), this will work. But do I need to synchronize the CACHE 20 behavior between the DB and TopLink?
Don't we *want* some sort of SEQUENCE caching in TopLink to forego the DB roundtrip?
TIA
gary

Similar Messages

  • Sequence Preallocation Question

    Hi,
    We are doing performance review for a complex web-based application. We found that when using sequence preallocation in our descriptor, our application runs fast. For example, when doing insert 100 record to a 50-fields table, it takes less than 4 secs to complete as it is compared to 31 secs when not using sequence prealloc.
    Yet, for some tables and for some reasons, we dont want to use sequence prealloc. Is it possible to configure this sequence prealloc specific for some tables/models? Meaning half of our table will use sequence prealloc and others not ( using one descriptor ).
    Your help greatly appreciated.
    Doni

    Doni,
    At the moment TopLink only supports one Sequence object, so what you are trying to do is quite interesting, but not supported at the moment.
    Deepak

  • Want to use sequence object of oracle when loading data in sql loader

    Hi,
    I want to use sequence when loading data in sqll loader, but the problem is i could not use sequence object of oracle to load the data by sql loader, i can use sequence of sql loader.
    I want to use sequence object because in later entries this sequence object will be used.If i use sequence of sql loader how can i use oracle sequence object
    Is there any other option

    I have a simillar problem, I also want to use a sequence when loading data by the SQL Loader.
    My control file is:
    load data
    infile '0testdata.txt'
    into table robertl.tbltest
    fields terminated by X'09'
    trailing nullcols
    (redbrojunos,
    broj,
    dolazak,
    odlazak nullif odlazak=blanks,
    komentar nullif komentar=blanks)
    And the datafile is:
    robertl.brojilo.nextval     1368     17.06.2003 08:02:46     17.06.2003 16:17:18     
    robertl.brojilo.nextval     2363     17.06.2003 08:18:18     17.06.2003 16:21:52     
    robertl.brojilo.nextval     7821     17.06.2003 08:29:22     17.06.2003 16:21:59     
    robertl.brojilo.nextval     0408     17.06.2003 11:20:27     17.06.2003 18:33:00     ispit
    robertl.brojilo.nextval     1111     17.06.2003 11:30:58     17.06.2003 16:09:34     Odlazak na ispit
    robertl.brojilo.nextval     6129     17.06.2003 14:02:42     17.06.2003 16:23:23     seminar
    But all records were rejected by the Loader, for every record I get the error:
    Record 1: Rejected - Error on table ROBERTL.TBLTEST, column REDBROJUNOS.
    ORA-01722: invalid number

  • TopLink on WebLogic or oracle.toplink.PersistenceProvider

    Hy.
    I have applied patch 5KXF to add toplink 11g on WebLogic 10.3.
    Now, in BEA_HOME\patch_wls1030\patch_jars\ there is toplink.jar.
    But how can I use it?
    Inside toplink.jar there is file META-INF\services\META-INF\services\javax.persistence.spi.PersistenceProvider.
    I assume that content of this file is the name of the implementation class.
    It is "oracle.toplink.PersistenceProvider".
    But when I put this name in persistence.xml and try to deploy my EAR, this message appears
    =====================================================================================================
    weblogic.deployment.EnvironmentException: Error processing persitence unit toplink of module toplink.jar: Error instantiating the Persistenc
    e Provider class oracle.toplink.essentials.PersistenceProvider of the PersistenceUnit toplink: java.lang.ClassNotFoundException: oracle.topl
    ink.essentials.PersistenceProvider
    at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactory(PersistenceUnitInfoImpl.java:322)
    at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:123)
    at weblogic.deployment.AbstractPersistenceUnitRegistry.storeDescriptors(AbstractPersistenceUnitRegistry.java:331)
    at weblogic.deployment.AbstractPersistenceUnitRegistry.loadPersistenceDescriptor(AbstractPersistenceUnitRegistry.java:245)
    at weblogic.deployment.ModulePersistenceUnitRegistry.<init>(ModulePersistenceUnitRegistry.java:63)
    =====================================================================================================
    The persistence.xml file looks like
    =====================================================================================================
    <persistence-unit name="toplink">
    <provider>
    oracle.toplink.essentials.PersistenceProvider
    </provider>
    <jta-data-source>jdbc/miroslav_rehirDS</jta-data-source>
    </persistence-unit>
    =====================================================================================================
    One thing more .... In the filesistem I can't find class oracle.toplink.PersistenceProvider.
    On the other hand it is OK to put
    <provider>
    org.eclipse.persistence.jpa.PersistenceProvider
    </provider>
    Thanks four your replies,
    Miroslav

    Miroslav,
    You may be interested in the latest release of Oracle WebLogic Server.
    See the recent OTN post from 20110115 detailing the latest release of Oracle WebLogic Server and some retesting of the previous issues related to JSR-317 JPA 2.0 support below.
    11g Release 1 Patch Set 3 (WLS 10.3.4)
    The latest release of Oracle WebLogic Server has been available on OTN at the following location since 20110115.
    http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-main-097127.html
    This release provides support for JSR-317 JPA 2.0 container managed applications using the QWG8 patch or a manual prepending classpath change.
    In 10.3.3.0 you were required to use the FilteringClassLoader via the *<wls:prefer-application-packages>* addition to your application managed persistence unit - this workaround as well as the persistence.xml renaming one is now fully deprecated and not required in 10.3.4.0 for both application and container managed persistence contexts.
    As of 20110115 the 5 outstanding issues below look to be fixed by applying the http://download.oracle.com/docs/cd/E17904_01/web.1111/e13720/using_toplink.htm#EJBAD1309 patch for QWG8 or manually prepending to the WebLogic 10.3.4.0 server classpath.
    commEnv.cmd: line 67
    @rem Set BEA Home
    set BEA_HOME=C:\opt\wls1034r20110115
    @rem Enable JPA 2.0 functionality on WebLogic Server 10.3.4 with the following patch line for commEnv.cmd:67
    set PRE_CLASSPATH=%BEA_HOME%\modules\javax.persistence_1.0.0.0_2-0-0.jar;%BEA_HOME%\modules\com.oracle.jpa2support_1.0.0.0_2-0.jar
    A JPA 2.0 EE application using EclipseLink as the JPA2 persistence provider on WebLogic is detailed in the analysis section below1) JPA 2.0 XSD parsing - verified
    2) New JPA 2.0 schema elements like <shared-cache-mode>NONE</shared-cache-mode> - verified
    3) JPA 2.0 runtime API like a entityManager.getMetamodel(); call on the Servlet or Stateless session bean - verified
    4) JPA 2.0 weaving/instrumentation - this will require a more detailed lazy model and more debugging to fully verify
    5) Dependency Injection of a container managed JPA 2.0 entityManager on a EJB component like a stateless session bean - verified
    http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#Enabling_JPA2_support
    OTN downloadhttp://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-main-097127.html
    Patching
    http://download.oracle.com/docs/cd/E18476_01/doc.220/e18480/weblogicchap.htm
    Documentationhttp://download.oracle.com/docs/cd/E17904_01/web.1111/e13852/toc.htm
    Supported Oracle WebLogic Server Versionshttp://download.oracle.com/docs/cd/E15315_06/help/oracle.eclipse.tools.weblogic.doc/html/SupportedServerVersions.html
    TopLink JPA 2.0 Specific documentation/patchinghttp://download.oracle.com/docs/cd/E17904_01/web.1111/e13720/using_toplink.htm#EJBAD1309
    EclipseLink Wiki: JPA 2.0 using EclipseLink on WebLogic analysis (XSD, Weaving, DI of @PersistenceContext)http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/weblogic#Enabling_JPA2_support
    thank you
    /Michael O'Brien
    http://www.eclipselink.org

  • Sequence object in Oracle

    Hello experts, I am using oracle 11g.I have a sequence to generate some ids.If I want that my sequence has been reset like i will start from starting again.It is possible to re initiate a sequence object in Oracle.If it is my client's requirement. Thank You regards aaditya

    You could always use ALTER SEQUENCE
    or simply re-create your sequence. However this may invalidate database objects.
    cheers

  • How to Use Sequence created in Oracle Database in SQL Ldr Control file

    Hi,
    I created a sequence in oracle database. How will use the sequence in SQL loader Control file.
    Thanks in advance

    Hi,
    You might get a good response to your post in the forum dedicated to data movement , including SQL*Loader . You can find it here Export/Import/SQL Loader & External Tables
    Regards,

  • How to use Toplink as SDO in Oracle BPEL

    can we use Toplink as SDO for BPEL?

    We have not yet shipped our TopLink SDO implementation. The intent is that in our next major release the TopLink SDO will be used internally and should be available for your usage in the OracleAS/SOA suite.
    Doug

  • Sequence Generation on Oracle Client

    Hi...
    We have to create sequences on the oc4j client with the format <mobileuser name><date stamp><sequence number>.How do we get the mobileuser name from the mobile client authentication.Can u please tell us the API to login the mobile client and how it can be passed on to include in the sequence.
    Thanks in Advance....

    You need to place that code where ever you are creating your user session object. I don't know the architecture you are using so I really can't tell you exactly where to place it.
    http://download-uk.oracle.com/docs/cd/B19188_01/doc/B15920/nvappdev.htm
    Here is what the documentation has on the subject:
    <blockquote>
    7.2.4.3.2 Web-to-Go User Context
    Web-to-Go creates a user context (or user profile) for every user who logs in to Web-to-Go. Web applications always run within the user's specific context. Servlets, which are always part of an application, can use the user context (in which it is running) to access the services provided by Web-to-Go. The user context can then be used to obtain the following information.
    Name of the user
    Mode the user is running in (online or offline)
    Application that a user is accessing
    The database connection
    Roles that the user has for this application
    Name or value pairs stored in the registry for the user
    Servlets can access the user profile through the standard named java.security.Principal obtained through the getUserPrincipal method of the javax.servlet.http.HttpServletRequest class.
    This object can also be obtained from the HttpSession object. For example,
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException{
    // Retrieve the database connection from the User Profile,
    // which can be accessed from the HttpRequest
    HttpSession session = request.getSession(true);
    OraUserProfile profile = (OraUserProfile)session.getAttribute("x-mobileserver-user");     
    7.2.4.3.3 Database Connectivity in Java Code
    Servlets can obtain a connection to the Oracle database, using the following statement.
    HttpSession sess = request.getSession();
    WTGUser user = (WTGUser)sess.getAttribute("x-mobileserver-user");
    Connection conn = user.getConnection() ;
    </blockquote>

  • Sequence Execution in oracle apps forms

    hi all
    I want to know the execution sequence of the form personalization, CUSTOM PLL , Profile options in oracle apps for a specified form
    thanks

    Hi;
    What is your EBS?
    Please check below thread which is similar as your question
    Re: Form Personalization
    Regard
    Helios

  • Fetch out of Sequence after upgrade oracle 11

    Hi,
    Since we are updating our customers from oracle 8,9 or 10 to oracle 11, we get the error ORA-01002 'fetch out of sequence' alot.
    There is nothing changed in the database structure or our programming and it occurs on different tables.
    The only thing we've noticed is, if we use a oracle client 10 on oracle 11 database we don't have the problem.
    Is there a problem with the oracle 11 client or another solution that prevent the error.
    The option to install an oracle 10 client with every customer is not a solution
    because we don't manage every database of our customer but we have to work with it.
    Thx in advance!
    Friendly regards,
    Gregor

    Indeed we find it also a weird problem, but it is growing problem because more of our customors are updating to oracle 11.
    And we find it also difficult to believe it depends on the client software.
    Could it be a database userrights problem that is changed a little bit in the oracle 11? Because we see its a problem between tables from different users.
    We didn't change anything with a upgrade to oracle 11.

  • Sequence caching with oracle

    Hi,
    In my application, I use toplink as a JPA provider. For performance reasons, I defined an allocationSize on sequence generator for some persistence objects. I read some documentation to understand how it works, the result of my research is that the allocationSize of sequence generator must match with the increment value of the sequence in database.
    So here is my question, what if my sequence define a cache in the database ? For a cache of 1000 values on the application (or server) side, I can create a sequence like this : sequence myseq increment by 1000 cache 20.
    Does it mean that 20 values will be cached or 1000*20 values will be cached ? Is the cache size defined per session or for all the sessions of the database ?
    Thanks.
    Will.

    ok.... so if my sequence starts with 10000 and has a cache of 5, values from 11000 to 15000 will be cached, not values from 10000 to 100020 ?"5" values will be cached. You will find the following example to be helpful.
    [cache]
    SQL> create sequence myseq start with 10000 cache 5;
    Sequence created.
    SQL> select increment_by, cache_size, last_number from user_sequences where sequence_name = 'MYSEQ';
    INCREMENT_BY CACHE_SIZE LAST_NUMBER
    1 5 10000
    SQL> select myseq.nextval from dual;
    NEXTVAL
    10000
    SQL> /
    NEXTVAL
    10001
    SQL> /
    NEXTVAL
    10002
    SQL> /
    NEXTVAL
    10003
    SQL> /
    NEXTVAL
    10004
    SQL> select increment_by, cache_size, last_number from user_sequences where sequence_name = 'MYSEQ';
    INCREMENT_BY CACHE_SIZE LAST_NUMBER
    1 5 10005
    SQL> select myseq.nextval from dual;
    NEXTVAL
    10005
    SQL> select increment_by, cache_size, last_number from user_sequences where sequence_name = 'MYSEQ';
    INCREMENT_BY CACHE_SIZE LAST_NUMBER
    1 5 10010
    SQL>
    Asif Momen
    http://momendba.blogspot.com

  • Sequences used within Oracle TExt

    Are there any sequences that are used by Oracle Text which might benefit from increasing the cache_size?
    Regards

    Hi,
    IDGEN1$ is not only used for indexing, but for more general cases in Oracle. There is bug 7694580, which is solved in 11.2. Simply stated, if the sequence cache size is 20, then you may increase the value to 1000. This is not only applicable for RAC, but for all large systems. So indeed it is allowed to increase the value (as user SYS):
    alter sequence sys.IDGEN1$ cache 1000;Herald ten Dam
    http://htendam.wordpress.com

  • Sequence generation in Oracle RAC env. (Cached, non-ordered)

    Env: Oracle Env. 11G, Transaction Java Application
    How does CACHED, non-ordered sequence behave (for PK generation), here is the scenario,
    Cache size =10
    Node 1 Active - Records created 1,2,3 (3 records total in table)
    Node Changes - 2 is Active - Records created 11,12,13, 14 (7 records total in table)
    Node Changes - 1 is Active - Records created 21, 22 (or are sequences going to be 4, 5) (9 records total in table)
    Node Changes - 2 is Active - No new record added (9 records total in table)
    Node Changes - 1 is Active - 2 more Records created (9 recor11s total in table) - Is it going to be 23, 24 OR or is it going to be 6,7 OR or is it going to be 31, 32 (9 records total in table)
    Please help with accurate generated seq numbers (PKs) for 9 records.
    Also, What happens to PK numbers at:
    * shutdown
    * hotbackup
    * mirroring whole schema or database to another separate db using storage mirroring
    * mirroring whole schema or database to another separate db using datapump
    How about using cached, ordered sequences to start with and change to no-order if needed for performance reasons
    -D

    A necessary problem solving skill in the Oracle environment is the ability to experiment. A couple of minutes constructing a simple test is better than hours of speculation:
    jw1> create sequence s1;
    Sequence created.
    jw1> select s1.nextval from dual;
      NEXTVAL
            1
    jw1> /
      NEXTVAL
            2
    jw1> conn sys/oracle@jw2 as sysdba
    Connected.
    jw2> select s1.nextval from dual;
      NEXTVAL
            21
    jw2> select s1.nextval from dual;
      NEXTVAL
            22
    jw2> conn sys/oracle@jw1 as sysdba
    Connected.
    jw1> select s1.nextval from dual;
      NEXTVAL
            3
    jw1> select s1.nextval from dual;
      NEXTVAL
            4
    jw1> exit
    Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
    Advanced Analytics and Real Application Testing options
    [oracle@berlin1 ~]$ srvctl start instance -db jw -instance jw1 -startoption force
    [oracle@berlin1 ~]$ sqlplus sys/oracle@jw1 as sysdba
    SQL*Plus: Release 12.1.0.1.0 Production on Sat Aug 16 10:40:40 2014
    Copyright (c) 1982, 2013, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
    Advanced Analytics and Real Application Testing options
    jw1> select s1.nextval from dual;

  • Help! how to use sequence in in Oracle

    i have a table name account
    and i want the id column used the sequence XJ.ID
    so how to modfiy the .jdo file?
    here is the .jdo file
    <?xml version="1.0" encoding="UTF-8"?>
    <jdo>
    <package name="test">
    <class name="Account" objectid-class="AccountId">
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="table" value="XJ.ACCOUNT"/>
    <field name="accountDetails">
    <collection element-type="AccountDetail"/>
    <extension vendor-name="kodo" key="inverse"
    value="account"/>
    <extension vendor-name="kodo" key="inverse-owner"
    value="account"/>
    </field>
    <field name="accountNo">
    <extension vendor-name="kodo" key="data-column"
    value="ACCOUNT_NO"/>
    </field>
    <field name="balance">
    <extension vendor-name="kodo" key="data-column"
    value="BALANCE"/>
    </field>
    <field name="createDate">
    <extension vendor-name="kodo" key="data-column"
    value="CREATE_DATE"/>
    </field>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="ID"/>
    </field>
    <field name="modifyDate">
    <extension vendor-name="kodo" key="data-column"
    value="MODIFY_DATE"/>
    </field>
    <field name="name">
    <extension vendor-name="kodo" key="data-column"
    value="NAME"/>
    </field>
    </class>
    thanks.

    With Kodo 2.5, you cannot use a database sequence when using application
    identity.
    Instead, you should use datastore identity, and use the
    sequence-factory-class metadata extension or the
    com.solarmetric.kodo.impl.jdbc.SequenceFactoryClass configuration property.
    See the following URLs for details:
    http://docs.solarmetric.com/ref_guide_meta_class.html#meta-class-sequence
    http://docs.solarmetric.com/ref_guide_conf_kodo.html#com.solarmetric.kodo.impl.jdbc.SequenceFactoryClass
    -Patrick
    jian xu wrote:
    i have a table name account
    and i want the id column used the sequence XJ.ID
    so how to modfiy the .jdo file?
    here is the .jdo file
    <?xml version="1.0" encoding="UTF-8"?>
    <jdo>
    <package name="test">
    <class name="Account" objectid-class="AccountId">
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="table" value="XJ.ACCOUNT"/>
    <field name="accountDetails">
    <collection element-type="AccountDetail"/>
    <extension vendor-name="kodo" key="inverse"
    value="account"/>
    <extension vendor-name="kodo" key="inverse-owner"
    value="account"/>
    </field>
    <field name="accountNo">
    <extension vendor-name="kodo" key="data-column"
    value="ACCOUNT_NO"/>
    </field>
    <field name="balance">
    <extension vendor-name="kodo" key="data-column"
    value="BALANCE"/>
    </field>
    <field name="createDate">
    <extension vendor-name="kodo" key="data-column"
    value="CREATE_DATE"/>
    </field>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="ID"/>
    </field>
    <field name="modifyDate">
    <extension vendor-name="kodo" key="data-column"
    value="MODIFY_DATE"/>
    </field>
    <field name="name">
    <extension vendor-name="kodo" key="data-column"
    value="NAME"/>
    </field>
    </class>
    thanks.

  • XP Issue w/Sequence of Loading Oracle 8i SQL & 6i Forms

    I am in the 8i Application Developer Cert Track working on MS Windows XP.
    Our class was provided with Oracle 8i Personal Edition (for SQL) as the first product to load for Intro to PL/SQL (class I) and PL/SQL Blocks (class II).
    That product is loaded and is working fine.
    I am now in the Internet Forms I Class and have been given Oracle 6i - Forms & Reports to load.
    I am told the order of installation is a problem IF Forms is not loaded BEFORE Oracle 8i.
    I am getting the following error when the XP machine attempts to read the CD-ROM with Oracle 6i Forms and Reports: orainst.exe encountered a problem and needs to close.
    Is there a specific version of 6i Forms for XP? Where can I locate and download this version?
    I am looking for instructions on how to resolve the issues related to the order of installation since 8i is already loaded and attempting to remove this product does not remove it completely.......AND the 6i Forms CD will not even run on XP.
    ANY direction would be appreciated.
    THANKS!

    I got exactly same problem when installing Oracle 6i on P4 Windows XP and Orcle 8i. If you have a solution, please help me.
    Thanks,
    Linh
    [email protected]

Maybe you are looking for