Why DDL during SELECT is possible. Or why SELECT does not put a table lock?

This is a question to people who really knows Oracle internals or/and RDB theory.
(The question is relocated from another thread for not hijacking on that's original question.)
Why DDL during SELECT is possible? Or why SELECT does not put TM 2 Row Shared lock on table(s)?
This not locking causes a possibility while one session is running a long select, another can truncate and even drop table(s) that are being read by the first session.
I think, humbly assume, that Oracle does not put TM 2 lock on tables, that are being simply SELECTed, by some significant technical reason. But I do not know this reason. If somebody knows please shed a light.
Also, if you know that this behavior is totally correct from perspective of RDB theory, please explain me.
I'll try to explain my point.
It is a matter of data consistency and integrity that is supported in Oracle everywhere except this place.
a) If one session is reading data from moment T and other session changes data on its way at moment T1, the first session wont read that changed data, it will read the data that was there on moment T.
This is declared as Read Consistency principle.
b) If one session is changing data, and another session tries to truncate or drop table - the second session will fail with error ORA-00054: resource busy and acquire with NOWAIT specified.
This is declared as Data Integrity principle.
c) But why not to follow the above principles in case when one session reads data and another session tries to truncate or drop table (or do other DDL operations)?
It is counter-intuitive. Why not to put TM 2 (SS) lock during SELECT execution that would prevent DDLs on this table?
What I only can assume is that this is only because some technical difficulty or limitation.
What is this limitation or other reason in favor of which Oracle sacrificed consistency in this case?

user11181920 wrote:
Aman,
There was no need to clarify how DML lock works, I know that.
Also I know that in Oracle a Select does not lock neither table rows nor table itself.
The reason I mentioned it because you brought up the word change which is far better suited for DML's than DDL's as the former has a requirement to have its Undo preserved.
Again, my question was why Select does not protect itself by locking table(s), partitions and indexes?Protect from what? There is nothing wrong with doing a select. What would happen with a select doing a lock on the table before being executed in its entirety (forget DDL and DML altogether for a moment) ? State one good reason that there should be a lock for the select. If it has to, it would be always isn't it?
The keyword here is concurrency and that's what is the best when the number of locks obtained are lesser at non-required operations. A select doesn't change anything that's why in Oracle, there is no read-level lock.I am not saying about row locks while reading. They are not needed because Undo resolves concurrency.Only in the case of DML where the change is still active and the buffers are dirty. With a DDL, its an implicit commit.
I am asking why Select does not enqueue one, only one lock per object that participates in the Select?Again, my question back to you is, what good you would get from it? What purpose it would solve?
It is not very expensive, I suppose. But it would protect from DDLs that can destroy the Select's result set. You have seen in your system and in my demo(and that's what the the question was on the other thread also) that the result remains intact and its not a behavior from now. Its the same since the time I have started learning Oracle. Can you explain that why you think that the result of select statement would be wrong for a drop table? I believe, its been stated repeatedly that if the select has no requirement to look back the table, it would get completed. Only if the select needs to access the table again, it would fail. So even if we consider your explanation, there is no wrong result shown at all. Once the session encounters that the table is dropped for the statement, the execution stops right away. So where is the destroyed result?
Yes, it is less dangerous when Select does not lock table comparing with what would happen with DMLs in such case (that is why DMLs protect themselves by TM 3), it affects only the Select and its consumer, but still ... I don't understand this Oracle's decision. What is a reasoning behind it?.As I said, to improve concurrency.
Aman....

Similar Messages

  • I have F.F 3.6 and windows 7.: 1) When i want to buy a airplane ticket and want to select 2 adults or 2 children, the draw down select, does not work in any websides,? WHY?. 2) Have FF any problems with SKYPE

    I have F.F 3.6 and windows 7.: 1) When i want to buy a airplane ticket and want to select 2 adults or 2 children, the draw down select, does not work in any websides,? WHY?. 2) Have FF any problems with SKYPE
    == This happened ==
    Not sure how often
    == After innstalling windows 7

    As a suggestion I'd put the Text_io segments into their own begin - exception - end sub-blocks within the main code. This way if Text_io does raise an exception you can catch it earlier as it may be able to recover - That is if it is a text_io exception.
    Other than that you;ll have to step through in Debug.

  • Why condition does not work.

    Hi Pros,
            in my bex query, there is a CKF OT hours, having a value 30.000, when I set a condition for 'OT hours = 30.000', but get no result out. could you please tell why condition does not work.

    HI,
    please check the "Characteristic Assignment" Tab in change condition window.
    In that tab default  selection as "All Characteristic in the drill down independently" change that selection  as "Individual characteristic and Char. combinations"  and choose the particular characteristic. for ex OT hours against employee means select employee alone.
    Regards
    Sureshkumar C

  • Hi, I have downloaded itunes on windows 7,when I click on the itunes icon on my desktop nothing happens,it does not open itunes,can anyone help me with why it does not open or know how I can open itunes,thanks.

    Hi, I have downloaded itunes on windows 7,when I click the icon on my desktop nothing happens,does anyone know why itunes does not open?

    If you only changed the name of your ID rather than creating a new ID, just go to Settins>iCloud and tap Delete Account then sign back in with the new name.  (Deleting the account from your phone does not delete it from iCloud.  Your data will be synced back to your phone when you sign back in.)
    If you created a new ID, you'll have to go to Settings>iCloud on your phone and turn all data you are syncing with iCloud (contacts, calendars, etc.) to Off.  When prompted choose to keep the data on your iPhone.  (If you are syncing iWork documents with iCloud, also open your iWork apps and turn off iCloud syncing and choose to keep the documents on your phone.)  After everything is turned off, scroll to the bottom and tap Delete Account.  Next, set up a new iCloud account using your other ID, then turn syncing for your data (contacts, etc.) back to On.  When prompted, choose Merge.  This will upload the data to your new account.
    You won't lose any photos in your camera roll or photo library.  If you have any photos in your photo stream that are over 30 days old that are not in your camera roll or saved on your computer, be sure to save these to the camera roll before deleting the account.  To do so, open the photo stream album on your iPhone in the thumbnail view, tap Edit, tap all the photos you need to save to select them, tap Share, then tap Save to Camera Roll.

  • Why itunes does not sync the calendar?

    why itunes does not sync the calendar?

    Hey ThierryWillame,
    Thanks for the question. Were these songs purchased from the iTunes Store? If so, see the following resource. If not, follow the same steps for the content, based on how you acquired it (delete and re-add).
    Songs in iTunes may not play back completely
    http://support.apple.com/kb/TS4357
    Symptoms
    Occasionally, if a song purchased from the iTunes Store on a Mac or PC was not downloaded completely, the song may not play back fully. The song may abruptly stop during playback, and iTunes may start playing the next song in your library or playlist.
    Resolution
    If iTunes in the Cloud is available in your country, try the following steps to resolve the issue:
    1. Delete the purchased song that is exhibiting the problem from your iTunes library.
    2. Click on the Purchased link in the iTunes Store to view your previously purchased music.
    3. Download your previously purchased song from this list.
    Note: iTunes in the Cloud, which allows you to download previously purchased songs from the iTunes Store, is not available in every country. Learn if iTunes in the Cloud is offered in your country.
    Additional Information:
    iTunes 11 for Mac: Delete songs, playlists, or other items
    http://support.apple.com/kb/PH12159
    Download past purchases
    http://support.apple.com/kb/HT2519
    Thanks,
    Matt M.

  • Why Apple does not recognize the serial number of my iMac?

    why Apple does not recognize the serial number of my iMac?

    You're positive you have the correct number?
    Open System Profile    /Applications/Utilities
    Select Hardware on the left under Contents
    Serial number is on the right under Hardware Overview
    You can copy and paste it from there to here > Apple - Support - Check Your Service and Support Coverage

  • PO creation-ME21n-Why SAP does not check company code and Plant relation

    Hi All,
    Does someone know, why SAP does not check Plant and company code relation at the time of PO creation or how can we put validation between plant and company code at the time of PO creation.
    <b>Example:</b> Suppose i have a company 0001 which is assinged to Plant 0001. when i am creating a PO with another company code 0002(Entering at header level-Org, data) and using Plant 0001 at line item level. SAP does not do this validation.
    How can we put this check in place?
    Thanks in advance.
    Deepak

    Hello Deepak,
    There are three types of purchasing
    - Company code specific :You need to assign company code to Pur organization
    - Plant specific : You must assign plant to pur organization
    - Cross company purchasing: No assignment between company code and pur organization.
    In the case 3, the system will not check company code and plant relationship, but it will check plant and pur organization specific.
    The following is the copy of sap help text:
    You can assign a purchasing organization to one company code. This is company-specific purchasing.
    You can assign a purchasing organization to no company code. This purchasing organization can then procure for all plants assigned to it, irrespective of the company code to which the plant belongs.
    Since each plant must be assigned to a company code, the company code can be determined via the plant in each procurement transaction, even if the procuring purchasing organization is not assigned to a company code.
    A purchasing organization must be assigned to one or more plants. This is plant-specific purchasing.
    Now, check your company-code and purchase organization assignment.
    Hope this helps.
    Regards
    Arif Mansuri

  • Why facetime does not working with any carrier in u.s expect att although the iphone is factory unlocked

    why facetime does not working with any carrier in u.s expect att although the iphone is factory unlocked

    Facetime only works via WiFi. Are you trying to set up Facetime with a T-Mobile account?

  • Why can I not put a picture from camera roll into an album?

    Why can I not put a picture from my camera roll into an album now? When I try these are greyed out. I created these albums on my ipad too but ever since I updated to IOS 7 this can't be done, it was so easy before.

    I can now answer my own question as I've worked it out. For those who are interested click on Shared Streams then on album you require photo to be in then click on the empty box with a cross in the centre and choose photo you wish to add.

  • Is it free to send messages in iMessage to another county? if yes why it does not show that these messages from iMessage?

    Is it free to send messages in iMessage to another county? if yes why it does not show that these messages from iMessage?

    if you receive an imessage not on any internet connection you will receive it as a sms (green) and yes it counts toward your texting plan

  • Why RSS does not work with my OS X 10.8.2?

    Why RSS does not work with my OS X 10.8.2? There was no problem before the upgrade to the Mountain Lion.

    By clicking on the RSS icon I'm getting a message:
    "No RSS reader is installed. Safari can't open the feed because Safari can't display RSS feeds"
    In Chrome I get xml file of the RSS site.
    Should I buy something what I didn't need with the Snow Leopard?
    Thanks for your help.
    Message was edited by: PZA22

  • Why Set does not have get() method

    Can some one tell me why set does not have get method?...

    user12203354 wrote:
    ya u are right that designer of this class thought there is no implementation required for get but why he/she thought like this...
    there must be some valid reason for the same.Because a Set's purpose is not to keep things in order; it's to ensure there are no duplicate entries. Set would require extra code to be able to keep track of an order.
    Note that there is a Set implementation that does keep track of insertion order--LinkedHashSet--but it doesn't have a get() method.

  • Why java does not support multiple inheritance ???

    Hai friends ..iam new to java .. i have doubt ..plz help me
    Why java does not support multiple inheritance ???

    The reasons for omitting multiple inheritance from the Java language mostly stem from the "simple, object oriented, and familiar" goal.
    To understand multiple inheritance, the learner needs some level of expertise like virtual derivations etc in c++. Multiple inheritance will allow method duplication, and throws the learner into confusion which method might be called by the compiler in which scenario at run time.
    Even though this answer seems to be funny, this is the actual reason why java omitted multiple inheritance of classes.
    But java support multiple inheritance of interfaces. Multiple interface inheritance allows an object to inherit many different method signatures with the caveat that the inheriting object must implement those inherited methods.

  • Why Netflix does not open after the new 7.0 update?

    WHY  Netflix does not open after the new update 7.9?

    Vincent149 wrote:
    I went to At&t yesterday, they said you have to call Apple support! Which im gong to try today since no one on here has posted anything back! Im frustrated! Maybe its there way of selling new phone!!!!
    These are user to user forums.  You are not addressing Apple by posting here.  If some other person has a solutoin for you, then they will post it.

  • Does anyone know why Lion does not support the HP LaserJet CP1025nw and if there is a work around?

    Does anyone know why Lion does not support the HP LaserJet CP1025nw and if there is a work around while we wait for a dedicated driver? HP claims apple provides the drivers but I am not certain of this.

    See the following link for details from the hp.com site on using your model of printer with Lion along with a number of other FAQs :
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c02915680&cc=uk&dlc=en&lc=en &os=219&product=4052972&sw_lang=
    Thanks
    AF

Maybe you are looking for