Solved

lock wait on sequence

Posted on 2001-09-11
3
1,639 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Remove Hyphens in Oracle SQL 5 45
Oracle SQL Syntax 8 58
compre toata in where clue oracle 4 44
File generation using utl_file 4 31
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…
Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to recover a database from a user managed backup

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now