How to get a level lock share line

Is it possible to acquire a lock for sharing at the level of the lines, that would make all of the following conditions?
1 prevent other update of this line.
2. allow others to read this line.
3. to allow others to update the other rows in the same table.


I have the following scenario, where both transactions need eachother lockout:

Implementation:
Insert into TABLE_A (value_a) values ('ok');
Insert into TABLE_B (value_b) values ('ok');

Transaction r:
Select value_b from TABLE_B
If value_b = "ok", TABLE_A update set value_a = "not ok".

Transaction B:
Select value_a in the TABLE_A
If value_a = "ok", TABLE_B update set value_b = "not ok".

If transaction A runs first and then the final result is not 'ok' in the TABLE_A.
If transaction B runs first and then the final result is not 'ok' only to TABLE_B.
If both operations are running at the same time, it is possible to get the "not ok" in both tables. That's what I would like to prevent.


A way to get what I want is to use "select for update":

Transaction r:
Select value_a in the TABLE_A for update
Select value_b from TABLE_B for update
If value_b = "ok", TABLE_A update set value_a = "not ok".

Transaction B:
Select value_a in the TABLE_A for update
Select value_b from TABLE_B for update
If value_b = "ok", TABLE_B update set value_a = "not ok".

In this way that the two transactions will not perform their update unless they know the result if their selection will always be the same after that they commit. However, using "select for update" Transaction A has acquired an exclusive lock on the line TABLE_B. If a Transaction of C with the same content that the Transaction occurs simultaneously, then the two will be block eachother, even if both want is to read data from the same table.

Another way is to use "lock table', however using it would block not only written on a specific, but written line in all the rows in the table. (In my example, there is only one line, but of course, this is just a simplified example).

I looked at the "serializable" isolation level, but this doesn't seem to help because the queries and updates involve more than one table.


I know that "readings do not block writes" is a fundamental part of the design of Oracle that makes Oracle what it is, but is it possible that I can do it explicitly will pass anyway? Or can you see another solution to what I want to achieve?

Oracle does not have level shared row locks. The single line level lock oracle knows / uses is exclusive.
The fact for example postgres (the syntax is... FOR ACTION) and the idea is exactly as above: you want to make sure that no other changes/deletions row but more than one transaction can contain this "guarantee" at the same time.

Tags: Database

Similar Questions

  • How to get to level 2 in apple support

    How to get to level 2 in apple support

    < re-titled by host >

    You mean on this forum?

    Answer the questions and eventually you're going to collect enough points to become level 2.

    https://discussions.Apple.com/docs/doc-9251

    He explains

  • How to get rid of the reference lines on the front panel

    I forgot how I created a couple of horizontal and vertical lines on the front panel. It seems that the original on the front lines. When I move my program to another monitor with a different resolution, the layout is messed up because of the reference lines cannot change the resolution. Everybody respected this before? How to get rid of them?

    Attached are the 2 creen shot of facades.

    Thanks in advance.

    Ah, I figured out. I accidentally selected the "scale with objects pane" from the context menu of a button in the tab. This is whence the reference lines.

    Thanks for all your guys help and advice.

  • How to get multiple databases to share binaries

    I need to simulate an already existing environment in which several databases are located on a single server. Each database share a single installation of the oracle binaries. My understanding is that this configuration is valid. All databases are 10.2.0.1 on Windows XP.

    The way I'm trying to do is through the GUI installer. Installation of the first database works very well. However the second database, when he asks me to specify the Oracle Home path I give him the base directory of the first installation but it tells me
    Checking Oracle Home incompatibilities...

    Full version. The result of this review is: failure of < < < <
    Problem: Oracle Database 10 g Release 2 can be installed in a new Oracle home
    Recommendation: Choose a new Oracle home for the installation of this product.
    Am I going about this wrong? I don't see another way to get to the databases share the same facility.

    You seem to be run the installer a second time. You don't need to do.

    What you need to run is the 'dbca' database - creation wizard which will guide you through the process of creating a database.

    Note: The first time you run the installation program ('runInstaller'), after completing the installation of the software, it automatically calls the "seamless" Database Wizard (except if you have selected the option do not create a database when you started the installation program).

    Hemant K Collette
    http://hemantoracledba.blogspot.com

  • level locking monitoring line

    I use oracle11g. In my application, for a specific table, specific record is getting locked by multiple users simultaneously and is application
    causing the power outage. I need to write a script to montior the locking level line on specific record and each time, we see more than 10 locks on the specific folder, I need to immediately alert.

    My question is, how do you write a script to re-captured where we have more than 10 users at the same time blocking the specific line?

    Any help is appreciated.

    The SQL statement provided by sb92075 seems to have its origin in the book of the Oracle the Oracle documentation library database performance tuning.

    Here is a recent article that compares the impact on a database instance when three different methods are used to check the place - the method advocated by the book of the Oracle database performance tuning seems to be most intensive method of resources:
    http://hoopercharles.WordPress.com/2011/03/30/investigating-enqueues-Burns-CPU-cycles/

    The link above includes a sample of VBS script (Windows) that runs the SQL statement audit queue 1000 times spaced 0.2 seconds between runs.

    I think what sb92075 meant, is that only 1 session is able to correctly lock line one table at a time, but you could have several sessions tent to lock the same line. When you determine that if you have 10 sessions, you must find 10 sessions with the same values TYPE ID1 and ID2 in V$ LOCK with 9 or more with a REQUEST value greater than 0. I'm just curious, demand all bitmap indexes?

    Charles Hooper
    Co-author of "Expert Oracle practices: Oracle Database Administration of the Oak Table.
    http://hoopercharles.WordPress.com/
    IT Manager/Oracle DBA
    K & M-making Machine, Inc.

  • How doi get back my locked icon saying when the pc is idle

    How can I get my icon saying locked when pc slowed down? He lost

    The settings I gave you will achieve what you want.  When the PC is idle for the period indicated in the screen saver, the PC crashes and when you move the mouse or press a key to try to resume will show your user icon and you won't not resume until you have clicked on the icon.

    You can configure the PC to sleep instead of indulging in idle screen.  If this is what you want then substitute another step 1: -.

    1 the active {power plan} change plan settings, power, options change plan settings advanced, sleep, sleep after - choose a delay for battery & current alternative.

    You must then set the part of connection of this parameter in both

    2 power options, [on the left side of the window] require a password on wake up

    3 power options, plan {power} active settings change, change of plan avancΘs, [you will have to click on "view the currently hidden settings] {active power plan}, require a password on wake up.

  • How to get rownum of the last line in a table?

    Hello

    I need to add a line slot-shaped table with the dynamic value.

    I add a line slot-shaped table with existing lines so I need to get a rownum of the last row of tabular presentation.

    I'm using a process like this:

    Declare

    l_value varchar2 (200);

    number of rownum_value;

    Begin

    l_value: = wwv_flow.g_x01;

    rownum_value : = wwv_flow.g_x02;

    HTP.p ("< class td =" child"> ');

    HTP.p (APEX_ITEM. DISPLAY_AND_SAVE (p_idx = > 3,

    p_value = > l_value,

    p_item_id = > 'f03_000 ' | ROWNUM_VALUE - here is Rownum value

    ));

    HTP.p ("< table > '");

    HTP.p ("< class td =" child"> ');

    HTP.p (to_date (sysdate));

    HTP.p ("< table > '");

    HTP.p ("< class td =" child"> ');

    HTP.p (APEX_ITEM. CHECKBOX2 (p_idx = > 5, p_value = > 'Y', p_item_id = > 'f05_000' |) ROWNUM_VALUE -here is Rownum value

                             ));

    HTP.p ("< table > '");

    And I use the dynamic action with Ajax to pass values to the process:

    (function () {}

    get var = new htmldb_Get (null, $v ('pFlowId'), 'APPLICATION_PROCESS is ADD_VALUE', $v ('pFlowStepId'));

    get.addParam ('x 01', $v ('P2_VALUE'));

    get.addParam ('x 02',SOME_ROWNUM_VALUE);  Here, I need to get the value of Rownum

    gReturn = get.get ();

    get = null;

    gReturn = (! gReturn)? ' null': gReturn;

    var table1 = document.getElementById ('tabform_TABLE');

    Table2 = table1.getElementsByClassName ("uReport") var [0];

    TBODY var = table2.tBodies [0];

    var row = document.createElement ("TR");

    row.innerHTML = gReturn;

    tbody.appendChild (row);

    })();

    How can I get a value of rownum in the last row of my tabular form?

    I prefer to use JavaScript, but any other solution would be much appreciated.

    I'm on Apex 4.2

    Thanks to you all.

    There are a few options

    Base Oracle: Number count of rows returned in the report of the APEX

    for example:

    $('#report_emp td[headers="ENAME"]').length

  • How to get rid of a black line

    Hi I'm new to illustrator and have done half of my work a color using the rectangle tool. I now have a black line on the edge of this color. First what I did wrong to find it and second how do I get rid of him?

    Thank you, Catherine

    Select the rectangle and check if you have a line on that? That means a white file with us back race.

    Ant you to click on the line to put this in the update (above), then click the anti icon to remove the feature of ra result like this.

    If you need more information, we will need a screenshot because there are not enough details to help you either.

  • How to get a list following a line curve

    Hi all

    My apologies if this is a) very simple and b) has been asked before. It is not an easy thing to describe in a few words and research keep setting up information on how to turn around a circle of text!

    What I have to do is make a list bulleted items to follow a vertical and shallow S-shaped curve - IE so that the first letter of each line is in contact with the right side of the S. Who is? I hope it is very easy to do, but I can't work out how.

    I am in the age of darkness - using Photoshop CS5, but also have Illustrator, if it would be better for the task?

    Pointers would be much appreciated, thank you.

    Ann

    This will give a big boost in the right direction...

    1. Choose the custom shape tool (it looks like a starfish).
    2. Choose the path from the drop-down list on the left side of the Options bar.
    3. Open the menu form in the middle right side of the Options bar.
    4. Click on the little gear on the top right and click on the banner and awards, then Add.
    5. Draw the s shape on the page.
    6. Select the Direct Selection tool.
    7. Click outside the shape to deselect.
    8. Gently pull each 6 anchor point until you get your S-shaped. In the photo below, start by dragging the right anchor to the right. Deselection from the previous step is important... the other five anchor points should be hollow so that they don't move until you drag the.
  • How to get the status of VO line lines

    Hello

    I have a table area and there are many records to retrieve an entity based in VO. Now, I've updated a line or lines, I need to display the changed records once on the next page. How can I view? I want to capture status line this kind of thing while pressing save button.

    Thank you.

    Problem solved by creating a new field (IS_SUBMITTED) in the database table to report the registration State with the default value in the form N (updated all existing records if there are in the table);

    Step 1: Access the properties on your EO and navigate to Java and verify the Data Manipulation

    Step 2: Go to your class EOImpl and research of method doDML

    Step 3: Under the doDML method below adds the code to set the value of the attribute EO;

    If (getIsSubmitted () .equals ("N")) {}

    setIsSubmitted ("M"); where as a M stands for updating the

    }

    Step 4: In your controller @ PFR class, write the code for the loop and game of the State of the attribute as below;

    OAApplicationModule am = pageContext.getApplicationModule (webBean);

    If (pageContext.getParameter ("SubmitButton")! = null) {}

    am.invokeMethod ("apply");   Save the records so the EOImpl will set the is_submitted to am "everywhere where the record changed state"

    OAViewObject EmpPhoneVO = (OAViewObject) am.findViewObject ("xxPerPhonesVO1");

    int empPhoneRowCnt = EmpPhoneVO.getRowCount ();

    EmpPhoneVO.first ();

    for (int i = 1; i)<=empPhoneRowCnt;>

    OARow empPhoneRow = (OARow) EmpPhoneVO.getCurrentRow ();

    String lPhoneValidated = "Y";

    your validation, if applicable

    If (lPhoneValidated.equals("Y")) {}

    System.out.println ("IsSubimtted after getting:" + empPhoneRow.getAttribute ("IsSubmitted"));

    If (empPhoneRow.getAttribute("IsSubmitted").equals ("M")) {}

    empPhoneRow.setAttribute ("IsSubmitted", "S");

    }

    System.out.println ("IsSubimtted after the value:" + empPhoneRow.getAttribute ("IsSubmitted"));

    SubmitMessage OAException = new OAException ("coordinates of the employee: rank #" + i + ": submitted for approval to the agent relationship.",)

    OAException.CONFIRMATION);

    pageContext.putDialogMessage (submitMessage);

    }

    EmpPhoneVO.next ();

    }

    }

    Kind regards

    Adnan...

  • How to get ChildVO Manager disclosure of line

    Hello

    I'm working on Jdev 11.1.1.6.0

    I have a tree like

    VO PARENT
    |
    |
    | ___CHILD1 VO
    |
    |
    | ___CHILD2 VO

    There is a common attribute of the VO in ALL the three your.

    On the execution of the rowdisclosureevent of this tree, I'm binding tree-> view iterator corresponding handle-> assigning to the attribute.
    But this way, I always put on VO PARENT attribute (such as this is the iterator of VO in the binding of the tree).
    How to set this value in CHILD1 and CHILD2 VO?

    Today, there are only two of your CHILDREN, but they can stretch leading to more children and grandchildren, so I can't hard code and get handles.

    I want to set the attribute only on this VO which actually rowdisclosure event got fired.

    Pointers were highly appreciated.


    Thank you!!!

    Hello

    You must get the key of the selected row of the tree (RichTree) instance. You go to the link layer to catch a hold on the binding of the tree (instance of JUCtrlHierBinding). This binding tree exposes a method that tales, a line as an argument key (the rowkey you get the key for the selected component of the tree line). The returned object is JUCtrlHierNodeBinding, which has a getRow() method that returns an instance of oracle.jbo.Row, which is what you ant to access

    Frank

  • How to get the total number of lines workbook Table Page-Details

    Hi all

    I built a workbook Page-detail Table. In addition, my section of the page is 'user of assets '. Then, when I click the users button, it shows me, credit notes different from the user that I was selected. The problem is that I want to show a percentage by user.

    For example:
    -------------------

    The query returns me assets 40 for all users.

    But for example I click the first user who has only 10 credit notes.

    I want to show at the end of the page: "this user is:" 25% (because I calculate 10 * 100/40). "."

    How can I do this? Because I found that I can show the number of lines that are in the screen, but not the total of the lines referring to my request.

    I use Oracle Desktop, but I have no problem using Oracle Discoverer Plus.

    I really appreciate your help.

    Best regards!
    Mariano. -.

    You can do it directly in the front as you wish but you can manipulate the spreadsheet to do something like.
    By creating a calculation that will contain the data you need you can then present in the page point right next to the user name.
    If you change the user in the page element, it will present the % that you wanted.

    do that create a new calculation, called "is the percentage of this user:
    To_char (COUNT (credit memos) OVER (PARTITION BY User) * 100/COUNT(credit memos) OVER (), '990D99'). « % »

    Place the calculation in the page element.

    There is a small restriction since if you just change the user it will work fine, but if you pick the design value, then you will get a mess.

    Beside that, you can use the 'text area' of the discoverer and put for example here: (exactly the name of the calc) "& is the percentage of this user.

    Well, it's not perfect, but maybe it can be used...

  • How to get rid of the black lines on the printed and scanned documents

    When I print, copy or scan on my officeject 6500 wireless I get a black line to the bottom of the page.

    While I wait for your answer, I'll post the most likely cause:

    Lift off the cover.  Now lift the document feeder cover, it opens to the left. You will see the mech feeder, you want to raise that to the left as well, it will increase by 2 inches or more. See this article from underneather glass it? Clean it. Really good.

    Then see you the white piece of plastic above the glass, which clean really good too.

    If it is a perfectly vertical line, in that it's probably caused by some dirt here, what is happening is the seat of bulb scanner in one place, the paper is then slipped over in the same place. If there is a grain of dust, it covers the entire page, top down. You clean the white room because there might be dirt there, when the bulb shines through the paper, he thinks returned as a dark spot.

  • How to get rid of a rectangular line?

    usually my Eraser tool works fine, but when I try to erase a line of a rectangle, I did, it creates an outline in black instead of delete. I took a video of what happens:

    the rectangle is on top of the image, which is made up of regular lines. Although I do not think that the origin of the problem.

    Hello

    When you delete it by using the tool erases the outline or stroke gets distorted creating a black outline. Try to use the anchor or the direct Selection tool removal tool.

    You can even merge the triangle with the rectangle using the unit in the path finder. (window-> path finder) Shift ctrl + f9

    Thank you

    Digiscape Gallery

    www.digiscapegallery.com

  • How to get the average between the lines are null?

    I need to get the average between the 2 positive numbers.

    Then update the table with the average for the rows that have NULL value between 2 positive numbers.

    The average will come (78 + 89) / 2 = 83.5. Round up to 84.

    Then it will be:

    04/06/13 84

    05/06/13 84

    06/06/13 84

    Regarding the 13/06/09 and 10/06/13, these values will always be NULL.

    {code}

    create the dummy (date of tmestmp of the table

    (, maxtemp number (4,0));

    insert into dummy (tmestmp, maxtemp) values (to_date('20130601','YYYYMMDD'), 70);

    insert into dummy (tmestmp, maxtemp) values (to_date('20130602','YYYYMMDD'), 81);

    insert into dummy (tmestmp, maxtemp) values (to_date('20130603','YYYYMMDD'), 78);

    insert into dummy (tmestmp) values (to_date('20130604','YYYYMMDD'));

    insert into dummy (tmestmp) values (to_date('20130605','YYYYMMDD'));

    insert into dummy (tmestmp) values (to_date('20130606','YYYYMMDD'));

    insert into dummy (tmestmp, maxtemp) values (to_date('20130607','YYYYMMDD'), 89);

    insert into dummy (tmestmp, maxtemp) values (to_date('20130608','YYYYMMDD'), 91);

    insert into dummy (tmestmp) values (to_date('20130609','YYYYMMDD'));

    insert into dummy (tmestmp) values (to_date('20130610','YYYYMMDD'));

    {/ code}

    I need the output to look like this:

    Header 1 Header 2

    1 JUNE 13

    2 JUNE 13

    JUNE 3, 13

    JUNE 4, 13

    5 JUNE 13

    JUNE 6, 13

    JUNE 7, 13

    JUNE 8, 13

    JUNE 9, 13

    JUNE 10, 13

    70
    81
    78
    84
    84
    84
    89
    91

    null

    null

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - production

    PL/SQL Release 10.2.0.4.0 - Production

    "CORE 10.2.0.4.0 Production."

    AMT for 32-bit Windows: release 10.2.0.4.0 - Production

    NLSRTL Version 10.2.0.4.0 - Production

    Suggestions?

    TIA.

    Steve42

    Select tmestmp,

    NVL)

    maxtemp,

    round)

    (

    LAST_VALUE (maxtemp Ignore Nulls)

    (order tmestmp).

    FIRST_VALUE (maxtemp Ignore Nulls)

    (tmestmp order

    lines between the 1 suite and unlimited

    )

    ) / 2

    )

    ) maxtemp

    modeling

    /

    TMESTMP MAXTEMP
    ------------------- ----------
    01/06/2013 00:00:00 70
    02/06/2013 00:00:00 81
    03/06/2013 00:00:00 78
    04/06/2013 00:00:00 84
    05/06/2013 00:00:00 84
    06/06/2013 00:00:00 84
    07/06/2013 00:00:00 89
    08/06/2013 00:00:00 91

    TMESTMP MAXTEMP
    ------------------- ----------
    09/06/2013 00:00:00
    10/06/2013 00:00:00

    10 selected lines.

    SQL >

    SY.

Maybe you are looking for