Sequence in RAC

Hi
I am new for RAC environment
My new database will create in RAC environment
In my database table,we are using sequence in many place
so what are the step i want to take when i create sequence
Please any one help me
Regards
Makesh

Hi,
Check this sample questions explanation on oracle site.
Sequences and Oracle RAC
The use of sequences in Oracle Real Application Clusters (Oracle RAC) is much the same as it is for single-instance Oracle databases, but there are certain Oracle RAC-specific issues. With two or more database instances, sequences may require coordination to guarantee that the sequence numbers are allocated in the correct order.
Which of the following are always true regarding the use of sequences in an Oracle 10g RAC database? (Pick two.)
A. It is not possible to use the CACHE option, because each database has a row cache.
B. Sequence numbers may be out of order if multiple instances run the application program that uses the sequence.
C. Sequences add no extra overhead to traffic over the interconnect.
D. Using the CACHE and NOORDER options together results in the best performance for a sequence.
The correct answers are B and D.
Answer B is correct because if the CACHE option is used without the ORDER option, each instance caches a separate range of numbers and sequence numbers may be assigned out of order by the different instances. Answer D is correct because the CACHE option causes each instance to cache its own range of numbers, thus reducing I/O to the Oracle Data Dictionary, and the NOORDER option eliminates message traffic over the interconnect to coordinate the sequential allocation of numbers across all instances of the database.
Answer A is incorrect because even though each instance has a row cache, it is still possible to use the CACHE option with sequences. In such a case, each instance may cache numbers for that sequence in its row cache. Answer C is incorrect because if the CACHE and ORDER options are used together, all instances must allocate numbers in order by coordinating the assignment of the next value, using messages over the interconnect, thereby increasing interconnect traffic in proportion to the frequency of new-number assignment.
Hope it explains

Similar Messages

  • Ordered Sequences in RAC

    We are currently in the process of migrating a single database to a RAC database under an aggressive time line. One of the issues we're currently facing is the use of sequences by our application. Various components of our app require ORDERED sequences (...terrible dependency, actually), and since these components can now connect to multiple instances with separate SGA's (with separately cached sequences), they produce bad results... fail!... "break"... Nothing new...
    Because of the aggressive time line, modifying each component in the application is not feasible.
    We've come up with a "temporary" solution:
    *1. Create a service called SEQSRV that is defined as having a preferred instance: INSTA and and available instance: INSTB with a TAF policy of BASIC.
    2. Create the necessary TNS entries for the service.
    3. Create a database link (SEQ).
    4. Create (recreate) the sequence(s) with appropriately tuned CACHE value NOORDERED (because they will be ORDERED by virtue of accessing only one instance).
    5. Create a synonym from the sequence(s) incorporating the database link
    sql> create synonym <synonym_name> for <sequence>@SEQ
    * - in case we have an issue with INSTA, requests will fail over to INSTB.
    I've tested this with a few options:
    a. CACHE=20, 5000, 1000000
    b. ORDERED, NORDERED
    c. from multiple concurrent clients.
    d. 'select sequence_synonym.nextval from dual' in a loop for iterations: 50, 5000, 2000000
    The test results showed solid performance for all runs, and the trace indicated a DSF locks were proportional to (CACHE/number of iterations). On higher iterations, there was a bit of recursive sql along with the usual TNS-related wait information, but nothing indicating poor performance.
    Can anyone comment on this? Is our logic flawed? Any suggestions? Anything?
    Jeffrey Frey
    Sr. Oracle DBA
    BondDesk Group Llc
    Edited by: jjfrey on Feb 11, 2009 12:17 PM

    Absolutely, the requirement "just" ordered... gaps are permitted between (for whatever reason), as long as the application's threads see chronologically incremented values.
    I'll be sure to test the TAF policies before implementing, when I test failover scenarios... thanks! great suggestion.
    So far, my most extreme test has been two simultaneous connections running 2,000,000 iterations of nextval ... results were comparable to a single without database links (with a few minor tweaks on CACHE value). Nothing in our application comes close to this kind of abuse; however, there are components that run 4 and 5 threads deep, but their requests for nextvals are typically more "serialized" and throttled by other factors (batch processing, AQ etc).
    As for busy database links, I have no issues increasing the number of sockets (distinct links) and grouping accordingly to avoid contention... will require some effort, but... effort is in the job description, right?
    Still think its feasible?
    Jeffrey

  • Startup and shutdown sequence in RAC on Linux

    I am trying to understand the start-up and shutdown sequence in 11g R2 RAC on Linux(OEL5.8).
    can you please share me docs or sequence.

    Hi Friend,
    Example : Two node RAC. RAC1 and RAC2 instances.
    Stopping RAC2 Instance :
    =========================
    1. Shutdown the Instance running on RAC2
    2. ./srvctl stop asm -n csbppmaadbs02
    3. ./srvctl stop nodeapps -n csbppmaadbs02
    4. ./srvctl stop listener -n csbppmaadbs02
    5. Check "./crs_stat -t"
    Note 1 : Check the following also for healthy status & If any service of RAC that also we have to check.
    6./crsctl check crs
    CSS appears healthy
    CRS appears healthy
    EVM appears healthy
    Starting RAC2 Instance
    =========================
    1 ./srvctl start nodeapps -n csbppmaadbs02
    2 ./crs_stat -t
    3 ./srvctl start listener -n csbppmaadbs02
    4 ./srvctl start asm -n csbppmaadbs02
    5. Start the Instance of RAC2
    6. ./crs_stat -t
    Hope it helps...
    Thanks
    LaserSoft

  • Log sequence in RAC database

    10.2 Doc. says: http://download.oracle.com/docs/cd/B19306_01/backup.102/b14194/rcmsynta008.htm#RCMRF106
    >
    Although the SEQUENCE parameter does not require that THREAD be specified, a given log sequence always implies a thread
    >
    Does this mean that the log sequence is unique for all threads ? If not what does this sentence mean ?
    Note that in my 10.2.0.1 RAC database log sequence is unique only for a given thread:
      1  select thread#, sequence#, name, status
      2  from v$archived_log
      3  where sequence# between 34 and 35
      4* order by sequence#
    SQL> /
       THREAD#  SEQUENCE# NAME                                                         S
             1         34                                                              D
             2         34 /u02/fra/RAC/archivelog/2010_08_20/o1_mf_2_34_66xb2ttb_.arc  A
             1         34 /u02/fra/RAC/archivelog/2010_08_20/o1_mf_1_34_66xcgmbn_.arc  A
             2         35 /u02/fra/RAC/archivelog/2010_08_20/o1_mf_2_35_66xb48b8_.arc  A
             1         35 /u02/fra/RAC/archivelog/2010_08_20/o1_mf_1_35_66xcgkk0_.arc  A
             1         35                                                              D
    6 rows selected.

    I sent mail to the writer and got this in reply:
    The sentence will be rewritten to state that: "When you do not explicitly specify a thread number with the sequence number in the command, thread number 1 is used."
    -----------------

  • Sequences under RAC

    Does anyone have any general/specific recommendations for the 9300 sequences in EBS under RAC?
    Jeff

    In RAC environments, it is always suggested to cache the sequence number to avoid the concurrent updates on the data dictionary because of sequence generator. If cluster databse is processing heavy workload then database sessions may have to wait on SQ enqueues if sequences are not cached. If you want ordered sequence number then you can use 'CACHE ORDER' of sequence. If there is no such requirement of ordered sequence number then 'CACHE NORDER' is the best trade.
    Thanks & Regards
    -Harish Kumar Kalra

  • Keep Sequences in Shared Pool for RAC Environment

    Hi,
           We have 2 node RAC setup for production environment. I want to pin cached sequences in my database. We are using following command for this purpose.
    EXEC DBMS_SHARED_POOL.KEEP('HR.MySeq','Q');
    Do I need to execute this command for each single node?

    Pinning is in the Shared Pool in the SGA.  So it is local to an instance.
    Therefore, you would need to execute it in each instance (i.e. on each node).
    Note :  However, with sequences in RAC, you have to be careful with the definition.  Have you defined it or do you need to define it as CACHE/NOCACHE ?  Have you defined it or do you need to define it as ORDER (to guarantee order generation in RAC) ?
    Hemant K Chitale

  • Sequence generation issue

    Hi , I am working in Healthcare industry . we have a claim and payment matching process . Every day 1.5 million payments get matched with 70 million claims and the matched payments are stores in some output table . After matching, an oracle seqence number is generated for each matched record and that is the primary key for the output table.
    Match query will be like this,.
    Select seqeunce1.nextval,a.column1,a.column2,b.coulmn1,b.column2 from claim_table a, payment_table b
    where a.column3=b.column3
    We are facing some seqence problem here. some sequence are missed during the first day and the missed sequnces are getting generated in the second day.
    Sequence Query:
    CREATE SEQUENCE ERA_CLAIM_MATCH_S
    START WITH 1
    MAXVALUE 999999999999999999999999999
    MINVALUE 1
    NOCYCLE
    CACHE 500
    NOORDER;
    Example to demonstrated the problem:
    Day 1(15th July) : sequence generated from 1 to 1000000 (some sequence are missed in between)
    Day2 (16th July) : sequence generated from 2500 to 2000000 (some missed sequence in day 1 are generated here)
    Our database in in RAC system.

    Hemant K Chitale wrote:
    I think that the question is : If the highest value generated on Day 1 was 1000000,  how could a value of 2500 be generated on Day 2 ?
    Shouldn't happen if the Sequence is a NOCYCLE.Hemant, but that is possible if Day 1's processing used the sequence on RAC instance 1 - whereas on Day 2, RAC instance 2 (with unused cached sequences from yesterday) is used.
    E.g.
    // on node 1
    SQL> create sequence testseq start with 1 increment by 1 nomaxvalue nocycle;
    Sequence created.
    SQL> select testseq.nextval, sys_context( 'user', 'instance_name' ) as instance from dual;
       NEXTVAL INSTANCE
             1 dev_1
    // on node 4
    SQL> select testseq.nextval, sys_context( 'user', 'instance_name' ) as instance from dual;
       NEXTVAL INSTANCE
            21 dev_4
    // on node 1, use the sequence a couple of times
    SQL> declare i integer; begin loop i := testseq.nextval(); exit when i > 100000; end loop; end;
      2  /
    PL/SQL procedure successfully completed.
    SQL> select testseq.nextval, sys_context( 'user', 'instance_name' ) as instance from dual;
       NEXTVAL INSTANCE
        100002 dev_1
    SQL>
    // on node 4, check the sequence
    SQL> select testseq.nextval, sys_context( 'user', 'instance_name' ) as instance from dual;
       NEXTVAL INSTANCE
            22 dev_4

  • Row cache wait in Oracle RAC

    Hi,
    Our application is running on Oracle RAC. During certain time of the day, the applcation responds very slowly. At these times, it is observed that the row cache waits are very high. We have even tried altering the sys.AUDSES$ sequence and changing it cache size to 10000 from default 20, but this did not help.
    Can anyone suggest a solution for this problem? And why this problem occurs?

    Hi,
    it looks like your problem is related to the fact that you do not cache sequences (this is a well know RAC tuning topic).
    Oracle introduced sequences (wrong name, definitely) to generate unique numbers, not to actually support a time sequence of events, or to preserve an order or to have ascending sequences of numbers with no gaps.
    Ordering a sequence of events is a serialization process that should not be implemented by a sequence.
    Now, if you do not cash sequences, in RAC the lock (enqueue) on the sequence (that is required when you ask for the next set of values) is a global resource on which inter instance contention occurs.
    Furthermore, in case the application has a high volume of inserts, having nocache sequences leads to inter instance index block contention.
    Oracle says that the default cache value of 20 for sequences is inappropriate in most case of RAC implementations and it is frequent to have caches of 1000 values or more. You need to test what is your ideal value.
    Now it is up to you to decide between:
    - keep things as they are and have a non scalable RAC installation
    - find a way to cache sequences without harming the application assumptions.
    Hope it helps,
    Regards,
    Corrado

  • GC current block busy

    Hi ,
    I have two node Oracle RAC.Version is 11.2.0.2
    When i do an online inquire transaction for higher load, I am observing 'gc current block busy' in AWR as one of the top events.GV$SESSION_WAIT
    doesnt show anything as below.
    Kindly let me know how to tune it.
    AWR top events.
    DB CPU   32   64.34  
    log file sync 5,972 9 2 18.36 Commit
    gc current block busy 2,448 7 23 13.32 Cluster
    gc current block 2-way 4,665 3 1 5.41 Cluster
    gc current grant busy 2,446 1 0 2.20 Cluster
    SQL> SELECT
      INST_ID,
      EVENT,
      P1 FILE_NUMBER,
      P2 BLOCK_NUMBER,
      WAIT_TIME
    FROM
      GV$SESSION_WAIT
    WHERE
      EVENT IN ('buffer busy global cr', 'global cache busy',
                'buffer busy global cache');
      2    3    4    5    6    7    8    9   10   11
    no rows selectedThanks

    user10698496 wrote:
    I have two node Oracle RAC.Version is 11.2.0.2
    When i do an online inquire transaction for higher lRoad, I am observing 'gc current block busy' in AWR as one of the top events.GV$SESSION_WAIT
    doesnt show anything as below.
    Kindly let me know how to tune it.(Note: Your query against v$session_Wait doesn't seem to match the events listed in the AWR.)
    (Note 2: Your snapshot seems to be for a very short time - which doesn't really give an idea of how serious the problem may be in the bigger picture.)
    There are many GC events that you won't see in v$session_wait because the session doesn't know the event consuming the time until after the wait has completed - so when you check v$session_wait you will often see "gc cr request", or "gc current request" (I think I may have the names wrong, but I don't have an instance in front of me right now) - these are known as "placeholders" to Oracle and may change to things like "gc current block 2-way" or "gc current block 3-way".
    You've looked at the ADDM (so you're licensed for the diagnostic), and seen the top object. Had you not done so I would have suggested looking at the "Segments by .." sections of the AWR report, checking the two sections on CR and CUR traffic; then check the "SQL ordered by ...." sections for the sections on global cache time. If your offenders are insert statements that match primary key indexes then you probably need to stop the instances from inserting into the same index leaf block at the same time.
    A key question to ask is whether the primary key is a meaningless value generated by an Oracle sequence; if so have you set the sequence cache size to a large enough value (in the order of thousands or tens of thousands). This is the first step in resolving sequence-based RAC issues. (There are other strategies - but we need more information to determine best action.)
    Regards
    Jonathan Lewis
    P.S. The best place on the Internet for information about details of how RAC works and the interpretation of RAC events is probably Riyaj Shamsudeen's blog at: http://orainternals.wordpress.com/
    Edited by: Jonathan Lewis on May 14, 2012 8:24 AM

  • Next log sequence to archive in Standby Database (RAC Dataguard Issue)

    Hi All,
    I just had implemented Data Guard in our server. My primary Database is RAC configured, but it is only single node. The other Instance was removed and converted it to Developement Instance. For the reason I kept the primary as RAC is when I will implement dataguard, my Primary Database is RAC with 7 nodes.
    The first test is successful, and I was able to "switchover" from my primary to standby. I failed in the 'FAILOVER" test.
    I restore my primary server and redo the setup.
    BTW, my standby DB is physical standby.
    When I try to switchover again and issue archive log list, below is my output.
    SQL> archive log list;
    Database log mode Archive Mode
    Automatic archival Enabled
    Archive destination USE_DB_RECOVERY_FILE_DEST
    Oldest online log sequence 38
    *Next log sequence to archive 0*
    Current log sequence 38
    SQL> select open_mode, database_role from v$database;
    OPEN_MODE DATABASE_ROLE
    MOUNTED PHYSICAL STANDBY
    ===============================================
    SQL> archive log list;
    Database log mode Archive Mode
    Automatic archival Enabled
    Archive destination USE_DB_RECOVERY_FILE_DEST
    Oldest online log sequence 38
    *Next log sequence to archive 38*
    Current log sequence 38
    SQL> select open_mode, database_role from v$database;
    OPEN_MODE DATABASE_ROLE
    READ WRITE PRIMARY
    In my first attempt to switchover before I failed in "FAILOVER" test, I also issue +archive log list+ in both primary and standby database, and if I remember it right, next log sequence on both should be identical. Am I right on this?
    Thanks in Advance.
    Jay A

    Or Am i just overthinking on this?
    Is dataguard only looking for the current and oldest log sequence?

  • Sequences in order - 10g r2 RAC

    Hello, we have a j2ee application against Oracle 10g r.2, which uses sequences (over ten approximately). These sequences are used to assign automatically value to the primary key of registers of several tables.
    In production environment, we have RAC with 4 instances. We would be interesting in maintaining the order of the values in this fields. We've defined these sequences as ORDER and CACHE=20, but after reading in forums and Oracle documentation, we've seen that the best practice is to define them (in RAC) as NO ORDER.
    My question is, could we have problems derived from this type of definition (ORDER - CACHE) ? Our main thought is that is very important that the primary key are not repeated, and also maintaining the order. On the other hand, could we have performance problems with this mechanism ?
    Thanks in advance.

    with the ORDER parameter, what I'm trying to obtain is that the number given by the sequence will be 1,2,3,4,5, ....49,50,51,52,... regardless of the instance that provides it.Why? The only requirement for a surrogate key is to be unique! Where in relational design is it recommended/suggested that surrogate keys be numbers in a gap free ascending sequence?
    This so-called "+requirement+" from developers for gap free surrogate key sequences are based on ignorance of relational design fundamentals.
    Also, you are not even considering the impact on the RDBMS for wanting it's sequences to behave this way.
    Think of a 100+ users, using a a 4 node RAC. All of them running typical OLTP apps that are inserted rows. All of which requires a sequence. For this to be ascending and gap free there can only be a single sequence generator on all 4 RAC nodes. As only a single generator can ensure gap free ascending numbers. This means that all 100+ users have to queue for access to this single generator to get a surrogate key value.
    What does this introduce? Serialisation. What not only kills performance, but utterly destroys it on a server platform? Serialisation.
    It is even worse on a RAC as instead of introducing serialisation on a single database instance, it will introduce serialisation on all cluster instances. Effectively rendering the whole RAC concept of scalability and performance totally useless.

  • How to pin sequences in the shared pool for RAC?

    We have a RAC environment with two instances. I want to pin some sequences in the shared pool to boost the performance. Do I need to pin them in both of the instances or just pin them in one instance?
    Thanks in advance

    If you cannot tolerate gaps, you must not use sequences. Period. A sequence-generated key will have gaps because transactions roll back, because databases get shut down, etc. If you want to ensure that there are no gaps, you have to write code that serializes access to a resource (i.e. a custom table of sequences) over the full length of a transaction. Of course, this is hugely inefficient and kills the application's scalability, but it does prevent gaps. Sequences are much faster and much more scalable, but they do not and can not guarantee that there are no gaps.
    Assuming the intention is to minimize gaps, rather than to eliminate them, NOCACHE & ORDER can help. That means, though, that you may need to communicate with the other nodes in the cluster every time you need a new value from the sequence, which is the slow part. Pinning the sequence is not going to be beneficial.
    Justin

  • Sequences in 10g R2 RAC

    We are planning to implement 10gR2 RAC in the next few months.
    We have 2 sites and we will be having 2 node cluster at each site and we will be using streams to replicate data across these two sites. This is 2 way/multiway streams replication.
    My developers are designing an application and they are planning to use a sequence number. But they are planning to use the sequence number(at the four nodes) such a way that sequnece at node1(site A) will start with 1 increment by 4, node 2( at site A) will start with 2 and increment by 4, node 3 (at Site B) will start with 3 and increment by 4 and node 4 (at Site B) will start with 4 and increment by 4.
    These sequences will be ordered and cached for better performance.
    We will be using streams replication across the sites/databases.
    Is this sequence mechanism good?
    We will be using differrent load balancing mechanisms and in this RAC enviroment.
    Please let me know if creating the sequences in this manner follow the best practices.
    Thank you.

    cache noorder is most scalable.
    In our environment , we have designed as
    RAC- A (2 node ): start the seuqnece with 1 and increment by 2
    (1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25 ......)
    RAC- B (2 node): start the sequence ith 2 and increment by 2
    (2, 4, 6, 8, 10, 12, 14, 16 , 18,...,.....)

  • RAC and Oracle Sequences

    We have a RAC running for two instances , we have noticed that one trigger on update which is using a sequences to get ids is not allocating such sequences
    on sequence as expected , is every instance of RAC caching a set of sequences and the other instance have no idea about this , is this a configuration which has
    to be done at RAC level

    sayantan chakraborty wrote:
    what is the difference between RAC and Oracle clusterware?RAC = Oracle Real Application Clusters
    http://www.oracle.com/technology/products/database/clusterware/clusterware_for_unbreakable_linux_faq.html#
    In the event of a system failure, clustering ensures high availability to users. Redundant hardware components, such as additional nodes, interconnect, and disks, allow the cluster to provide high availability. Such redundant hardware architectures avoid single points-of-failure and provide exceptional fault resilience.
    In Oracle Real Application Clusters (RAC) environments, Oracle Clusterware monitors and manages Real Application Cluster databases. When a node in the cluster is started, all instances, listeners and services are automatically started. If an instance fails, the clusterware will automatically restart the instance, so that the service is often restored before the administrator notices it was down. In this sense Oracle Clusterware is the basis for Oracle Real Application Clusters.
    In those environments RAC ensures the continuous operation of the database as well as its scalability by running more than one database instance simultaneously, typically one on every node in the cluster.
    You cna
    how to get RAC 10g?What did you mean?
    If you mean Software:
    http://www.oracle.com/technology/software/index.html
    Docs:
    http://www.oracle.com/technology/products/database/clustering/index.html
    http://www.oracle.com/pls/db102/portal.portal_db?selected=16
    Or Search on Google
    http://www.google.co.th/search?rlz=1C1GGLS_thTH327TH327&sourceid=chrome&ie=UTF-8&q=Oracle+Real+Application+Cluster
    Good Luck

  • Sequence error in 10g RAC

    hi,
    i am using sequence to autogenerate unique numbers in oracle 10g rac(three nodes).
    but the sequence numbers returned were not in order..This was creating a lot of confusion in oracle client.
    the cache of the sequence is 20;if I set the cache to 0 so that the sequence will be in correct order.
    if i must set cache to 20.how can i get the sequence number in order .
    thanks & regards.
    Zng

    Default CACHE value is 20, so 7859 + 20 = 7879.
    As Billy said above the sequnce quarantees by default the uniqueness of numbers, nothing more.
    Do you really care what in one node you will have 7859, 7860,...,7878 and
    7879,....7899 in another one ? Hardly it affects the logic of your application.
    If it does there is ORDER clause in CREATE SEQUENCE statement:
    http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_615a.htm#2067095
    Specify ORDER to guarantee that sequence numbers are generated in order of request. You may want to use this clause if you are using the sequence numbers as timestamps. Guaranteeing order is usually not important for sequences used to generate primary keys.
    ORDER is necessary only to guarantee ordered generation if you are using Oracle with Real Application Clusters. If you are using exclusive mode, sequence numbers are always generated in order.
    Rgds.

Maybe you are looking for