Questions on Locking-- URGENT

Here are my questions on Locking.:
1)
How do I use v$lock to figure out lock details ? Details like
whos has locked,on which table,who else is waiting, and what type
of locking (shared or exlusive ?), since when it is locked.
2)
Why and when exclusive/shared locks are used ? Could you give me
example please ?
3)
Could you tell me significance of v$mystat and v$locked_object ?
4)
Do we have page level locking in Oracle ?
Thanks in advance,
DN

Details about locks : All locks acquired by statements within a transaction are held for the duration of the transaction.
Oracle releases all locks acquired by the statements within a transaction when an explict or implied commit or roll back is executed. Oracle also releases locks acquired after a savepoint when rolling back to the savepoint.
Note: Only transactions not waiting for the previously locked resources can acquire locks on now available resources. Waiting transactions continue to wait until after the original transaction commits or completely rolls back.
1. How do I use v$lock to figure out lock details? Details like
whos has locked,on which table,who else is waiting, and what type
of locking (shared or exlusive ?), since when it is locked.
Better way is to use Oracle OEM. The TYPE column in v$lock shows the type of wait events and we also have the LMODE column (lock mode) and REQUEST columns.
Here is a comprehensive v$lock query by Deepak Baranwal, listing the lock types:
set echo off
col sid form 9999
col id1 form 9999999999
col id2 form 999999999
col lmode head "Lock Held" form a14
col request1 head "Lock Request" form a16
col type head "Lock Type" form a15
col ctime head "Time|Held" form 999999
col block head "No Of |Sessions|Waiting|For This|Lock" form 99999
select sid,
DECODE(TYPE,
'BL','Buffer hash table',
'CF','Control File Transaction',
'CI','Cross Instance Call',
'CS','Control File Schema',
'CU','Bind Enqueue',
'DF','Data File',
'DL','Direct-loader index-creation',
'DM','Mount/startup db primary/secondary instance',
'DR','Distributed Recovery Process',
'DX','Distributed Transaction Entry',
'FI','SGA Open-File Information',
'FS','File Set',
'IN','Instance Number',
'IR','Instance Recovery Serialization',
'IS','Instance State',
'IV','Library Cache InValidation',
'JQ','Job Queue',
'KK','Redo Log "Kick"',
'LS','Log Start/Log Switch',
'MB','Master Buffer hash table',
'MM','Mount Definition',
'MR','Media Recovery',
'PF','Password File',
'PI','Parallel Slaves',
'PR','Process Startup',
'PS','Parallel Slaves Synchronization',
'RE','USE_ROW_ENQUEUE Enforcement',
'RT','Redo Thread',
'RW','Row Wait',
'SC','System Commit Number',
'SH','System Commit Number HWM',
'SM','SMON',
'SQ','Sequence Number',
'SR','Synchronized Replication',
'SS','Sort Segment',
'ST','Space Transaction',
'SV','Sequence Number Value',
'TA','Transaction Recovery',
'TD','DDL enqueue',
'TE','Extend-segment enqueue',
'TM','DML enqueue',
'TS','Temporary Segment',
'TT','Temporary Table',
'TX','Transaction',
'UL','User-defined Lock',
'UN','User Name',
'US','Undo Segment Serialization',
'WL','Being-written redo log instance',
'WS','Write-atomic-log-switch global enqueue',
'XA','Instance Attribute',
'XI','Instance Registration',
decode(substr(TYPE,1,1),
'L','Library Cache ('||substr(TYPE,2,1)||')',
'N','Library Cache Pin ('||substr(TYPE,2,1)||')',
'Q','Row Cache ('||substr(TYPE,2,1)||')',
'????')) TYPE,
id1,id2,
decode(lmode,
0,'None(0)',
1,'Null(1)',
2,'Row Share(2)',
3,'Row Exclu(3)',
4,'Share(4)',
5,'Share Row Ex(5)',
6,'Exclusive(6)') lmode,
decode(request,
0,'None(0)',
1,'Null(1)',
2,'Row Share(2)',
3,'Row Exclu(3)',
4,'Share(4)',
5,'Share Row Ex(5)',
6,'Exclusive(6)') request1,
ctime, block
from
v$lock
where sid>5
and type not in ('MR','RT')
order by decode(request,0,0,2),block,5
2 .Why and when exclusive/shared locks are used ? Could you give me
example please ?
Exclusive Lock Mode : Prevents the associates resource from being shared. This lock mode is obtained to modify data. The first transaction to lock a resource exclusively is the only transaction that can alter the resource until the exclusive lock is released.
Share Lock Mode : Allows the associated resource to be shared, depending on the operations involved. Multiple users reading data can share the data, holding share locks to prevent concurrent access by a writer (who needs an exclusive lock). Several transactions can acquire share locks on the same resource.
Oracle Lock Types
DML locks (data locks)
DDL locks (dictionary locks)
Oracle Internal Locks/Latches
Oracle Distributed Locks
Oracle Parallell Cache Management Locks
3. Could you tell me significance of v$mystat and v$locked_object ?
v$locked_object show the information about Who is locking and what object they locking. This view is similar to v$mystat except that it shows cumulated statistics for all sessions.
4. Do we have page level locking in Oracle ? No
Sachin

Similar Messages

  • The apple account number had the question to lock the account number

    The apple account number had the question to lock the account number

    Try resending the verification email by going to https://appleid.apple.com, click Manage your Apple ID, sign in, click on Name, ID and Email addresses on the left, then to the right click Resend under your Primary Email Address.

  • A string of question about Locking & Isolation Level

    Hi All
    It is highly appreciated if someone give offer answers to my below questions
    1) There are two ways of locking mechanism: Pessimistic & Optimistic. In general, do all J2EE app server support all these two ways of locking ?
    2) It seems to me that setting the isolation level to "serialization" should result in using pessmistic locking. If no so, please point out my misconcept and explain to me.
    3) Are there any differences in the way of entity bean programming as different locking mechansim is adopted ?
    4) With regard to optimistic locking, will the app server throw out exception as data contention is detected ? Is the way of handling dependent on app server? Or It is transparent to the developer of entity bean. Please give me an e.g of j2ee app server product how to handle this scenario.
    5) To adopt the approach of "optimistic" locking, do l have to implement it on my own using bean managed entity bean.
    6) It seems to me that optimistic locking can achieve better concurrency. If it is inherently supported by app server for its container managed entity bean (=> totally transparent to the developer of entity bean). Is it always the rule of thumb to config the server to use "optimistic" locking instead of "pessimistic" ?
    Sorry for bombarding you guys with such long list of questions. l would be very thankful if someone can help me consolidate my concept on these topics.
    Also, please send your reply to [email protected] as well
    thanks & regards
    Danny

    Hi Danny,
    I became interested about the optimistic locking recently. If the topic is not long forgotten then this may make some difference!
    We have attacked the optimistic locking issue by introducing audit fields (MODIFY_BY_USER, MODIFY_DATE) in tables where concurrency needs to be implemented.
    We are retrieving rows from the table (for display or update) through Stateless Session Bean using simple SQL SELECT. The audit fields are fetched along with the business data and are kept at the client. While any of the concurrent users tries to update the row the audit fields are sent to the application server along with the modified business data. The relevant Entity Bean checks for any difference in the timestamp of the audit field (MODIFY_DATE) value with the value in the database. If a mismatch is found it reports a business exception to the user. Otherwise, the row is updated with the lastest timestamp value in the audit field MODIFY_DATE.
    This works fine when two update operations are not concurrent, i.e., two users submit their update requests in a time lag greater than the time taken by the transaction to complete. This alone could not prevent the dirty update on the database.
    Hence, to prevent any concurrent update contending for the same row you need to set the following ejbgen tag in the Entity Bean:
    concurrency-strategy = Exclusive<<<<<Note: We are using Weblogic 6.1 with SP4 and CMP (no BMP).
    Please let me know if you have got a better solution to tackle this issue.
    Chandra.

  • Question about locking order during merge statement

    Dear all.
    I have a merge query with a decedent hint to prevent deadlock with another queries.
    Another queries use select ~for update with same hint.
    My question is that the locking order will follow the hint in this query?
    Or I might use the select ~ for update before this merege.
    Please give any advice about select ~for update and locking order in the query.
    Thanks.
    MERGE INTO  A
    USING
         (SELECT /*+ index_desc(C index_key) */ *
         FROM
             C
          WHERE key > :start and key < :end
        ) B
         ON  ( A.KEY = B.KEY )
    WHEN MATCHED THEN
         UPDATE
         SET A.v1 = B.v1

    What you are doing is not going to prevent a deadlock in your, as yet, unknown version of Oracle. Reading an index does not cause deadlocks. Trying to alter an uncommitted row does.
    I would suggest you code this correctly by doing a SELECT FOR UPDATE WAIT <seconds> in all transactions.
    http://www.morganslibrary.org/reference/deadlocks.html#dlfu

  • Acrobat Pro 8 question to lock downloaded pdf to computer.

    Hello to everyone.
    I am interested in Adobe Acrobat Pro 8 for Mac, but I have a question which needs an answer to.
    Can you lock a pdf in Acrobat Pro 8 to the computer used to download the file? I was told by a sales rep that if you exclude the ability to print, copy, edit, and move a pdf file in Acrobat Pro 8 this will lock the file to the specific computer used to download it. Is this statement correct? I am trying to find out with a definitive yes or no. Thanks for any and all help.
    Cory

    Alternatively, look at using digital signatures and the security
    policies. This method ensures that only the person with the matching
    certificate can open the file and have specific options ...
    It would involve swapping digital ID files but once set-up, it's very
    powerful ... just uses Acrobat 8 and even Reader ..
    Jon

  • TS2446 cant remember security question been locked out help

    i cant remember my security questions eg first teacher etc been locked out please help

    Check the AppleCare number for your country here:
    http://support.apple.com/kb/HE57
    Call them up, and let them know you would like to be transferred to the Account Security Team.

  • I forgot my my security questions apple locked my account for 8 hours

    MY account security questions were right but apple said thewe were wrong and now the account is locked and I can't access the part to change the answer

    You need to ask Apple to reset your security questions; this can be done by clicking here and picking a method, or if your country isn't listed, filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (109552)

  • Questions regarding Lock Objects.

    I am creating a custom table and I want to implement a unique ID for my table and I want to use the technique of auto-increment. I created a seperate table where to store the increments to be used as IDs. So basically, when a new data is going to be saved on my other table, the program will query the next "id" from the table for increments. I have to make sure that the updating and reading of the data from the table is accessed one at a time to rule out the possibility that there will be no duplicate IDs generated.
    I have read about shared locks and exclusive locks which would serve as a solution for my purpose. The question is: is it possible for other users to "read" from a table if it is currently in an "exclusive lock" by another user?

    >
    it2051229 wrote:
    > I am creating a custom table and I want to implement a unique ID for my table and I want to use the technique of auto-increment. I created a seperate table where to store the increments to be used as IDs. So basically, when a new data is going to be saved on my other table, the program will query the next "id" from the table for increments. I have to make sure that the updating and reading of the data from the table is accessed one at a time to rule out the possibility that there will be no duplicate IDs generated.
    >
    > I have read about shared locks and exclusive locks which would serve as a solution for my purpose. The question is: is it possible for other users to "read" from a table if it is currently in an "exclusive lock" by another user?
    No it isn't.
    When you've selected your current value with SELECT FOR UPDATE (to get the exclusive lock) then every other reader will have to wait.
    But is this really what you want?
    Putting locks on something like an increasing number that is just used for an internal ID?
    This will do nothing but turn your multiuser database application into a one-by-one slowness.
    Instead, check the documentation about SEQUENCES.
    These database objects were made for this. Lockfree increasing (or decreasing) numbers for unique ID columns.
    Easy to use. Safe to use.
    In 99.9% of all cases this is what you should use.
    regards,
    Lars

  • Two basic questions about locks in Oracle.

    Hello,
    This is about 9i and onwards.
    I need to develop a comprehensive analysis of locks and waits and while doing so, following questions popped up.
    1) What is the difference between locks and waits?
    2) There is a DBA view called DBA_BLOCKERS. The standard Oracle documentation has only one line comment about this view i.e. "DBA_BLOCKER – Shows non-waiting sessions holding locks being waited-on by other sessions.
    My question is : Why would a non waiting session hold locks after all? I guess that automatically repeats the question #1 from above, What is the difference between "being waited on" v/s "holding locks with wait" and "holding locks without waits"?
    Thanks,
    R

    1) What is the difference between locks and waits? Lock - something you queue up to get and simply wait until it is available
    Waits - Waiting for a Specific event to happen before it can proceed.
    Re: Difference between a latch and a lock
    2) There is a DBA view called DBA_BLOCKERS. The standard Oracle documentation has only one line comment about this view i.e. "DBA_BLOCKER – Shows non->waiting sessions holding locks being waited-on by other sessions.DBA_BLOCKERS displays a session if it is not waiting for a locked object but is holding a lock on an object for which another session is waiting.
    HTH
    -Anantha

  • Hi frnds this question is of  Urgent Nature

    hi friends this question is of high importance and urgency
    Actually  our 111625 Acount wihch stands for Bank and cash  is not reflecting in 1 of our PCA report,,but its reflecting in other Financial reports .In our company  we do have 2 Finnancial statment versions,so i have chekced this particular accounts presence in both the Finnancial statement version,,i have chekced the presence of this account in T codes = FSE2 wer we deal with Finnancial statments here,KDH2 wer we deal with accounts group here,3KEH  wer we deal with Profit center accounting here and also in GS02 wer we add in SETS.Even after all  these proceess im not getting the particular account in the report,,how to slove this,,pls help me out..Needed points will be rewarded..thanks and awating for reply
                                                                                    Narayanan.S

    Hi,
         Here is the dynamic query for creating user and to give grants to user,
    DECLARE
       n         NUMBER;
       cr_user   VARCHAR2 (300);
       gr_user   VARCHAR2 (300);
    BEGIN
       n := 1;
       WHILE (n <= 10)
       LOOP
          cr_user := 'CREATE user EM' || n || ' IDENTIFIED BY KLU';
          gr_user := 'GRANT CREATE SESSION,GRANT ANY PRIVILEGE TO EM' || n || '';
          EXECUTE IMMEDIATE cr_user;
          EXECUTE IMMEDIATE gr_user;
          n := n + 1;
       END LOOP;
    END;
    Edited: Removed When OTHERS Exception Handling from Code.
    Cheers!

  • Re-post : General Question about Language - Urgent Advice Needed

    IS IT POSSIBLE TO AVOID COMPLETELLY THE DISPLAY/USAGE OF ENGLISH IN PORTAL?
    WE INSTALLED LANGUAGE SPANISH (langinst.cmd) AND OUR CONTENT AREAS HAVE DEFAULT LANGUAGE "SPANISH"(NO ENGLISH TRANSLATION) .
    OUR PAGES/NAVIGATION BARS/STYLES/ETC... WERE CREATED BEING CONNECTED TO THE PORTAL IN SPANISH.
    WE DON'T WANT TO SHOW THE "LANGUAGE" PORTLET FOR USERS TO CHANGE BETWEEN SPANISH AND ENGLISH AND WE DON'T WANT THE PORTAL TO DISPLAY IN ENGLISH IF THE BROWSER SETTING IS ENGLISH.
    I READ SOMEWERE THAT IT IS NOT POSSIBLE TO "UNINSTALL" A LANGUAGE, THEREFORE I ASSUME WE CANNOT ELIMINATE THE ENGLISH LANGUAGE.
    CAN WE CONFIGURE SOMEHOW "SPANISH" AS A DEFAULT AND "UNIQUE"LANGUAGE SO ALWAYS THE PORTAL DISPLAYS IN SPANISH ??
    I HAVE INSTALLED LATEST VERSION 3.0.9.
    ANY IDEAS/SUGGESTIONS WILL BE MORE THAN WELLCOME!
    REGARDS
    null

    Hi Maria,
    One way of using Spanish as the default language is to load the following code in your Portal schema:
    set def off
    /* @Copyright (c) 1999, Oracle Corporation. All rights reserved. */
    create or replace procedure home
    -- create the synonyms for wwpob_page.show
    as
    l_pageid number;
    l_url varchar2(32767);
    function is_language_set
    p_http_language in varchar2 default null,
    p_nls_language in varchar2 default null,
    p_nls_territory in varchar2 default null,
    p_requested_url in varchar2
    return boolean
    is
    l_cookie owa_cookie.cookie;
    l_language varchar2(100) default null;
    begin
    begin
    begin
    l_cookie := owa_cookie.get(wwctx_sso.PERSISTENT_COOKIE);
    exception
    when others then
    l_language := null;
    raise wwctx_sso.NOT_HTTP_SESSION_EXCEPTION;
    end;
    l_language := lower(l_cookie.vals(1));
    exception
    when others then
    l_language := null;
    end;
    if l_language is null then
    wwctx_app_language.set_language
    p_http_language => p_http_language,
    p_nls_language => p_nls_language,
    p_nls_territory => p_nls_territory,
    p_requested_url => p_requested_url
    return false;
    end if;
    return true;
    end is_language_set;
    begin
    -- Mobile support
    if wwpob_api_mobile.is_mobile_request
    then
    l_pageid := wwpob_api_mobile.get_defaultmobilepage;
    else
    l_pageid := wwpob_api_mobile.get_defaultmobilepage;
    else
    l_pageid := wwpob_api_page.get_defaultpage;
    end if;
    l_url := wwpob_page_util.get_page_url(p_pageid => l_pageid);
    if is_language_set('es', 'e', 'SPAIN', l_url) then
    owa_util.redirect_url(l_url);
    end if;
    exception
    when others then
    wwerr_api_error_ui.show_html;
    end;
    show errors procedure home;
    This script looks for the language in the NLS_LANGUAGE cookie. It this cookie does not exist then the language defaults to Spanish because of the code is_language_set('es', 'e', 'SPAIN', l_url). Please make sure to delete the NLS_LANGUAGE cookie, if it exists.
    Please note that this code will work for 3.0.9. In case you want to implement something similar to this on 3.0.8, the code containing the mobile support has to be removed. You can contact me, should you have any questions.

  • 10.1.3 errors - since my last question was locked by a mod - despite not being answered

    Quote:
    frustratedbutopenAug 27, 2014 6:17 AM
    Wow. Apple really screwed up the program this time. Here's some of my new problems.
    1. PDF's no longer cycle through the pages in the viewer window. You can't skim the pages, find the one you need, and drop it in. I do a lot of training videos using PDFs to show pages of manuals and whatnot. This makes my edits a real PITA
    Video of error: http://youtu.be/tpAQC2wUmEg
    2. 24p footage strobes in the viewer, in the scopes, and while editing the footage. Timeline set to 24p.
    Video of error: http://youtu.be/IfdxthOF0Z8
    3. Can't import C300 footage anymore. This is a screenshot of my import window when looking at a C300 card. I have the latest Canon drivers and utilities installed on my system
    The combination of these three issues has made it almost impossible to use this program anymore. It can no longer do what I need it to do.
    Does anyone have any ideas - besides moving over to PremierPro, which I have just purchased as of this morning?
    Then Tom Wolsky replied:
    Tom Wolsky     Aug 27, 2014 7:03 AM  Re: New problems with 10.1.3 - 24p footage strobing, among others...
      Re: New problems with 10.1.3 - 24p footage strobing, among others...  in response to frustratedbutopen      
    What did you upgrade from? What are your system specs?
    I'm not seeing the strobe in the 23.98 media. Maybe YouTube is suppressing it.
    Only seen C300 media once but that doesn't look like a complete folder structure.
    I'm sure you'll be happy with Premiere.

    Tom - in answer to your questions,
    The strobing is there when I watch the video on youtube. I can post a higher rez clip, but its apparent on the scope.
    1. I upgraded from 10.2.1. MacPro 3.5 6-core Xeon E5, 32 GB 1867 DDR3 (Mavericks, obviously)
    2. That's the card - taken directly from the C300 and stuck into the card-reader. Footage opens just fine in PPro
    3. "Sure you'll be happy with Premiere" C'mon man. What kind of boneheaded reply is that? That's a typical apple egghead "pi$s off". It would be great if assistance could be offered without the snobbery, but thanks for living up to the stereotype. I have invested in X from the get-go. I've had X installed since it came out and I made the commitment to learn it and use it as the edit-backbone of my projects. I dumped 5 figures into 3 MPro trashcans - all running x - because I believed enough in this product to do so. You're doing Apple a disservice by being so dismissive and smug.
    I mentioned that I bought PPro because as of this latest update, X is creating enough trouble in my workflow to where it is costing me time and time is money. Look at the issues with 10.1.3 that are being posted just in this forum. If you can't see that there may actually be some issues with the software, then maybe you need to loosen your beret a bit.

  • Question on Lock in In-Doubt Transaction

    Dear All,
    Could you kindly explain me why distributed transaction imposes a lock on read also with write? During Read, Select statement also uses rollback segment.
    But in the document “Oracle9i - Database Administrator’s Guide Release 2 (9.2) - March 2002 Part No. A96521-01” at page 31-16, it has been written that
    “the data is locked for both reads and writes. Oracle blocks reads because it cannot determine which version of the data to display for a query.”
    So could we come to a conclusion that distributed transaction does not use rollback segment.
    But at page 31-18, under manual resolution of In-Doubt Transaction, the first point is that the in-doubt transaction has locks on critical data or rollback segment.
    Therefore, rollback segment is using during distributed transaction. So why does Oracle impose a lock on READ the data?
    Regards,
    Student

    Redo logs are effectively write-only under normal circumstances. The database NEVER goes back to read the redo log unless it is in crash recovery mode.
    Therefore, even though the information has been recorded in the online redo log, that information can not be used to roll back a failed in-doubt transaction. The rollback information MUST come from the rollback segment or from some other online location.
    (I am not taking this as an argument - it's helping me as well.)

  • A very simple question..Very Urgent

    HI,
    I have a very simple question.I am able to set up the client authentication as well as server authentication. Now do i need to authenticate (both server as well as client auth.) for every request i send to the server on https...i think it should be like that it should authenticate only for the first time and for the next upcoming requests in same session should not require any server or client authentication.. i think as it happens in browsers..
    what is the fact actually??..can somebody put some light...right now in my case it is authenticating for every requests..
    This is what i have done..
    /****constructor part********/
    // and tm are arrays of keymanagers and trustmanagers for client keystore and truststore
    sslContext.init(km, tm, null);
    HttpsURLConnection.setDefaultSSLSocketFactory(ssf);
    HttpsURLConnection.setDefaultHostnameVerifier(new MYHostNameVerifier());
    /****Method to send the request and response*********/
    urlConn = (HttpsURLConnection)url.openConnection();
    urlConn.setDoInput(true);
    urlConn.setDoOutput(true);
    OutputStream os = urlConn.getOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(os);
    oos.writeObject(someobject);
    oos.flush();
    InputStream is1 = urlConn.getInputStream();
    ObjectInputStream ois = new ObjectInputStream(is1);
    SomeObject retObj = null;
    retObj = (SomeObject)ois.readObject();
    ois.close();
    System.out.println("Get String>>>>> "+retObj.getString());
    I am creating the object of this class..and calling the method again and again for sending requests and response..so i think handshake everytime i call the method...what i want is that handshake should happen for the first time and for the next requests no handshake or certificates should be checked or processed..
    is it possible ..how..what i need to do for that..
    please help me in this..
    Akhil Nagpal

    Hi,
    how could I achieve SSL Session Resumption using HttpsURLConnection.
    Thanks.

  • Question on locked audio regions

    I saw a Logic 7 video a few days ago in which a locked audio region had its start point dragged to the right. This process shortened the region but left the new region with exactly the same bar/timecode position as before. I don't seem to be able to do this in Logic 9. Has this facility been removed?

    ...but in the video I mentioned the locked region's front end was dragged while the region was still in the arrangement window. That looked a really handy feature and I still can't work out if it's still possible in Logic 9.

Maybe you are looking for