Solved

lock wait on sequence

Posted on 2001-09-11
3
1,735 Views
Last Modified: 2006-11-17
Oracle version 7.3.4
Sun Solaris 2.6 6 CPUs lots of memory
application type OLTP
concurent users: 400

One a day or more I get a lock wait on the following:
"select seq_name.nextval from dual;"

This happens when around 30 users are concurently requesting the seuence. The lock is for around 4 minutes.
There is also lots of buffer gets.

V$lock tables shows one row with blocking=1 but ID1 or ID2 are not to be found in OBJ$.

The sequence cash is 300.
Init.ora parameters:
sequence_cash_entries=3500
sequence_cash_hash_buckets=50

Has any one encountered this in the passed?
Any Id on a possible solution?

Thanks
Peled Alon
0
Comment
Question by:peledc
3 Comments
 
LVL 1

Accepted Solution

by:
balasubram earned 200 total points
ID: 6473841
hi,
I think u could try caching the sequence by specifying the cache key word while creating the sequence.
Cache is the number of sequence numbers u want to be cached.
Hope this helps
Bala
0
 
LVL 5

Expert Comment

by:FBIAGENT
ID: 6474910
PELEDC,

I don't think the lock wait is on "select seq_name.nextval from dual;"
You must be looking at the wrong place.  First of all, the statement is a SELECT statement; it only fetches the next sequence number; no lock is required.

It must have been some other SQL statement which utilizes the sequence.

I would search through the application for places (stored procedures/functions, PL/SQL blocks, etc.) which uses the sequence.

Good luck
0
 
LVL 3

Expert Comment

by:Wadhwa
ID: 6474981
I guess you are using seq_name.nextval with for update

for example
if session A issues command
select seq_name.nextval from dual for update;



session B
select seq_name.nextval from dual for update;

Session B will wait till the session A commits or rollback. Once session A issues commit or rollback session B gets the result.Session B is locked till then.

So do not use for update with the sequence at all. Otherwise you will face the same problem

Goodluck
Sam




0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question