How to Implement shared lock

Hi friends,
For a table I have created views. I want to create shared lock for that table.
How to achieve that.
can we create shared lock for views?
Thanks.

Hi Pagidala,
Go to Se11-> Select Lock object radiobutton->give some name starting with E for example EZDEMO_LOCK->click on Create ->give short description->clcik on Tables Tab->give the table name for which you want to implement shared lock example ZTABLE ->lock mode you select as Read Lock.After this save check and activate your lock object.
We have selected READ LOCK since it protects read access to an object. The read lock allows other transactions read access but not write access to the locked area of the table.
Check the below link for the complete information on Lock Concept.
http://help.sap.com/saphelp_nw04/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/content.htm
Cheers!!
VEnk@
Edited by: Venkat Reddy on Oct 29, 2008 11:54 AM

Similar Messages

  • How to create shared lock

    Hi,
    Can any please tell me how create a shared lock in steps.
    Thanks in advance
    Priya

    Hi Swati,
    This may not be possible, because you have created shared lock for the four different views but the table is one.
    So when one is editing then definitely if the other try to access the same entries then the object will be locked.
    First understand how and which lock can do which type of action.
    For your assistance read this and try to find the answer.
    Exclusive lock
    The locked data can be read or processed by one user only. A request for another exclusive lock or for a shared lock is rejected.
    Shared lock
    Several users can read the same data at the same time, but as soon as a user edits the data, a second user can no longer access this data. Requests for further shared locks are accepted, even if they are issued by different users, but exclusive locks are rejected.
    Exclusive but not cumulative lock
    Exclusive locks can be requested by the same transaction more than once and handled successively, but an exclusive but not cumulative lock can only be requested once by a given transaction. All other lock requests are rejected.
    Cheers!!
    VEnk@

  • How to prevent shared locks in SELECT statement?

    Hi,
    In SQL Server we can use (NOLOCK) to prevent shared locks on each row:
    Select * from table (NOLOCK)
    Do we have similar technique for oracle so it doesn’t consider a shared lock for each returned row?
    Thank you,
    Alan

    Yes - it's called a query ;-)
    Oracle was designed with a 'consistent read' mechanism that guarantees that a query will see the image of the data at the moment when the query started, regardless of the number of updates (including deletes) that have occurred since the query started. This is done using the rollback (aka undo) segment. Flip side - there is no such thing as a 'dirty read'.
    Because of the implementation, a simple select or subselect without coersion (such as the 'FOR UPDATE' clause) will not block writers, nor will writers (updates/inserts/deletes) block readers.
    In addition, an update in Oracle will only lock the rows affected by the update, there is no escalation of locks needed (or possible), and commits do not introduce any 'lock clearing' overhead.
    The penalties for all of this
    - the rollback segment must be sized appropriately or you end up with ORA-01555 errors;
    - you should not commit in loops, especially not loops controlled by a cursor;
    - code written to be efficient in SQL Server is often inefficient in Oracle, and vice versa.
    Recommended reading is Tom Kyte's book at http://www.apress.com

  • How to implement optemistic locking in pl/sql for oracle database

    i have search the net to find example of how i can do the optimistic locking in pl/sql, all the resources i found were old , for example "Optimistic Locking with Concurrence in Oracle.
    As " by Graham Thornton Snr. Database Architect / Oracle DBA in 2001, but at the end he said that the approach will not work fine if the update being made is a relative update, this apprach includes:-
    1.add a timestamp column to an exsiting table.
    2.add a preinsert trigger on the table to set the timestamp.
    3.add a preupdate trigger to comapre the old time stamp with the new one.
    So where i can find updated resources about this issue.
    Edited by: 812643 on 17-Nov-2010 12:39

    totally plagiarized from expert oracle database architecture 9i, 10g, 11g by Tom Kyte pg201
    one popular implementation of optimistic locking is to keep the old and new values in the application and upon updating the data use and update like this
    update table
    set column1 =: new_column1, column2 = : new_column2, ...
    where primary_key = :primary_key
    and decode( column1, :old_column1, 1 ) = 1
    and decode( column2, :old_column2, 1 ) = 1
    another implementation
    optimistic locking using a version column
    add a single column to each database table you wish to protect from lost updates. this column is generally either a number or date/timestamp column
    It is typically maintened via a row trigger on the table, which is responsible for incrementing the number column or updating the date/timestamp column
    every time a row is modified.
    another one on page 204
    optimistic locking usin a checksum
    similiar to the version column implementation but it uses the base data itself to compute a virtual version column.
    the ones suggested where owa_opt_lock.checksum, dbms_obfuscation_toolkit.md5, dbms_crypto.hash, ora_hashEdited by: pollywog on Nov 17, 2010 3:48 PM
    might be a good book for you to look into getting it has a whole chapter on locking and latching.
    Edited by: pollywog on Nov 17, 2010 3:54 PM

  • How to avoid shared locks when validating foreign keys?

    I have a table with a FK and I want to update a row in that table without being blocked by another transaction which is updating the parent row at the same time. Here is an example:
    CREATE TABLE dbo.ParentTable
    PARENT_ID int NOT NULL,
    VALUE varchar(128) NULL,
    CONSTRAINT PK_ParentTable PRIMARY KEY (PARENT_ID)
    GO
    CREATE TABLE dbo.ChildTable
    CHILD_ID int NOT NULL,
    PARENT_ID INT NULL,
    VALUE varchar(128) NULL,
    CONSTRAINT PK_ChildTable PRIMARY KEY (CHILD_ID),
    CONSTRAINT FK_ChildTable__ParentTable FOREIGN KEY (PARENT_ID)
    REFERENCES dbo.ParentTable (PARENT_ID)
    GO
    INSERT INTO ParentTable(PARENT_ID, VALUE)
    VALUES (1, 'Some value');
    INSERT INTO ChildTable(CHILD_ID, PARENT_ID, VALUE)
    VALUES (1, 1, 'Some value');
    GO
    Now I have 2 transactions running at the same time:
    The first transaction:
    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;BEGIN TRAN
    UPDATE ParentTable
    SET VALUE = 'Test'
    WHERE PARENT_ID = 1;
    The second transaction:
    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;BEGIN TRAN
    UPDATE ChildTable
    SET VALUE = 'Test',
    PARENT_ID = 1
    WHERE CHILD_ID = 1;
    If 'UPDATE ParentTable' statement runs a bit earlier, then 'UPDATE ChildTable' statement is blocked untill the first transaction is committed or rollbacked. It happens because SQL Server acquires shared locks when validating foreign keys, even
    if the transaction is using read uncommitted, read committed snapshot (read committed using row versioning) or snapshot isolation level. I cannot see why change in the ParentTable.VALUE should prevent me from updating ChildTable. Please note that ParentTable.PARENT_ID
    is not changed by the first transaction, which means that from FK's point of view whatevere is set to the ParentTable.VALUE is never a problem for referential integrity. So, such blocking behavior seems to me not logical. Furthermore, it contradicts to the
    MSDN:
    Transactions running at the READ UNCOMMITTED level do not issue shared locks to prevent other transactions from modifying data read by the current transaction. READ UNCOMMITTED transactions are also not blocked by exclusive locks that would prevent the
    current transaction from reading rows that have been modified but not committed by other transactions. 
    Does anybody know how to workaround the issue? In other words, are there any tricks to avoid shared locks when validating foreign keys? (Disabling FK is not an option.) Thank you.
    Alexey

    If you change the primary key of the parent table to be nonclustered, there is no blocking.
    Indeed, when I update ParentTable.VALUE, then:
    in case of PK_ParentTable is clustered, a particular row in the clustered index is locked (request_mode:X, resource_type: KEY)
    in case of PK_ParentTable is non-clustered, a particular physical row in the heap is locked (request_mode:X, resource_type: RID).
    and when I update ChildTable.PARENT_ID, then:
    in case of PK_ParentTable is clustered, this index is used to verify referential integrity:
    in case of PK_ParentTable is non-clustered, again this index is used to verify referential integrity, but this time it is not locked:
    It is important to note that in both cases SQL Server acquires shared locks when validating foreign keys. The principal difference is that in case of clustered PK_ParentTable the request is blocked, while for non-clustered index it is granted.
    Thank you, Erland for the idea and explanations.
    The only thing that upsets me is that this solution cannot be applied, because I don't want to convert PK_ParentTable from clustered to non-clustered just to avoid blocking issues. It is a pity that SQL Server is not smart enough to realize that:
    ParentTable.PARENT_ID is not changed and, as a result, should not be locked
    ChildTable.PARENT_ID is not actually changed either (old value in my example is 1 and the new value is also 1) and, as a result, there is no need at all for validating the foreign key.
    In fact, the problem I described is just a tip of the iceberg. The real challenge is that I have deadlocks because of the FK validation. In reality, the first transaction has an additional statement which updates ChildTable:
    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
    BEGIN TRAN
    UPDATE ParentTable
    SET VALUE = 'Test'
    WHERE PARENT_ID = 1;
    UPDATE ChildTable
    SET VALUE = 'Test'
    WHERE PARENT_ID = 1;
    The result is famous message:
    Msg 1205, Level 13, State 51, Line xx
    Transaction (Process ID xx) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
    I know that if I change the order of the two statements, it will solve the deadlock issue. But let's imagine I cannot do it. What are the other options?
    Alexey

  • How to implement Pessimistic Locking?

    Hello,
    I am using JDev 10g with integrated mapping workbench. There are option to set up optimistic locking, but I would like to implement pessimistic locking. How do I approach this?
    Thanks,
    Dmitry.

    Dmitry,
    Pessimistic locking is not configured on the descriptor it is executed at the API level on either a session or query. If you are using the UnitOfWork directly then I would recommend looking in the docs at
    UnitOfWork.refreshAndLockObject(Object)
    UnitOfWork.refreshAndLockObject(Object, short lockMode)
    If you wish to configure it on a query you can look at:
    ObjectLevelReadQuery.setLockMode(short lockMode)
    ObjectLevelReadQuery.acquireLocks()
    ObjectLevelReadQuery.acquireLocksWithoutWaiting()
    In the case of a query it should only be executed against a UnitOfWork where the database TX can be started to maintain the database locks.
    Doug

  • How to implement the shared lock in a  table view

    Hi,
    How to implement the shared lock in a  table view.for multiple users to edit on this same table.
    Thanks in advance
    Swathi

    Hi,
    Please refer this link to find solution to your querry.
    Hope it helps.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c322c690-0201-0010-fb86-811c52b0acc2.
    Regards,
    Rahul

  • How to implement locking in ABAP

    Hello everyone,
        I am doing dialog programming and I have a screen that creates some template. When the user opens up the screen it defualts to next available template number to be created (for example if template No 1 exists then it will default to template no 2 so template 2 will be created). But if multiple users open up the screen then it will show template 2 for both of them and I want to avoid this, i.e. I like to implement some locking mechanism so one user opens up the screen that template is locked and the other cannot create the same template. Please share any ideas and suggestions, how I can imeplement this!
    Thanks.
    Mithun

    Hai  Mithun Dha
    Lock Objects
    The R/3 System synchronizes simultaneous access of several users to the same data records with a lock mechanism. When interactive transactions are programmed, locks are set and released by calling function modules (see Function Modules for Lock Requests). These function modules are automatically generated from the definition of lock objects in the ABAP Dictionary.
    Structure of a Lock Object
    The tables in which data records should be locked with a lock request are defined in a lock object together with their key fields. When tables are selected, one table (the primary table) is first selected. Further tables (secondary tables) can also be added using foreign key relationships (see also Conditions for Foreign Keys).
    Lock Arguments
    The lock argument of a table in the lock object consists of the key fields of the table.
    The lock argument fields of a lock object are used as input parameters in the function modules for setting and removing locks generated from the lock object definition. When these function modules are called, the table rows to be locked or unlocked are specified by defining certain values in these fields. These values can also be generic. The lock argument fields therefore define which subset of the table rows should be locked.
    The simplest case of a lock object consists of exactly one table and the lock argument of the table is the primary key of this table. Several tables can also be included in a lock object. A lock request therefore can lock an entire logical object, and not only a record of a table. Such a logical object can be for example a document comprising an entry in a header table and N entries in a position table.
    Locks can also be set from programs in other systems with the corresponding interfaces if the lock object was defined with RFC authorization.
    A lock mode can be assigned for each table in the lock object. This mode defines how other users can access a locked record of the table.
    Table SFLIGHT in the  flight model contains all the scheduled flights of a carrier. Field SEATSMAX contains the number of seats available. Field SEATSOCC contains the number of seats already booked. If a booking is made for a customer (by a travel agency or sales desk), you must check whether there are enough seats available. The number of seats booked is incremented when the booking is made.
    This mechanism must ensure that two sales desks do not make the same booking at the same time and that the flight is not overbooked.
    This can be done by creating lock object ESFLIGHT. Only the table SFLIGHT must be included in this lock object. The flight can then be locked (with the function modules generated from the lock object) when booking. If another sales desk also wants to book seats for this flight, the lock will prevent the flight from being overbooked.
    Activating a lock object in the ABAP Dictionary automatically creates function modules for setting (ENQUEUE_<lock object name>) and releasing (DEQUEUE_<lock object name>) locks.
    The generated function modules are automatically assigned to function groups. You should not change these function modules and their assignment to function groups since the function modules are generated again each time the lock object is activated.
    Never transport the function groups, which contain the automatically generated function modules. The generated function modules of a lock object could reside in a different function group in the target system. Always transport the lock objects. When a lock object is activated in the target system, the function modules are generated again and correctly assigned to function groups.
    Parameters of the Function Modules
    Field Names of the Lock Object
    The keys to be locked must be passed here.
    A further parameter X_<field> that defines the lock behavior when the initial value is passed exists for every lock field <field>. If the initial value is assigned to <field> and X_<field>, then a generic lock is initialized with respect to <field>. If <field> is assigned the initial value and X_<field> is defined as X, the lock is set with exactly the initial value of <field>.
    Parameters for Passing Locks to the Update Program
    A lock is generally removed at the end of the transaction or when the corresponding DEQUEUE function module is called. However, this is not the case if the transaction has called update routines. In this case a parameter must check that the lock has been removed.
    Parameter _SCOPE controls how the lock or lock release is passed to the update program (see The Owner Concept for Locks). You have the following options:
    _SCOPE = 1: Locks and lock releases are not passed to the update program. The lock is removed when the transaction is ended.
    _SCOPE = 2: The lock or lock release is passed to the update program. The update program is responsible for removing the lock. The interactive program with which the lock was requested no longer has an influence on the lock behavior. This is the standard setting for the ENQUEUE function module.
    _SCOPE = 3: The lock or lock release is also passed to the update program. The lock must be removed in both the interactive program and in the update program. This is the standard setting for the DEQUEUE function module.
    Parameters for Lock Mode
    A parameter MODE_<TAB> exists for each base table TAB of the lock object. The lock mode for this base table can be set dynamically with this parameter. Valid values for this parameter are S (shared), E (exclusive) and X (exclusive but not cumulative).
    The lock mode specified when the lock object for the table is created is the default value for this parameter. This default value can however be overridden as required when the function module is called.
    If a lock set with a lock mode is to be removed by calling the DEQUEUE function module, this call must have the same value for the parameter MODE_<TAB>.
    Controlling Lock Transmission
    Parameter _COLLECT controls whether the lock request or lock release should be performed directly or whether it should first be written to the local lock container. This parameter can have the following values:
    Initial value: The lock request or lock release is sent directly to the lock server.
    X : The lock request or lock release is placed in the local lock container. The lock requests and lock releases collected in this lock container can then be sent to the lock server at a later time as a group by calling the function module FLUSH_ENQUEUE.
    Behavior for Lock Conflicts (ENQUEUE only)
    The ENQUEUE function module also has the parameter _WAIT. This parameter determines the lock behavior when there is a lock conflict.
    You have the following options:
    Initial value: If a lock attempt fails because there is a competing lock, the exception FOREIGN_LOCK is triggered.
    X : If a lock attempt fails because there is a competing lock, the lock attempt is repeated after waiting for a certain time. The exception FOREIGN_LOCK is triggered only if a certain time limit has elapsed since the first lock attempt. The waiting time and the time limit are defined by profile parameters.
    Controlling Deletion of the Lock Entry (DEQUEUE only)
    The DEQUEUE function module also has the parameter _SYNCHRON.
    If X is passed, the DEQUEUE function waits until the entry has been removed from the lock table. Otherwise it is deleted asynchronously, that is, if the lock table of the system is read directly after the lock is removed, the entry in the lock table may still exist.
    Exceptions of the ENQUEUE Function Module
    FOREIGN_LOCK: A competing lock already exists. You can find out the name of the user holding the lock by looking at system variable SY-MSGV1.
    SYSTEM_FAILURE: This exception is triggered when the lock server reports that a problem occurred while setting the lock. In this case, the lock could not be set.
    If the exceptions are not processed by the calling program itself, appropriate messages are issued for all exceptions.
    Reference Fields for RFC-Enabled Lock Objects
    The type of an RFC-enabled function module must be completely defined. The parameters of the generated function module therefore have the following reference fields for RFC-enabled lock objects:
    Parameters
    Reference fields
    X_<field name>
    DDENQ_LIKE-XPARFLAG
    _WAIT
    DDENQ_LIKE-WAITFLAG
    _SCOPE
    DDENQ_LIKE-SCOPE
    _SYNCHRON
    DDENQ_LIKE-SYNCHRON
    All the tables that can be included in a lock object must be linked with  foreign keys. There are a number of restrictions to the valid relationships.
    The foreign key relationships of the tables of the lock object must form a tree. The tables are the nodes of the tree. The links of the tree mean is the check table of.
    The foreign key fields must be key fields of the foreign key table.
    The foreign key relationships defined between the base tables of the lock objects may not have any field that is checked against more than one other field. A field therefore may not occur twice as foreign key field in a relationship and may not be checked against two different fields in two different foreign key relationships.
    You must keep one restriction in mind for  multi-structured foreign keys. If a field is assigned to a field that is outside the check table, the table containing this field must be in a sub-tree that contains the check table of this foreign key relationship as a root.
    These conditions are always satisfied if the key of the foreign key table is an extension of the key of the check table.
    Conditions 2, 3 and 4 are meaningless if the particular foreign key field was excluded from the assignment to the key fields of the check table by  marking it as generic or setting it to a constant. This is also true for multi-structured foreign keys if the foreign key field refers to a table that is not contained in the lock object.
    Regards.
    Eshwar.

  • How to implement the pessimistic locking using toplink with sybase

    we want to allocate the unique primary key to each row when many user try to insert the records concurrently..So what we are trying to do is we calculate the maximum of Primary Key and incremented it by 1. Now we want to Apply the locking concept on the so that unique key will be allocated to each newly inserted row
    Can you please tell me
    1. how we can genrate unique primary key in toplink using sybase?
    2.how to implement the pessimistic or optimistic locking ?which one will be preferable?

    Hi brother
    I think that this link can help you
    http://download-east.oracle.com/docs/cd/A97688_16/toplink.903/b10064/database.htm#1007986
    Good luck

  • How to implement Reentrant Read Write Locking??

    It seems like there should be a ReentrantReadWriteLock in Coherence. Am I missing some basic concept or something?
    Thanks!

    Hi,
    there is no such thing as a shared lock on cache keys in Coherence out-of-the-box, at the moment, but it can be implemented on top of other features (with some performance decrease), but it is a fairly complex task, particularly the continuation of the client thread once the lock is acquired is tricky. Also that approach wouldn't be integrated with Coherence TransactionMap and JCA Adapter features, so in case you need such things you would need to reimplement those on top-of the custom read/write locking solution on your own.
    Best regards,
    Robert

  • How to implement Edit Shared Settings (EDIT_DEFAULTS) mode in Struts jsr

    Could anybody tell me How to implement Edit Shared Settings (EDIT_DEFAULTS) mode in Struts JSr168 portlet?

    Could anybody tell me How to implement Edit Shared Settings (EDIT_DEFAULTS) mode in Struts JSr168 portlet?

  • How to implement a file system in my app?

    How to implement a file system in my app? So that we can connect to my iPhone via Finder->Go->Connect to Server. And my iPhone will show as a shared disk. Any ideas about it? Thanks.

    Hi Rain--
    From webdav.org:
    DAV-E is a WebDAV client for iPhone, with free and full versions. It provides remote file browsing via WebDAV, and can be used to upload pictures taken with the iPhone.
    http://greenbytes.de/dav-e.html
    http://www.greenbytes.de/tech/webdav/
    Hope this helps.

  • How to implement tool-tip for the list items for the Choice column in SharePoint 2013

    I had created a simple list with a "Choice" column, i have three entries in my drop-down, 
    First Entry
    Second Entry
    Third Entry.
    If i select any entries in drop-down and hour-over (Second Entry), a
    tool-tip need need to show. 
    Is it possible? If yes how to implement any help will be appreciated.

    Hi,
    We can use JavaScript to achieve it.
    The following code for your reference:
    <script type="text/javascript" src="/sites/DennisSite/Shared%20Documents/js/wz_tooltip.js"></script>
    <script type="text/javascript" src="/sites/DennisSite/Shared%20Documents/js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript">
    $(function () {
    $("select[title='Choice']").change(function(){
    Tip($(this).val());
    $("select[title='Choice']").mouseout(function(){
    UnTip();
    </script>
    Download wz_tooltip.js:
    http://www.walterzorn.de/en/tooltip/tooltip_e.htm#download
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How to get Caps lock indicator in windows 8.1

    How to get Caps lock indicator in windows 8.1   ???
    i am using wireless keyboard KG 1061

    Hi bhargav0,
    I understand you would like a caps lock indicator in Windows 8.1. I admit, I don't know of any fix that simply shows you on the screen, but there is an auditory warning that you can implement if that would be of help to you. Take a look at the following video, Windows® 8.1: Make the Caps Lock key beep when pressed. I hope this will be of use to you. Have a great day.
    Ryan1216
    I work on behalf of HP
    The advice and opinions given here are my own and not those of HP

  • How to mute and lock screen rotation at the same time? Loved this feature in iOS 5.

    How to mute and lock screen rotation at the same time? Loved this feature in iOS 5.

    You cannot do two different simultaneous VISA writes over a serial bus. There is a single rx line on the pc's com port and a single rx line on the instrument. You only hope is if the instrument allows you to chain commands and the reception of the carriage return triggers the instrument to implement both at the same time. Maybe you can send CTS01 and CTS02 separated by a space or comma. The manual should tell you if that's possible or maybe you need to ask the manufacturer.

Maybe you are looking for

  • How can i sync my iphone to a new computer without restoring settings and deleting everything?

    I've just gotten a new desktop computer and I'd love to have my iPhone synced to it...but I cannot do that without "restoring" settings or erasing my current library to sync to this new library. The problem is I have absolutely nothing on this new co

  • WCEM30 Basket checkout error

    Hi Experts, I'm working on a new WCEM 3.0 implementation and get a strange error.  The installation is using SAP ECC as a backend, and we are using SAP ECC 5.0 SP9. WCEM is installed on a NW 7.3 SP8. Products can be added to the shopping basket, but

  • Writing a query to count entries for all tables

    I'd like to write a query to count the number of rows in every table for a given database. For example, if I have two tables in a database called TEST1 and TEST2 with 20 and 30 rows respectively, I'd like the output of the query to be TABLE_NAME     

  • Forms10g+JRE: minimize IE window after logon

    Dear professionals, is there anyway to programmatically minimize internet explorer (or firefox) window after user logon to application (except manually, of course :) )? We use JRE instead Jinitiator and property separate_window=true. Since users some

  • Please tell me How to access the COS NAMING?

    In COS Naming, I create a new context as follows: Initial context | QuerryApp (a new Context) | OrderQuery (a object) But I don't know how to access the "OrderQuery"(using jdk 1.3.1). Please help me!! email: [email protected]