Oracle's locking strategy question

I have a question related to Oracle's locking mechanism which I understand is related to taking "snapshots in time" to avoid writers blocking readers (which happens in SQL Server).
Suppose I had a table T1 with 1 billion records and column C1 = 4 in every row. Suppose the following events occur:
12:00 update T1 set C1 = 5
12:01 select C1 from T1 where ... (and this statement returns only one row)
1:00 the update statement executed at 12:00 finally finishes
Would oracle return the value 4 regardless or which row was selected at 12:01?
Why would this be more correct than locking the table and waiting until 1:00 and returning 5? Sure, this would be a long wait, but at 12:00 a command was issued to set every value to 5!

You are question is related to oracle transaction
control and read consistency in the database in
Oracle database all the SQL and DML runs with SCN
timestamp.
for example
Session 1 SQL 12:00 > UPDATE t1 SET c4=5 ;
---assuming this runs for an hour
before updating c4=5 it takes the snapshot of the C4
column data and keeps in
UNDO segments to make other sessions read
consistent.
Session 2 SQL 12:01 > SELECT c4 FROM t1 WHERE ....
this will return 4 as the DML is not yet comminted in
the Session 1
To happen this Oracle database server process reads
the data from UNDO to answer your question.locks are
matianed at the database BLOCK header level.
Let me put a simple thought here
You have two debit cards issued for one account one
is with you and the other one is with your beloved
one.Balance in your account = Rs 40000
1) at 12:00 you went to a ATM and inserted your debit
card to draw amt Rs 20000
and your transaction is still processing ( you not
recieved the cash)
2) at 12:01 your beloved one went an another ATM and
interested to see the balance so do you think Rs
40000 should be shown or Rs 20000.
hope you got some ideaNot to pick nits, but I think this is a bad example. If you had such an important action (especially if it was going to take a long time to complete) you would/should have some kind of lock on modifying the account value so that this very thing couldn't happen! Only one transaction at a time gets to update the balance. In a sense, that might make Oracle look like the SQL Server you appear to be familiar with (the 2nd transaction would wait. A very long time!) But for a bank account type transaction, you almost have to.
Gaff

Similar Messages

  • Few questions regarding Oracle Scorecard and strategy management.

    Hi,
    I have following questions regarding Oracle Scorecard and strategy management:
    1. What are the ways in which i can show status of a KPI, like we have colors and symbols, what are others?
    2. can we keep log of KPIs, store them, keep report of feedback/action taken on that?
    3. Does Scorecard and strategy management have ability to retain history on feedback and log of
    entries i.e. date/time, user name?
    4. Does Scorecard and strategy management have ability to use common mathematical formulas e.g. median, average, percentiles. Describe.?
    Thanks in advance for your help.

    bump.

  • Oracle Asset (Functional) Practice Questions for Interviews and Exam

    https://www.createspace.com/3495382
    http://www.amazon.com/Functional-Questions-Interviews-Certification-Examination/dp/1456311581/ref=sr_1_4?ie=UTF8&s=books&qid=1289178586&sr=8-4
    List Price: $29.99
    Add to Cart
    Oracle Asset (Functional) Practice Questions for Interviews and Certification Examination (Release 11i and 12)
    Functional Consultant
    Authored by Erp Gold
    This book contains 150 Oracle Asset Practice Questions for functional consultants. Very useful for interviews and certification examinations.
    Publication Date:
    Oct 26 2010
    ISBN/EAN13:
    1456311581 / 9781456311582
    Page Count:
    94
    Binding Type:
    US Trade Paper
    Trim Size:
    6" x 9"
    Language:
    English
    Color:
    Black and White
    Related Categories:
    Computers / General

    Reported as spam!

  • Oracle Asset (Functional) Practice Questions for Interviews and Certificati

    https://www.createspace.com/3495382
    List Price: $29.99
    Add to Cart
    Oracle Asset (Functional) Practice Questions for Interviews and Certification Examination (Release 11i and 12)
    Functional Consultant
    Authored by Erp Gold
    This book contains 150 Oracle Asset Practice Questions for functional consultants. Very useful for interviews and certification examinations.
    Publication Date:
    Oct 26 2010
    ISBN/EAN13:
    1456311581 / 9781456311582
    Page Count:
    94
    Binding Type:
    US Trade Paper
    Trim Size:
    6" x 9"
    Language:
    English
    Color:
    Black and White
    Related Categories:
    Computers / General

    Reported as spam!

  • Oracle 10g - lock statistics

    What are the different situations in which Oracle will lock existing table/index statistics automatically?
    As per my undrstanding to lock the statistics we must use "dbms_stats" package with lock_table_stats/lock_schema_stats procedures. I dont see any other situation where Oracle automatically locks the statistics.
    Please share your experience.

    I dont see any other situation where Oracle automatically locks the statistics.Oracle never locks the statistics on its own. Oracle has only given methods so that one can decide whether to collect the statistics for volatile/static tables; so that the execution plans do not change drastically.

  • Where can I get oracle dead lock information

    Hi Experts,
    two days back I find oracle dead lock information at SM21 log file but when I checked today the old data was over written by new data.
    Where can I find oracle dead lock information other than SM21? can anyone please help
    Thanks in advance
    Regards
    Veera
    Edited by: Veerab on Apr 27, 2011 8:22 AM

    Hi,
    Have you refered [SAP Note 84348 - Oracle deadlocks, ORA-00060 |https://service.sap.com/sap/support/notes/84348]? It contains good detailed description about possible oracle deadlock situations and analysis.
    Along with the trace file generated by oracle (at directory /oracle/<SID>/saptrace/usertrace/), You can get historical information from alert<SID>.log file located at /oracle/<SID>/saptrace/background/.
    In alert<SID>.log file the deadlock situation is written with deadlock graph at the time of occurances.
    Regards,
    Bhavik G. Shroff

  • How can I prevent oracle from locking accounts after failed logins?

    how can I prevent oracle from locking accounts after failed logins?
    Thanks

    svarma wrote:
    So what is the difference between the profile settings ...FAILED_LOGIN_ATTEMPTS and the parameter settings SEC_MAX_FAILED_LOGIN_ATTEMPTS?
    Prior to 11g we only used profiles to control failed_login_attempts.. Then why we need thsi new parameter now?http://download.oracle.com/docs/cd/E11882_01/server.112/e17110/initparams221.htm#I1010274
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17222/changes.htm#UPGRD12504
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/statements_6010.htm#SQLRF01310
    As documented ...
    FAILED_LOGIN_ATTEMPTS is a property of a profile, and will lock an account
    SEC_MAX_FAILED_LOGIN_ATTEMPTS is an initialization parameter and will drop a connection but says nothing about locking accounts.

  • Oracle Explicit Locks

    Hello experts ,
    Once again i want to clear my basic knowldge in terms of oracle locks.
    what i knows is that oracle atumatically locked the object whenever we perform any dml operation.( update,delete)
    but it is row level exclusive lock ( i.e. RX,in v$locked_object, it show locked mode 3 )
    It is implicit lock which oracle provided automatically.
    and the other lock is Explicit lock,
    it is either we have to locked the by using LOCK statement ( by using LOCK statement we can lock the table in modes
    (i.e row share(2),row exclusive(3), share(4), row share exclusive(5),exclusive(6) )
    OR
    the table is also locked by statemet "select ..for update"( but its row exlusive lock (RX 3))
    but
    when and in what condition we apply explicit lock?
    what are the practical future of these lock?
    can you please explain about these explicit lock like
    row share(2)
    row exclusive(3)
    share(4)
    row share exclusive(5)
    exclusive(6)
    I have read about these lock from books , blogs and other internet sites , but still my concepts is not clear
    in these area.
    Thanks in advance for your help.
    Regards,
    Prashant Mhatre

    Oracle uses locks (aka enqueues) to prevent destructive concurrent operations on a resource. Here is a short description of the different lock types written by Jonathan Lewis ("the international recognized Oracle Expert"): http://jonathanlewis.wordpress.com/2010/06/21/locks/.
    Except of the SELECT FOR UPDATE case I don't think there are many situation in which setting an explicit lock is necessary - the server knows where and when locks have to be used.

  • Ingres vs Oracle exclusive locking

    Ingres allows an exclusive lock on tables, set lockmode on tablename where readlock = exclusive which means the users can't access the same
    rows that are being modified by another query.
    Is there anything in oracle that does the same thing ? All of Oracle's locking seesm to be that you can
    still read data. And that is what my user is afraid of. He doesn't want to read old data, when it's
    being changed.
    How do you work around this ?
    Thanks.

    Ingres allows an exclusive lock on tables, set lockmode on tablename where readlock = exclusive which means the users can't access the same
    rows that are being modified by another query.
    Is there anything in oracle that does the same thing ? All of Oracle's locking seesm to be that you can
    still read data. And that is what my user is afraid of. He doesn't want to read old data, when it's
    being changed.
    How do you work around this ?
    Thanks.

  • Questions on Oracle EBS backup strategy

    Hi all,
    Currently I am planning the backup strategy for the EBS. May I know apart from backup the database using RMAN, is there anything (e.g. log files) that I need to backup such that I can fully restore the system?
    Thanks a lot in advance.
    Alex

    I see that this is your first post, and you have not searched on this forum or on google about n-number of responses to your question that various people have already asked.
    You didn't mentioned the applicaiton version you are using.
    Anyways, you need to take the complete backup of the application tier directories i.e., appl_top, common_top, inst_top, etc.

  • Need help in regarding Oracle PLSQL developer interview questions

    Hi all,
    I am totally new in this field regarding plsql. I have just finished training in oracle plsql and in oracle financials. But for starting career i am looking jobs as:Oracle plsql developer. Can somebody help me what type of questions people going to ask? I am not confident yet, i have made my resume but for submitting resume i just want to be aware for the interview questions. Can somebody help me in telling me good questions and answers as to what to prepare?
    Thanks in advance.

    1.
    Do you have experience in Oracle 10g? If so, what are your favorite new features? (shows depth of experience and how well they are keeping up with technology)
    2.
    Partitioning (Practical Scenarios)
    1.
    Have you ever worked with partitioned tables? Example:
    2.
    What types of partitioning?
    3.
    What types of indexing, global or local? Why did you choose global or local?
    4.
    What do you see in SQL that is accessing partitioned tables that enables Oracle to take advantage of partitioning?
    5.
    What is partition pruning?
    3.
    PL/SQL Bulk Features
    1.
    Have you ever used PL/SQL bulk features? Which ones? Can you provide an example?
    2.
    What makes bulk processing faster?
    3.
    What PL/SQL data constructs are required to use bulk features?
    4.
    Oracle Collections
    1.
    What are the three types of collections?
    2.
    When would you use a varray versus a nested table?
    5.
    Global Temporary Tables
    1.
    Have you ever used Global Temporary Tables? Example:
    2.
    How does Oracle treat Global Temporary Tables differently than regular tables, making them faster?
    6.
    Autonomous Transactions
    1.
    What is an autonomous transaction? Example:
    7.
    SQL Tuning
    1.
    Someone comes to you with a SQL statement that is running slow, what are some potential problems that can be identified just by looking at the SQL statement?
    2.
    What are the steps you follow in the database to tune SQL?
    8.
    Locking Techniques
    1.
    Types of Locks
    1.
    Optimistic
    2.
    Pessimistic
    3.
    Lock Escalation
    9.
    Autonomous transactions, where to use examples if any
    10.
    Difference between Truncate and Delete Statement
    11.
    PL/SQL tables, index by tables, VARRAY, associate arrays, differences and when to use
    12.
    Performance tuning related, Using Explain plan, SQL* Plus auto trace, and using tkprof
    13.
    Different types of joins oracle uses ( Hash join, Merge Join, Nested loop join)
    14.
    Oracle SQL ANSI syntax ( JOIN USING, JOIN ON, LEFT OUTER JOIN,RIGHT OUTER JOIN etc..)
    15.
    dbms_profiler package uses
    16.
    Unit testing approach, if you know and worked on out PLSQL frame work for automatic testing, its big advantageous
    17.
    Oracle approach for read consistency, what is SCN, dirty reads, phantom reads etc..
    18.
    Standards ( Coding standards, naming standards etc.) , There are guidelines and naming standards for variables, package, procedure, function names, database object names etc…( Be prepared what standards you followed in previous projects )
    19.
    Snapshot too old error, fetch out of sequence error when it comes, should be able to explain.
    20.
    Oracle block, what it contains. Row chaining, row migration concepts
    21.
    Version control software’s (experience in clearcase and clearquest is big advantage). If you have not used these, know about the importance of these and be prepared to explain which ones you used in previous projects, and how the PL/SQL code used to deploy.
    22.
    Oracle server architecture, know about oracle memory structures, background processes overview

  • Grouping in rtf template like oracle reports - a newbie question

    Hello all
    I am new to BI Publisher and have probablly a silly question to ask.
    I have a basic query that returns a flat xml file which looks something like this. it will have multiple rows.
    <ROWSET>
    <ROW num="1">
    <DATE>01-DEC-2007</DATE>
    <PACKAGE>XXX </PACKAGE>
    <DROP_OFF>Hotel1</DROP_OFF>
    <ROOM>1</ROOM>
    <NAME>Test Customer</NAME>
    <PROBLEM_RECORDED>N</PROBLEM_RECORDED>
    <EXCEPTION>1</EXCEPTION>
    </ROW>
    </ROWSET>
    Because i am fairly new to xml i am at a loss trying to work out how i can form a template that will effectively allow grouping at say
    1. Date Level
    2. Package Level
    3.Drop Off level
    4. put all other data in here
    In reports i would just do groups and alter the layout accordingly. Obviously if i had an oracle report version of the sql that generates the xml then i could just generate the xml from the report and i would get the xml i am looking for .
    But I am working with basic sql not reports and am wondering What do I have to do with my xml to get it looking live the grouping I mention above, given all i have to play with is the example xml I included. I am really bamboozled and think i am missing something simple.
    I dont want to have to write multiple queries with different groupings using cast , multiset as I thought one of the benefits of BI Publisher was one query multiple layouts.
    Thanks
    Lisa

    If you haev word plugin installed,
    please follow the documentation and try using that,
    load the xml in the word plugin
    and then select insert table/form and then you can do the drag and drop,
    and group by each fields.
    http://blogs.oracle.com/xmlpublisher/2006/10/30
    http://blogs.oracle.com/xmlpublisher/2007/10/30

  • Oracle 10g XE // Licensing question

    Hi,
    as far as i got till ow, the XE seams to be only limited in 3 ways:
    - max 4GB user data
    - max 1GB RAM actively used
    - max 1 Processor used
    However, this leads to some questions for me:
    1. what is a "processor" defined as ? i this 1 cpu including multi cores or is this just 1 core? (regarding the new Xeons we have e.g. 2 CPUs with 2 Cores each with Hyperthreading makes em 4 Cores on each physical CPU)
    2. can multi XE be used for ditributed DB's ?
    e.g. we have say 2 servers - 1 at company A (production and research) and 1 at company B (part production needed for comp. A). can they be connected together so that the main-DB is at company A and company B only has a part of the DB at company A? e.g. company A hast say 100 tables in their DB but B has only 15 tables to access and stored local for caching ? - if these distributed scenarios are possbiel, could you please point me to the docs for it?
    Best Regards,
    Korbinian

    . what is a "processor" defined as I believe a dual core processor is counted as two CPU (that's certainly how Oracle calculate th elicencing for regular 10g). In the case of XE I think they've frigged the database so it will only use one CPU no matter how many CPUs the server actually has.
    2. can multi XE be used for ditributed DB's ?As far as I'm aware you should be able to do single master replication with XE but not multi-master. But then most sensible people would not want to do multi-master replication anyway. You may find this article by Lewis Cunningham informative. The docs on replication are here.
    Cheers, APC

  • Does Index in Oracle Text lock local files?

    Hi, I am planing to implement content search using file datastore. Let me explain how the whole search going to work, Users are going to upload the file, I am going to store the information about the file like filename, size, keywords, file path etc in Oracle table and I am going to store the original file in a different server. When indexing on filepath, does index lock local files on the Operating system? Does it affect the live data? Please I need answers to this ASAP. Can anyone help?
    Thanks,
    Meena

    Hi,
    there are differences between the Engine of Text indexing, in 10G it was Verity, in 11G (from version 11.1.0.7) it is the Stellent technology, but I do not hope this is it.
    Maybe you could make a dump of the creation of the indexes in both 10g and 11g. This can be done through:
    select ctxsys.ctx_report.create_index_script('KSK_FILE_TABLE_CTX1') from dual;
    This wil give you a create script with all the parameters. Maybe there is a different in your default settings for text indexes, possible the FILTER.
    Herald ten Dam
    Superconsult.nl

  • Oracle 8i locking and timeout

    Hi,
    I am talking to an Oracle 8.1.7 db through Perl DBI for a certain Web Application.
    In the back-end, a script is invoked every hour to sync parts of this db, with the master db. The sync'ing script takes quite a while to complete and it consists of a single transaction ( several update statements followed by a single commmit at the very end).
    Now, I want to know what happens to any user who tries to modify something through the web-interface. If a query from the web-interface finds that a row is locked by the syncing script, how long will it wait before a timeout? ( if any timeout occurs at all, in the first place ! ). Can I control this timeout?
    Please repond ASAP.
    Thanks in advance,
    Rajesh

    How much control do you have over the SQL being generated? There is a keyword 'NOWAIT' that can be added to a statement indicating that it shouldn't wiat for resources-- if it can't lock them immediately, it returns an ORA-00054 (if memory serves) resource locked and NOWAIT specified. Otherwise, by default, the statement will wait indefinitely.
    In ODBC, you can specify a query timeout that will kill all queries after some amount of time.
    Justin

Maybe you are looking for

  • Error in portal_sso_redirect missing application registration information:

    Hi, I am getting the following error message, when i run any of my APEX Page. Please help me to resolve this issue. Error in portal_sso_redirect missing application registration information: p_partner_app_name:g_listerner_token:HTML_DB:stbp5.oracle.c

  • Check payment- doc type

    hi all, can anyone please tell me how can i identify a checkĀ  payment in table regup and reguh? what is the doc type for check payments? thanks, Mirit

  • Nano & 20 Gig Don't Work in USB

    Hi all, So I am the proud owner of a new iPod nano that won't sync up with my PC when plugged in via USB. I also tried this with my 20 gig iPod and get similar results. I first used the nano with my work PC, and everything went fine. When I came home

  • Apple TV refuses to stream

    Apple TV (2) refuses to stream, getting 2 hour downloads before it will even start help D

  • PCA Planning 7KE1 Material Type BWTAR

    Is it possible to add valuation type BWTAR in the planning layout characteristics in transaction code 7KE1 in SAP? I have a need to plan representative materials by valuation type.