oracle 11g

GouthamAnand
GouthamAnand used Ask the Experts™
on
Hi,

I would like to create a oracle sequence number as primary key in a log table.
Many applications are using this log table.
So if 2 or more applications try to update this table on "same time", then is different squence number ( seqname.nextval )   is allocated always for all the applications? or is there any chance that same sequence number allocated to 2 or more applicatinos which are trying to update same time?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Problem resolver
Commented:
There should be only one unique sequence number being allocated to each application, as there must be still one time gap like few milliseconds when 2 application are struggling with each other at the same time.
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009
Commented:
I concur. sequence object will not return "duplicates" during operations.
to ensure, you shall have a primary key constraint on the column, and handle the case if the duplicate key error would occur.
this would happen if the sequence object is "restarted", so a new start value is given to the sequence object.

Author

Commented:
Thank you.

Commented:
The sequence number is cached in the instance. There is no way that a same sequence number can be allocated to two different transactions. In a RAC system, the range of number cached is different on each of instance. This way oracle avoids such scenarios.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial