Reliable detect number of occurences (table lock needed or ?)

Hi all,
I got an issue with detecting duplicate messages. Database clients process files and messages and create a hash value that is passed on to the database. The database should return the number of occurences of this hash value in the last (e.g) 14 days.
create table HashHistory ( ID NUMBER,
MESSAGEHASH VARCHAR2 (20),
TS TIMESTAMP);
create sequence SomeSequence;
insert into HashHistory values (SomeSequence.nextval,'first hash', systimestamp);
insert into HashHistory values (SomeSequence.nextval,'second hash', systimestamp);
create or replace procedure DuplDetection  (p_HashIn varchar2,
                                     p_occurences OUT number) AS
l_timestamp timestamp default systimestamp;                          
begin
  -- possible exclusive table lock here... lock table HashHistory in exclusive mode;
  insert into HashHistory values (SomeSequence.nextval, p_HashIn, l_timestamp);
  select count (1)
  into p_occurences
  FROM HashHistory
  where MESSAGEHASH = p_HashIn
  and   TS < l_timestamp
  and   TS > l_timestamp-14;
  commit; --to release the table lock if applicable
end;When this procedure is called by two different machines at the same time with the same new hash value ('third hash'). One session should return 0 while the other should return 1 as number of occurences.... With default Oracle behaviour using row level locks, and executing them in parallel both sessions will not be able to see the others sessions hash values, and both will return 0 occurences. Is an exclusive table lock my only option to enforce this behaviour or can I trust Oracle to handle this correctly?
I expect 10^6 hashes each day and possible up to 10 or 20 clients running at the same time generating and checking these hash values. What are the changes of both sessions returning the same value without an exclusive table lock (as in this example)? What other parameters would you consider?
I am on Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

Nicosa wrote:
Hi,
Wouldn'that work if you do it as follows ?insert into HashHistory values (SomeSequence.nextval, p_hashIn,...);
commit;
select count (1)
into p_occurences
FROM HashHistory
where MESSAGEHASH = p_HashIn
and   TS > l_timestamp-14
and ID!=SomeSequence.currval;The second session should see that some others existing hash were inserted, and hence an be warned.No, it wouldn't work. Some kind of synchronization is required.
In multi-threaded environment you cannot predict the order of execution of this program.
Let say we have a server with only one processor and 3 users (sessions) connected to that server.
Three users (let say U1, U2 and U3) call this procedure to insert the same hash. The procedure has 3 operations: insert, commit, select,
and assume theoretically that these 3 operation are atomic (each takes only one processor cycle - in reality each of these operations can consume thousands of cycles).
Server can execute these calls in this order:
U1-insert (sequence + 1)
U1-commit
U1-select (returns 0)
U2-insert (sequence + 1)
U2-commit
U2-select (returns 1)
U3-insert (sequence + 1)
U3-commit
U3-select (returns 2)
- in this scenario results will be OK.
But the order might be:
U1-insert (sequence + 1)
U1-commit
- here server decides to switch to another process/thread
U2-insert (sequence + 1)
U2-commit
- server switches to proccess 3
U3-insert (sequence + 1)
U3-commit
- server switches back to U2
U2-Select (user 2 sees record commited by U1 and U3 and returns 2)
- server switches to U3
U3-Select (user 1 sees record commited by U1 and U2 and returns 2)
- server switches to U1
U1 - Select (this also returns 2)
- results are 2,2,2, but should be 0,1,2
If 20 users cal this procedure at the same moment with the same hash value, it is even possible that each user gets 19 as the final result,
but proper results should be 0, 1, 2, 3 .... 19 ;)
Without some kind of synchronization this a lottery.
There is also another trap with the sequence - consider this example:
Session 1
SQL> create sequence abc;
Sequence created.
SQL> select abc.nextval from dual connect by level <=5;
   NEXTVAL
      1
      2
      3
      4
      5
SQL> select abc.currval from dual;
   CURRVAL
      5Session 2
SQL> select abc.nextval from dual;
   NEXTVAL
      6
SQL> select abc.nextval from dual connect by level <=5;
   NEXTVAL
      7
      8
      9
     10
     11
SQL> select abc.currval from dual;
   CURRVAL
     11Back to session 1
SQL> select abc.currval from dual;
   CURRVAL
      5What happens in this scenario:
- user 1 does insert (select nextval from the sequence)
- user 2,3,4,5,6 ..... 100 call the procedure just 3 microseconds after U1 and do insert (increase the sequence)
- user 1 retrieve currval from the sequence ?

Similar Messages

  • Counting the number of occurences in a table column

    Hi All
    I have a table with a column that contains approx. 5000 6-digit codes. A number of these codes are duplicted in the column, and I want to count the number of occurences of each code. The column looks a bit like -
    WCID
    940042
    920012
    940652
    940199
    188949
    155146
    155196
    174196
    152148
    151281
    196209
    174015
    182163
    195465
    195318
    182008
    189589
    150675
    There can be mulitple instances of each WCID and I need to count the number of instances of each. I also have access to another table that also has a column of each WCID, but only once - ie no multiple instances. The second table is identical except that there are only single instances of each WCID.
    I thought I could either loop through on the table to be counted, from 100000 to 999999 and count each occurence that way, but it would be very inefficient. The other way I thought would be to perhaps select a WCID from the unique table, count the occurence of that, select the next WCID from the unique table, count that and so on, however I'm not sure how to do it in PL/SQL. Perhaps select the WCID from the unique table into a cursor, loop through that and compare it with the original table and count the instances?
    I hope this makes some sense, any help would be really appreciated
    Thanks
    Bill

    Hi, Bill,
    That sounds like a job for GROUP BY:
    SELECT    wcid
    ,         COUNT (*)       AS num_found
    FROM      table_x
    GROUP BY  wcid
    ORDER BY  wcid
    I hope that answers your question.
    If not, post CREATE TABLE and INSERT statements for a little sample data, and the results you want from that data.

  • Count the number of occurence in table with toplink

    Hi !
    there is no way to build a query with expressionbuilder or .... to count the number of occurences in my table ?
    i don't want use query " select count(*) from table "
    thanks

    Not sure of the question. Are you looking to get the sql "select count(*) from table" from using the TopLink expression framework or are you getting that SQL already and want something else?
    If you are looking just to get the count from a table/class, you can use a ReportQuery:
    ReportQuery rquery = new ReportQuery(ClassToQueryOn.class);
    rquery.addCount(); //equivalent to count(*);
    session.executeQuery(rquery);
    You can use a report query to return data instead of objects, and use selection criteria just like a normal read query.
    Best Regards,
    Chris

  • Sql query: number of occurence of cellData on more thann one column in tabl

    I have employee table contains following rows.
    INSERT INTO employee VALUES (105, 'Srinath','vijay','Aeronautics', 27, 33000);
    INSERT INTO employee VALUES (105, 'Kumble','Anil','Aeronautics', 27, 33000);
    INSERT INTO employee VALUES (105, 'Prabhakar','Manoj','Aeronautics', 27, 33000);
    INSERT INTO employee VALUES (105, 'Srinath','Jawagal','Aeronautics', 27, 33000);
    INSERT INTO employee VALUES (105, 'Jawagal','Srinath','Aeronautics', 27, 33000);
    INSERT INTO employee VALUES (105, 'Mishra','Anil','Aeronautics', 27, 33000);
    INSERT INTO employee VALUES (105, 'Kumble','Prabhakar','Aeronautics', 27, 33000);select distinct first_name firstName,count(1) over (partition by first_name) firstNameCount from employee;
    and i got the follwoing result.
    (Srinath 2,Kumble 2,Prabhakar 1,Jawagal 1,Mishra 1)
    Now i want to consider second and third column both and want to number of occurence of table data on these two columns
    (Srinath 3,Kumble 2,Prabhakar 2,Jawagal 2,Mishra 1,vijay 1,Anil 2,Manoj 1)As Srinath is coming 3 times, kumble 2 times, Prabhakar 2 times,Jawagal 2 times,Mishra 1 times,vijay 1 times,Anil 2 times and Manoj 1 times.
    What will be my sql query?

    Try this
    select name, count(name) over(partition by name) cnt
      from (select first_name from employee union all select last_name from employee)

  • I need to WAP to count the number of occurences of an alphabet in a string.

    I need to WAP to count the number of occurences of an alphabet in a string.I tried a lot and have surfed a lot regarding this problem.
    I m not the most proficient with java.but this is all i could come up with,and would appreciate some help here.I hope you guys would help me find a solution to this.
    e.g String : abcabrty
    Result should be
    a:2
    b:2
    c:1
    r:1
    t:1
    y:1
    public class chkoccurences
         public static void main(String args[ ])
              String user_Data=args[0];
              int counter=0;     
              try
                   for(int i=0;i<user_Data.length( );i++)
                        for(int j=0;j<user_Data.length( );j++)
                             if(user_Data.charAt(i) == user_Data.charAt(j))
                             counter++;
                        System.out.println(user_Data.charAt(i)+" exists "+counter+" time(s) in the word.");
                   System.out.println(" ");
              catch(ArrayIndexOutOfBoundsException e)
                   System.out.println("Check the array size.");
    }This is the output i get out of the program:
    a exists 2 time(s) in the word.
    b exists 4 time(s) in the word.
    c exists 5 time(s) in the word.
    a exists 7 time(s) in the word.
    b exists 9 time(s) in the word.
    r exists 10 time(s) in the word.
    t exists 11 time(s) in the word.
    y exists 12 time(s) in the word.What i think is i need an array to store the repeated characters because the repeated characters are getting counted again in the loop,if you know what i mean.
    Please, i would appreciate some help here.

    Criticism is welcomed
    public class tests {
         final int min = 10;
         final int max = 35;
         final char[] chars = new char[] {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
                   'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
                   'v', 'w', 'x', 'y', 'z'};
         public static void main(String[] args){
              tests t = new tests();
              String[] strings = new String[] {"aabcze", "att3%a", ""};
              for(String s : strings){
                   System.out.println(t.getAlphaCount(s));
         public String getAlphaCount(String s){
              int[] alphaCount = new int[26];
              int val;
              for(char c : s.toCharArray()){
                   val = Character.getNumericValue(c);
                   if( (val>=min) && (val<=max)){
                        alphaCount[val-min]++;
              StringBuilder result = new StringBuilder();
              for(int i=0; i<alphaCount.length; i++){
                   if(alphaCount[i] > 0){
                        result.append(chars[i] + ":" + alphaCount[i] + ", ");
              if(result.length() != 0){
                   result.delete(result.length()-2, result.length());
              return result.toString();
    }

  • NRIV Table Lock

    Hi,
    I need a help on how to get NRIV table lock released ?
    The users create Claims using portal as well R/3.
    While creating claim, a number will be generated.
    Problem is :
    When users create claim , one user gets system hang and other are not able to create claim.
    In DB01 we can see a lock on NRIV table HOLD status and DBTABLOG WAIT status.
    Once this lock is released, the users are able to create claim as usual.
    Program logic:
    Thre is a number range used for Claim number.
    This object is locked and unlocked by FM 'NUMBER_RANGE_ENQUEUE' and 'NUMBER_RANGE_DEQUEUE'.
    To generate number  : NUMBER_GET_NEXT is used.
    This object is not buffered.
    While Header table Enqueue ,  Lock mode is 'E'.
    Suggestion i gave  : To increase the buffer size. we can give No of number in buffer as 10 - 20.
    But if so, how will the GAPS in the number generated would be. So user is afraid on this gap.
    Please help me to get rid of this NRIV table lock.
    Regards,
    Priya

    Check
    the note 399207

  • How to find the number of occurence of a string

    String str="The AR tech seeks experienced candidates in java,jsp. The candidates should have atleast 1 year of experience in the specified skills.";
    here i need to find the number of occurence of the string "experience".
    how to find it out?

    String str="The AR tech seeks experienced candidates in java,jsp. The candidates should have atleast 1 year of experience in the specified skills.";
    String findStr = "experience";
    int count = 0;
    int index = 0;
    while(index != -1) {
    index = str.indexOf(findStr, (count == 0 ? 0 : index + findStr.length()));
    if(index != -1) {
    count++;

  • Randomly when I plug my Iphone 4s into Itunes it will tell me that it can't detect my phone and that I need to restore it. It doesn't happen every time, but maybe every two weeks.

    Randomly when I plug my Iphone 4s into Itunes it will tell me that it can't detect my phone and that I need to restore it. It doesn't happen every time, but maybe every two weeks.I restore it and then it works for a while, but then a couple weeks later I'll plug it in and I get the same message again. It's very frustrating because even though I have all the settings to save to cloud, my apps and data don't all come back.

    Thank you both. I suppose I should have prefaced my question with the concern that I've read a number of other posts from people who have had a similar issue and when they tried to follow the directions, they ran into a multitude of other problems. As you might imagine, I'm hoping to avoid the creation of new problems as I try to solve this one. Thanks again.

  • Serial number field and table

    Hi,
    I want Serial number field and table,
    Scenario like this,for returnable packging material we have assigned serial numbers,mtrl type is LEIH,so for tracking of RTP material now we are going to Develop one Report for this i need ur Help.
    Logic is:1)Matrl doc at the time of Delievery.
                Qty,Posting Date,Customer,Mvt type,Serial numbers for all.
                 Beacause at the time of Del we are mentioned all serial numbrs.
                2)Material Document at the time of GI.
                Same field as mentioned as above.
    After that,3)System is to Calculate How many Matrl are deliever to Custmer upto current  Period.Say  10.
    4)Calculte  How many Matrl are Recieved from the Custmer upto current  period.say 5
    5)Del - Issue=Total Number of Material is in Customer side.Say 5
    6)According to the Serial Number wise system has to calculate in which month delieverred matrl is in still customer side.
    (Ex PGI date 20.02.2007  3 qty
    Serial Number    1,2,3
    Issue date    20.03.2007   2 qty
    Serial Number    2,3
    Serial number  1 still is in Customer side.
    Age is 2 month)
    I am giving simple ex.
    so pls any body is having this idea pls Shared with me.
    Thanks
    Raghu

    Hi Raghu,
    Check table SER01(Document Header for Serial Numbers for Delivery).
    OBJK is the object table and you will have SERNR as serial number in this table.
    check table EQUI
                          EQUI -SERGE
                          EQUI-GERNR.
    EQUI-SERGE is Manufacturer serial number.chk if this is the one u r looking for.
    MARC-SERNP.
    key in plant and material in this table to fetch the Serial number profile of the material.
    Check in IKPF AND ISEG Tables... ( inventory )
    MSEG~EQUNR
    Hope it will hep u
    Regards
    Hareesha

  • Multiple parallel loads into one table with TABLE LOCK option

    Hi everyone:
    We have several SSIS packages where each package has the basic design of having one sequence container. Inside each sequence container can be anywhere from 2 - 9 data flow tasks where for each data is selected from a different table but all 2-9 tasks do
    an OLEDB fast load (with table lock option checked) into the same single destination table.
    The number of rows were pulling from the various sources might be anywhere from 5 up to 100,000.
    Right now this doesn't seem to be causing any issues, but I wanted to check to see if this set up (since we're doing a review) could potentially cause problems down the road?
    We seem to think that each parallel task will acquire its data as normal, and just won't be able to insert until one of the other parallel tasks completes its fast load. To us, that's no big deal as we're at least able to acquire the data in parallel.
    What are everyone's thoughts?
    Thanks!

    >>>We seem to think that each parallel task will acquire its data as normal, and just won't be able to insert
    until one >>>of the other parallel tasks completes its fast load. 
    That is correct observation.
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to find out the number of occurence of special character

    Hi ,
    I have a string coming coming in I/p which is like '1;2;100;201;'
    I need to break up this string and run my process for each value ( i.e for 1,2,100 and 201).
    How i can know the count of number of occurences of ';' character?
    How i can loop so that it runs once for each value?

    1. Split, pre Oracle 10g...
    ===========================
    with t as (select '10,aaaa,20,vvvvv,30,xxx''xx,12,12,56' txt from dual)
    select substr( txt
                 , decode(level, 1, 1, instr(txt, ',', 1, level-1)+1)
                 , decode(instr(txt, ',', 1, level), 0, length(txt), instr(txt, ',', 1, level)
                   - decode(level, 1, 0, instr(txt, ',', 1, level-1))-1)
                 ) val
    from t
    connect by level <= length(txt)-length(replace(txt,','))+1
    VAL
    10
    aaaa
    20
    vvvvv
    30
    xxx'xx
    12
    12
    56
    9 rows selected.2. Split, 10g onwards using regular expressions
    ===============================================
    with t as (select 'aaaa,,bbbb,cccc,dddd,eeee,ffff' as txt from dual)
    -- end of sample data
    select REGEXP_SUBSTR (txt, '[^,]+', 1, level)
    from t
    connect by level <= length(regexp_replace(txt,'[^,]*'))+1
    REGEXP_SUBSTR(TXT,'[^,]+',1,LE
    aaaa
    bbbb
    cccc
    dddd
    eeee
    ffff
    7 rows selected.example usage with varying IN clause...
    SQL> ed
    Wrote file afiedt.buf
      1  select *
      2  from emp
      3  where ename in (
      4    with t as (select '&input_string' as txt from dual)
      5    select REGEXP_SUBSTR (txt, '[^,]+', 1, level)
      6    from t
      7    connect by level <= length(regexp_replace(txt,'[^,]*'))+1
      8*   )
    SQL> /
    Enter value for input_string: SCOTT,JAMES
    old   4:   with t as (select '&input_string' as txt from dual)
    new   4:   with t as (select 'SCOTT,JAMES' as txt from dual)
         EMPNO ENAME      JOB              MGR HIREDATE                   SAL       COMM     DEPTNO
          7788 SCOTT      ANALYST         7566 19-04-1987 00:00:00       3000                    20
          7900 JAMES      CLERK           7698 03-12-1981 00:00:00        950                    30
    SQL>3. Split 10g onwards using XMLTABLE...
    ======================================
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 'This is some sample text that needs splitting into words' as txt from dual)
      2  select x.*
      3  from t
      4      ,xmltable('x/y'
      5                passing xmltype('<x><y>'||replace(t.txt,' ','</y><y>')||'</y></x>')
      6                columns word varchar2(20) path '.'
      7*              ) x
    SQL> /
    WORD
    This
    is
    some
    sample
    text
    that
    needs
    splitting
    into
    words
    10 rows selected.

  • How to display SC Number in approval table?

    Hi All,
    On the HOME page of EBP , click
    Approval
    , a table is displayed with three columns
    1)Description
    2)Created On
    3)Action
    We need to display the SC number in this table , prefreably by adding a new column and showing the Sc Numbers in that or at least add the SC Number in the description column.
    We found out that some modifications in the ITS Service BBPAPPROVAL , Template SAPLBW02  1200 required .
    Any information will be of great help.
    Thanks,
    Anubhav

    Hi Masa,
    Found the following data in txn SWI2_FREQ
    TS10407930     Read Lang.-Ind. Text for Approval Status
    TS14007989     Determine next Approver
    TS10407929     Send Mail to Persons Involved
    WS14900032     Sub-Workflow to Send Mail / SC loop
    TS14907939     Create object BUS4101
    TS10008126     Approval of shopping cart
    WS10000049     Event Handling in the Component
    WS14000133     Approval Shopping Cart n-Level (BADI)
    WS14000134     Subworkflow for N-Level Approval BADI
    WS10400051     Final Proc. After Approval Alternative 2
    TS10007991     Set SC status to 'Released'
    WS14900031     Sub-Workflow to Send Mail / SC
    WS10000060     Workflow Without Approval Shopping Cart
    TS10407972     Change Rejected Shopping Cart
    WS10400026     Sub-Workflow to Send Mail / SC
    WS10400010     Goods Receipt Workflow Without Approval
    WS10000129     One Step approval of shopping cart
    TS10407935     Set Status of Goods Receipt to Released
    TS10407971     Get Confirmation Rejection Description
    WS10000203     Wait for confirmation events
    WS10400003     Update confirmation upon approval/reject
    TS10107914     Present changes to requester
    TS00008267     Generic decision task
    WS30100051     Workflow system verification
    I Tried by selecting Standard Task and entering TS10008126 by it gives "Task does not exists" message.
    Thanks a lot,
    Anubhav

  • Identifying deadlocked resources in graph with 1 row lock and 1 table lock

    Hi, I have run into repeated occurrences of the deadlock graph at the bottom of this post and have a few questions about it:
    1. It appears that proc 44, session 548 is holding a row lock (X). Is the waiter, proc 30, session 542, trying to acquire a row lock (X) also or an exclusive table lock (X) on the table containing that row?
    2. Under what circumstances would something hold a row exclusive table lock (SX) and want to upgrade that to a share row exclusive table lock (SSX)?
    3. Our table cxml_foldercontent has a column 'structuredDataId' with a FK to cxml_structureddata.id and an ON DELETE SET NULL trigger. Would this help explain why an "update" to one table (i.e.g cxml_foldercontent) would also need to acquire a lock in a foreign table, cxml_structureddata?
    4. What is the difference between "Current SQL statement:" and "Current SQL statement for this session:"? That terminology is confusing. Is session 542 executing the "update" or the "delete"?
    5. In the "Rows waited on:" section is it saying that Session 542 is waiting on on obj - rowid = 0000BE63 - AAAL5jAAGAAA6tZAAK or that it is has the lock on that row and other things are waiting on it?
    A couple of notes:
    - the cxml_foldercontent.structuredDataId FK column has an index on it already
    Deadlock graph:
                           ---------Blocker(s)--------  ---------Waiter(s)---------
    Resource Name                    process session holds waits  process session holds waits
    TX-003a0011-000003d0        44       548     X               30        542             X
    TM-0000be63-00000000       30       542     SX              44        548     SX    SSX
    session 548: DID 0001-002C-000002D9     session 542: DID 0001-001E-00000050
    session 542: DID 0001-001E-00000050     session 548: DID 0001-002C-000002D9
    Rows waited on:
    Session 542: obj - rowid = 0000BE63 - AAAL5jAAGAAA6tZAAK
      (dictionary objn - 48739, file - 6, block - 240473, slot - 10)
    Session 548: no row
    Information on the OTHER waiting sessions:
    Session 542:
      pid=30 serial=63708 audsid=143708731 user: 41/CASCADE
      O/S info: user: cascade, term: unknown, ospid: 1234, machine:
                program: JDBC Thin Client
      application name: JDBC Thin Client, hash value=2546894660
      Current SQL Statement:
    update cascade.cxml_foldercontent set name=:1 , lockId=:2 , isCurrentVersion=:3 , versionDate=:4 , metadataId=:5 , permissionsId=:6 , workflowId=:7 , isWorkingCopy=:8 , parentFolderId=:9 , relativeOrder=:10 , cachePath=:11 , isRecycled=:12 , recycleRecordId=:13 , workflowComment=:14 , draftUserId=:15 , siteId=:16 , prevVersionId=:17 , nextVersionId=:18 , originalCopyId=:19 , workingCopyId=:20 , displayName=:21 , title=:22 , summary=:23 , teaser=:24 , keywords=:25 , description=:26 , author=:27 , startDate=:28 , endDate=:29 , reviewDate=:30 , metadataSetId=:31 , expirationNoticeSent=:32 , firstExpirationWarningSent=:33 , secondExpirationWarningSent=:34 , expirationFolderId=:35 , maintainAbsoluteLinks=:36 , xmlId=:37 , structuredDataDefinitionId=:38 , pageConfigurationSetId=:39 , pageDefaultConfigurationId=:40 , structuredDataId=:41 , pageStructuredDataVersion=:42 , shouldBeIndexed=:43 , shouldBePublished=:44 , lastDatePublished=:45 , lastPublishedBy=:46 , draftOriginalId=:47 , contentTypeId=:48  where id=:49
    End of information on OTHER waiting sessions.
    Current SQL statement for this session:
    delete from cascade.cxml_structureddata where id=:1

    Mohamed Houri wrote:
    What is important for a foreign key is to be indexed (of course if the parent table is deleted/merged/updated, or if a performance reason imposes it). Wether this index is unique or not doesn't matter (as far as i know).But, you should ask your self the following question : what is the meaning of having a 1 to 1 relationship between a parent and a child table ? if you succeed to create a unique index on your FK then this means that for each PK value corresponds at most one FK value!! Isn't it? is this what you want to have?Thanks, as I mentioned above, cxml_structureddata is actually the child table of cxml_foldercontent with 1 or more records' owningEntityId referring to rows in cxml_foldercontent. The reason for the FK on cxml_foldercontent.structuredDataId is a little ambiguous but it explained above.
    Will a TX-enqueue held on mode X always be waited on by another TX-enqueue row lock X? Or can it be waited on by an Exclusive (X) table lock?Not really clear. Sorry, are you saying my question is unclear or it's not clear why type of eXclusive lock session 542 is trying to acquire in the first line of the trace? Do you think that the exclusive lock being held by session 548 in the first line is on rows in cxml_foldercontent (due to the ON DELETE SET NULL on these child rows) or rows in the cxml_structureddata that it's actually deleting?
    Is there any way for me to tell for certain?
    The first enqueue is a TX (Transaction Enqueue) held by session 548 on mode X (exclusive). This session represents the blocking session. At the same time the locked row is waited on by the blocked session (542) and the wait is on mode X (exclusive). So put it simply, we have here session 542 waiting for session 548 to release it lock (may be by commiting/roll backing). At this step we are not in presence of a deadlock.
    The second line of the deadlock graph shows that session 542 is the blocking session and it is doing a TM enqueue (DML lock) held on SX(Shared eXclusive). While session 548(which is the waiting session) is blocked by session 542 and is waiting on SSX mode.
    Here we see that 548 is blocking session 542 via a TX enqueue and session 542 is blocking session 548 via a TM enqueue ---> That is the deadlock. Oracle will then immediately choose arbitrarlly a victim session (542 or 548) and kill its process letting the remaining session continuing its work.
    That is your situation explained here.Thanks, any idea why session 542 (the DELETE from cxml_structureddata) would be trying to upgrade it's lock to SSX? Is this lock mode required to update a child tables foreign key columns when using an ON DELETE SET NULL trigger? Having read more about SSX, I'm not sure I understand in what cases it's used. Is there a way for me to confirm with 100% certainty specifically which tables in the TM enqueue locks are being held on? Is session 548 definitely trying to acquire an SSX mode on my cxml_foldecontent table or could it be cxml_structureddata table?
    (a) Verify that all your FK are indexed (be carreful that the FK columns should be at the leading edge of the index)Thanks, we've done this already. When you say the "leading edge" you mean for a composite index? These indexes are all single column.
    (b) Verify the logic of the DML against cxml_foldercontentCan you be more specific? Any idea what I'm looking for?

  • Disk space transaction  and temp table lock  in oracle

    Hi,
    Today many sessions used to get disk space transaction lock and temp table lock and i am seeing these locks first time in my Production database,
    is there any workaround to avoid this contension.
    Thanks
    Prakash GR

    Post your version (all 3 decimal places).
    Post the SELECT statement and results that have led you to this conclusion.
    Other than the fact that you have seen a number what, precisely, is the issue.

  • Killing table locks

    Hi all,
    Good day..
    DB version is 10.2.0.4 I need to write a script which has to kill any table locks in the DB which is more than 10 minutes.
    thanks,
    baskar.l

    hi sb,
    DECLARE
    CURSOR c IS
    SELECT c.owner,
          c.object_name,
          c.object_type,
          b.SID,
          b.serial#,
          b.status,
          b.osuser,
          b.machine
    FROM v$locked_object a, v$session b, dba_objects c
    WHERE b.SID = a.session_id AND a.object_id = c.object_id
    and c.object_name in (MES.JSW_CRM_C_HR_COIL_INFO,MES.JSW_CRM_C_HR_COIL_INFO);
    c_row c%ROWTYPE;
    1_sql VARCHAR2(100);
    BEGIN
    OPEN C;
    LOOP
    FETCH c INTO c_row;
    EXIT WHEN c%NOTFOUND;
    l_sql := 'alter system kill session '''||c_row.sessionid||','||c_row.serialid||'''';
    EXECUTE IMMEDIATE l_sql;
    END LOOP;
    CLOSE c;
    END;But when executing it i get
    1_sql VARCHAR2(100);
    ERROR at line 15:
    ORA-06550: line 15, column 1:
    PLS-00103: Encountered the symbol "1" when expecting one of the following:
    begin function package pragma procedure subtype type use
    <an identifier> <a double-quoted delimited-identifier> form
    current cursorthanks,
    baskar.l

Maybe you are looking for

  • How to get javabean data in Servlets.( JavaBean -- Servlet(Controller)

    how to get javabean data in Servlets. 1) I am using name ,password in Jsp(View ) 2) when I submit this Bean will be called and Setter methods will be called . 3) In ServletController (controller) I want to get data of javabean. In this I have to do v

  • New harddrive on my macbook (late 2008)

    I just purchased a macbook in very good condition. It had a failed hard drive so I replaced it. I tried installing snow leopard 10.6.3 with no luck. This is my first apple computer so disregard any ignorance I sincerely need help. I've tried partitio

  • Problema Photoshop CC 2014 CameraRaw Nikon D4S

    Buongiorno, mi sono registrato ad Adobe, ed ho scaricato Photoshop CC 2014 in versione di prova, provo ad aprire i file fatti con la mia macchina fotografica ma esce un errore. Computer: Sistema operativo Windows 8.1Antivirus: Kaspersky Internet Secu

  • Sometimes a note will not let me edit it on my iPad or iPhone.

    Something is happening in the notes app. It's not happening just on the iPad, so it's not actually an iPad issue but an issue with the notes app. Out of nowhere, one of the notes will not be editable. As in, when I try to type in, it won't give me a

  • Error in units of measurement conversion  "BOM"

    hello gurus gudmorning everybody i have problem in  project regarding the units   of  measurement conversion BOM this is the scenario: 1000 ft2(  BASE UNIT MEASUREMENT)  = 1ea (    SALES UNIT) ( 2bed room flat) it is a higher level item sub items are