Solved

lock wait on sequence

Posted on 2001-09-11
3
1,779 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

739 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