• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 514
  • Last Modified:

oracle 11g

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?
0
GouthamAnand
Asked:
GouthamAnand
2 Solutions
 
HuaMinChenSystem managerCommented:
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.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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.
0
 
GouthamAnandAuthor Commented:
Thank you.
0
 
manny17Commented:
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.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now