Oracle Interview Forums
Welcome, Guest. Please login or register.
August 01, 2010
Home Help Search Login Register
News:


+  WebForums - OraclePassport
|-+  IT progamming - Oracle, Java, Unix, MySQL, Toad
| |-+  Oracle -Triggers, Exceptions, Procedures
| | |-+  SQL Performance Tuning Concepts
| | | |-+  What should be potential drawbacks of using Cache in oracle sequences?solution?
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Send this topic Print
Author Topic: What should be potential drawbacks of using Cache in oracle sequences?solution?  (Read 402 times)
ashishprak
Trainer
****

Appreciate? +7/-0
Offline Offline

Posts: 57


Welcome!

« on: March 17, 2010 »

What should be potential drawbacks of using Cache in Oracle sequence?
How to overcome same ?
Report to moderator   Logged

Regards,
Ashish
ashishprak
Trainer
****

Appreciate? +7/-0
Offline Offline

Posts: 57


Welcome!

« Reply #1 on: March 17, 2010 »

For basic concepts on Oracle Sequences please read :
http://www.oraclepassport.com/Sequence.html

An Oracle sequence is database objects which provides unique integer values.The Sequence cache size determines how many values Oracle preallocates in memory ie Shared Pool.By finding values in shared pool , Oracle returns the next value from memory by providing quicker access.

Some describe Oracle cache as :
Cache a sequence means hold just two values in memory, no matter the size of cache,
So when any session ask for new value the Oracle simple increase the memory count in one, until it reach the cache number.

Setting a cache size larger then 0 can result in the loss of sequence values if the system is shutdown abruptly. When the system fails, the values that were preserved in memory are lost to the sequence.

For example, assume a sequence has been created with a cache size of 100. The first time the sequence is used, Oracle caches values 1 - 100 in memory. Subsequently, Oracle sessions use the cached information and use values 1 - 45. At this point the Oracle shuts down abruptly. When the sequence is used after start up, Oracle caches values 101 - 200 in memory, resulting in values 46 - 100 being lost.

Sequence values that have been cached in the Shared Pool can be aged out of memory depending on the activity of the database. To avoid aging out a sequence, pin the sequence using the DMBS_SHARED_POOL.KEEP procedure.example :

exec sys.DBMS_SHARED_POOL.KEEP('SEQ_NAME', 'Q');

exec sys.DBMS_SHARED_POOL.KEEP('SEQ_NAME1', 'Q');




What should be optimum Cache value for SEQUENCES in oracle ?
If no cache is used , how does it will impact OLTP systems?



Regards,
Ashish
« Last Edit: March 17, 2010 by ashishprak » Report to moderator   Logged

Regards,
Ashish
Pages: [1] Go Up Send this topic Print 
« previous next »
 
Share this topic...
In a forum
(BBCode)
In a site/blog
(HTML)

Display Pagerank



Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 2.0 RC1.2 | SMF © 2006–2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.101 seconds with 18 queries.