Solved

oracle 11g

Posted on 2014-03-05
4
503 Views
Last Modified: 2014-04-02
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
Comment
Question by:GouthamAnand
4 Comments
 
LVL 10

Accepted Solution

by:
HuaMinChen earned 150 total points
ID: 39908597
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
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 100 total points
ID: 39908615
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
 

Author Closing Comment

by:GouthamAnand
ID: 39908660
Thank you.
0
 

Expert Comment

by:manny17
ID: 39973408
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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
join 2 views with 5 conditions 3 54
database upgrade 8 74
Deleting Rows from an Oracle Database - Performance 19 46
pl/sql - query very slow 26 60
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…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
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 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.

773 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