How to release an exclusive lock

Hi,
I don't know, how to release a lock, after locking exclusive.
We're locking our BOPF Object like this:
o_task_srv_mngr->retrieve(
        exporting
          iv_fill_data            = abap_false
          iv_node_key             =  /cenitapm/if_bo_pw_task_c=>sc_node-pwtsk  " Node
          it_key                  =   t_key  " Key Table
          iv_edit_mode            = /bobf/if_conf_c=>sc_edit_exclusive
        importing
          eo_message              = o_message
Now how do I release the lock again?
I know, It is released after a save of the transaction manager, but how do i achieve an unlocking without that save?
Regards David

After some investigation, I came to following result:
Locks are released on commit or rollback.
So if I want to release an exclusive lock, I have to rollback everything in the current session.
After feeling limited by this design in the first place, I now think, this is a great way to secure my data integrity.
I only want to release an exclusive lock if I don't want to save my data, or if I want to save it ;)
I just have to ensure, all data not belonging to the actual transaction is saved before setting an exclusive lock to another object.
So thumbs up for the designer of this concept.

Similar Messages

  • How to release  transaction lock on a table

    Dear
    can you please let me konw how to release a transaction lock on a table.
    thanks
    VIJAY

    I thought of a more traditional method
    http://www.stephstuff.com/esafe/images/ouch2.gif
    Laurent, You've read my mind :) or vice-versa

  • How and when the database release a row lock?

    Dear experts,
    We are using the following statement to obtain a row lock in a table in the database(ORACLE of course),
    SELECT * FROM {TABLE_NAME} WHERE ID = 1 for update
    and if we succeed grabbing the row lock we will continue to issue a update statement every 30 seconds to preserve the lock as far as possible.
    here is the update statement to preserve the lock,
    UPDATE {TABLE_NAME} SET time = ? WHERE ID = 1.
    As you see more longer we keep holding the row lock , more update statements are submitted in the pending transaction.
    In normal case our application can grab the exclusive row lock and works for a long time,however sometimes a connection reset exception is thrown
    and our application will close the connection(I assume the pending transaction will be rolled back by the database) and exit the JVM.
    Since other applications will keep trying to grab the same row lock to become the master role,
    we expect one of them can succeed but they are all failed because the database has not released the row lock as expected.
    Can someone explain more details about how and when the row lock can get released in our use case?
    Thanks,
    SuoNayi
    Edited by: SuoNayi on 2013-5-30 上午8:12

    Hm. Is this part of an XA transaction by any chance? I know that Oracle maintains separate bookkeeping for such transactions which can cause rows to stay 'locked' even when the regular DBA views will indicate there is no user currently locking the record at all. I have no idea about the actual details and what you need to do to clean up such a situation, that is something a DBA should know and do.
    If not... well this is more of a question for people who know the DBMS, which makes it a target for the Oracle DBMS forums. Java developers don't tend to have DBA-level knowledge of the database, you should ask the question where you have more chance of people with expertise answering stuff:
    General Database Discussions

  • IllegalStateException thread tries to release exclusive lock LockingManager

    Hello,
    I'm having this error,
    java.lang.IllegalStateException: Illegal state: thread tries to release exclusive lock on ApplicationSession which it hasn't acquired! Details: LockingManager(ThreadID:89, threadName: HTTP Worker @1298613650, session lock: null, current request: company.com.pe/wd_hrsolmovpil_v1/Wdhrsolmovpilv1)
    Any of my web dynpros, even the uwl doesn't work.
    This happened after I tried to deploy project. Everything was working fine, but now ... I have this. I've restarted the server, but nothing happens.
    Please, anyone knows how to solve this? Any ideas?
    Regards
    SU

    Hello,
    The problem was because the WAS has the parameter DefaultExpirationTime seted in -1 of all the Web Dynpros (sap.com/tcwddispwda). It only accepts positive values. I had to login through Telnet and execute the parameter,
    add webdynpro
    MANAGE_WD_APP_PROPS sap.com/tcwddispwda
    Thanks & Regards
    SU

  • How to release row lock by using jdbc

    hi, currently we are using jdbc to create a connection and create a row lock , is there anyway to release the row lock? right now i am using resultset.close(), but this cause me problem since it release other resultset's row lock too. please help.

    hi, from your post, i understood that u know how to do row locking..
    How was it done ??
    I'm currently looking for answer to do row locking in Microsoft Access...
    These are the SQL stmt i've done without success..
    SELECT * FROM BSPerson WITH UPDLOCK WHERE ID = 'P001';
    SELECT * FROM BSPerson WHERE ID = 'P001' FOR UPDATE;
    Both stmt having error........
    Please help !
    A miliion thanks....

  • My new ipod touch 4G shows lock symbol, how to release?

    My new ipod touch bought from USA showing lock symbol and connect to itunes symbol, how to release the lock, please help me any one

    You said it was new. Before you can use a new iPod you have to connect it to a computer with internet service and iTunes installed and activate the iPod. It sounds like that is what you iPod is tell you to do. It appears you are seeing an iTunes symbol and USB cable on your iPod.

  • How to release table locks?

    I was running Data Services (4.0 SP2) to load data into Hana (1.0 SP2 patch 20) using the Bulk load option. Apparently, the DS process hung and now the table I was writing to is locked although the DS Job is dead. How do you release the table lock without restarting Hana DB?

    Hello Sachin,
    you could try these statements. The first one will cancel the currently executed operation, the second one will disconnect the idle session:
    ALTER SYSTEM CANCEL SESSION session_id;
    ALTER SYSTEM DISCONNECT SESSION session_id;
    Regards,
    Mark

  • How to release lock for TP?

    Hi,
    can any one pls tell me how to release lock for TP

    Hey Raja
    Can you be more specific of what is TP?
    Btw, there is a transaction called SM12 where we can lock unlock entries of table or transactions. Check if that can help.
    Kind Regards
    Eswar

  • How to release the Change request (Task in Repair Mode)

    Hello everybody,
    I have change request in that one Task in Repair mode.
    when i trying to release, it give the error message like
    Repair HRDK900911 may only contain repaired objects
    Diagnosis
    In repairs, you can only lock and edit those objects whose original exists in another SAP System.
    The object R3TR PROG /VWK/GPS_VCD_R was found in the object list of your repair HRDK900911. This object is not a copy but the original.
    So please suggest me
    How to release the Task (Repair) so I can release  the request.
    Thanks

    Yes you wont be able to release the request till you remove the flag from SE03.
    Goto SE03 > Display Repaired Objects
    Select Your object and remove the repair flag from top <Repair Flag>
    R3TR PROG <Your Object>
    Also as you are getting an error
    No valid change license available for namespace
    In SE03-->Display/change Namespace
    when I check the specified Namespace then their is no Repair License.
    So please suggest me Repair License is required?
    check what namespace it is refrerring to ... A namespace name should be there....
    1. Go to SE06 and click on the System Change Option.
    2. Verify that Namespace Systems Development  /Namespace/  is "Modifiable".
    or
    1. Run transaction SM30
    2. Enter V_TRNSPACE
    2. Click Maintain
    3. Double Click on Namespace /NAMESPACE/
    4. Change Namespace role from P to C, then hit Save
    All the best !
    Edited by: prateek_y on Aug 30, 2010 3:21 PM

  • How to Remove svn:needs-lock property in subversion

    Hi All:
    I am having problems with subversion and JDeveloper. We were using TortoiseSVN in 10g, and I am trying to exclusively use JDeveloper svn in 11g (11.1.1.4). We have a common business components .jar file that defines all our entities and allows everyone to use these entities already defined.. After losing a bunch of entities through a mistaken delete, we put the svn:needs-lock property on all the entity definitions of this .jar file. The problem appears to be that JDeveloper svn does not lock the assoc.xml file even when I lock the upper levels, which prevents me from changing names and organizing by function our associations. This leads to question #1, is this a known issue? The assoc.xml file is not visable through JDeveloper 11.1.1.4, so I cannot manually lock it.
    So I am wanting to remove the property svn:needs-lock from the entities so that I can use JDeveloper svn since we have discovered that there is a problem using JDeveloper svn with TortoiseSVN. Files seem to become corrupt. This leads to question#2, Does anyone know how to remove the svn:needs-lock property using JDeveloper snv?
    When I display the properties, there is no remove functionality, just "delete". When I click on delete, I am asked if I want to delete the ENTITY and all its files. That is not what I want to do. I know how to delete svn:needs-lock in TortoiseSVN, but hoped to do it in JDeveloper. Is there a way, or is this functionality missing from JDeveloper SVN?
    Mary
    UofW

    Hi:
    Thank you for your response...after using both TortoiseSVN and JDeveloper svn, I have found that neither one handles locking properly. Even though the functionality is in both, there are a variety of problems that I have run across that have wasted an awful lot of my time. It really shouldn't take an entire day to commit something to a repository, but that is what I have found to be the case because of all the problems I am running into. Perhaps now that I have removed the locking, things will be simpler. And I did use TortoiseSVN to remove the svn:needs-lock property from the files.
    I prefer to use JDeveloper svn since the tool integration with svn has worked better for us with the automatic filtering, etc.
    I was hoping to get a response from one of the JDeveloper 'aces' as to whether it is a known problem that the assoc.xml file doesn't get locked and cannot get locked manually in JDeveloper svn AND is someone at JDeveloper aware that there appears to be no way to remove svn properties after they are added on a file....
    ....Any aces out there reading this forum?
    Mary
    UofW

  • GTT table getting Row Exclusive lock

    I have a procedure which loads a table which is used for reporting.
    Currently it is a single process which picks up most of the data after joining 2-3 big tables(around 70-80GB) and then loading the main table.
    The joins are on PI and also partitions are also being used. Then a lot of updates are done on the main table to update other columns which are being picked from different tables.
    As the processing is happening on huge amount of data(around 1M), so processing is taking a lot of time.
    This process is taking around 40-45 minutes.
    I am planning to use parallelism to run it in 75 sessions. So the initial big insert will be faster and later on all the updates will be done on smaller chunks which will benefit the performance.
    I planned to use GTT table so that i dont have to create 75 temp tables for each sessions.
    But while using GTT table(ON COMMIT DELETE ROWS) in parallel sessions, i am seeing that the GTT table is getting Row Exclusive lock and the time taken by overall process is increasing by lot.
    So i tested by using 75 temp tables. There i saw that the performance has increased by lots as assumed initially.
    Please let me know if there is any other way or how to remove the locks on GTT table.

    First you should question why you think you need 75 GTT.
    Also your question contains no useful information
    (no four digit version of Oracle, no OS, no number of processors) , this paragrah
    Currently it is a single process which picks up most of the data after joining 2-3 big tables(around 70-80GB) and then loading the main table.
    The joins are on PI and also partitions are also being used. Then a lot of updates are done on the main table to update other columns which are being picked from different tables.
    As the processing is happening on huge amount of data(around 1M), so processing is taking a lot of time.
    This process is taking around 40-45 minutes.tells nothing,
    so basically your questions boils down to
    - Hey I come from a sqlserver background (this is just an educated guess), how can I find a workaround to wreck Oracle to make it work like sqlserver.
    75 parallel sessions on say 4 to 8 processors is a very bad idea, as these sessions will be simple competing for resources.
    Also a row exclusive lock is just that: a row level lock. This isn't a problem, usually.
    Sybrand Bakker
    Senior Oracle DBA

  • UnitOfWork doesn't release pessimistic row lock???

    I have an application that polls a DB table for new "submissions", then forwards them to another server to handle them asynchronously. When the asynchronous response comes back, my application verifies that all response have been received from the server, then sends a combined response. My problem is that the asynchronous response listener threads appear to deadlock when pessimistically locking the submission row, even though the transaction that locked it has been closed for ~1s.
    Some psuedocode may help explain the problem. This is my DB polling thread
    while( true ) {
    Submission s = getNextSubmissionAndLockPessimistically();
    if( s == null )
    return null;
    Server s2 = getServerCapableOfRunning( s );
    if( s2 != null )
    return s2;
    uow.revertAndResume();
    I am worried that in the instance that a server capable of running the submission could not be found, or is too full, the UnitOfWork#revertAndResume method does not release the row lock for the submission. Are there any scenarios where this can occur?
    On another note, I occasionally receive "Query sent to unactivated UnitOfWork" exceptions during the uow.revertAndResume() call. My code only uses the first UnitOfWork returned by EntityManager#getUnitOfWork(). Could the two be related? Does anyone have any ideas on how to fix this exception?
    Thanks,
    Dan

    Thank you for the detailed description of how the locks are released; I mistakenly assumed the revertObject/revertAndResume would release them. I will refactor my code to create EntityManager/UnitOfWork instances in loop and release/close them instead of reverting.
    As for the "unactivated UnitOfWork" exception, here is one of my stack traces:
    Exception [TOPLINK-6027] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.QueryException
    Exception Description: Query sent to a unactivated UnitOfWork.
    Query: ReadAllQuery(my.package.ServerLimits)
    at oracle.toplink.essentials.exceptions.QueryException.querySentToInactiveUnitOfWork(QueryException.java:893)
    at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2217)
    at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:937)
    at oracle.toplink.essentials.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:86)
    at oracle.toplink.essentials.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:76)
    at oracle.toplink.essentials.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:90)
    at oracle.toplink.essentials.indirection.IndirectList.buildDelegate(IndirectList.java:193)
    at oracle.toplink.essentials.indirection.IndirectList.getDelegate(IndirectList.java:315)
    at oracle.toplink.essentials.indirection.IndirectList.size(IndirectList.java:640)
    at oracle.toplink.essentials.internal.queryframework.CollectionContainerPolicy.sizeFor(CollectionContainerPolicy.java:184)
    at oracle.toplink.essentials.internal.indirection.TransparentIndirectionPolicy.getRealAttributeValueFromObject(TransparentIndirectionPolicy.java:252)
    at oracle.toplink.essentials.mappings.ForeignReferenceMapping.getRealAttributeValueFromObject(ForeignReferenceMapping.java:370)
    at oracle.toplink.essentials.mappings.CollectionMapping.getRealAttributeValueFromObject(CollectionMapping.java:559)
    at oracle.toplink.essentials.mappings.CollectionMapping.getRealCollectionAttributeValueFromObject(CollectionMapping.java:574)
    at oracle.toplink.essentials.mappings.CollectionMapping.mergeIntoObject(CollectionMapping.java:734)
    at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.mergeIntoObject(ObjectBuilder.java:2114)
    at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.mergeIntoObject(ObjectBuilder.java:2096)
    at oracle.toplink.essentials.internal.sessions.MergeManager.mergeChangesOfOriginalIntoWorkingCopy(MergeManager.java:450)
    at oracle.toplink.essentials.internal.sessions.MergeManager.mergeChanges(MergeManager.java:251)
    at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.revertAndResume(UnitOfWorkImpl.java:3527)
    at my.package.DbInterface.getNextSubmissionAndServer(DbInterface.java:460)
    at my.package.PollingThread.waitForNextSubmission(PollingThread.java:175)
    at my.package.PollingThread.run(PollingThread.java:122)
    This particular error could be related to the DB lock obtained on the Server object, which has a One-To-Many relationship to the ServerLimits.
    However, there is another exception that I am worried about:
    Exception [TOPLINK-6027] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.QueryException
    Exception Description: Query sent to a unactivated UnitOfWork.
    Query: ReadAllQuery(my.package.Submission)
    at oracle.toplink.essentials.exceptions.QueryException.querySentToInactiveUnitOfWork(QueryException.java:893)
    at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2217)
    at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:937)
    at oracle.toplink.essentials.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:86)
    at oracle.toplink.essentials.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:76)
    at oracle.toplink.essentials.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:90)
    at oracle.toplink.essentials.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(UnitOfWorkValueHolder.java:160)
    at oracle.toplink.essentials.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:232)
    at oracle.toplink.essentials.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:90)
    at oracle.toplink.essentials.indirection.IndirectList.buildDelegate(IndirectList.java:193)
    at oracle.toplink.essentials.indirection.IndirectList.getDelegate(IndirectList.java:315)
    at oracle.toplink.essentials.indirection.IndirectList.add(IndirectList.java:140)
    at my.package.db.Transaction.addSubmission(Transaction.java:422)
    at my.package.DbInterface.createNewSubmission(DbInterface.java:284)
    at my.package.EngineInterface.executeObjectFn(EngineInterface.java:446)
    at my.package.EngineInterface.executeBooleanFn(EngineInterface.java:412)
    at my.package.EngineInterface.search(EngineInterface.java:252)
    at my.package.mdb.RequestListenerBean.onMessage(RequestListenerBean.java:457)
    at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
    at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
    at com.evermind.server.ejb.interceptor.system.SetContextActionInterceptor.invoke(SetContextActionInterceptor.java:44)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
    at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
    at oracle.j2ee.connector.messageinflow.MessageEndpointImpl.OC4J_invokeMethod(MessageEndpointImpl.java:297)
    at RequestListenerBean_EndPointProxy_44242m8.onMessage(Unknown Source)
    at oracle.j2ee.ra.jms.generic.WorkConsumer.run(WorkConsumer.java:268)
    at oracle.j2ee.connector.work.WorkWrapper.runTargetWork(WorkWrapper.java:242)
    at oracle.j2ee.connector.work.WorkWrapper.doWork(WorkWrapper.java:215)
    at oracle.j2ee.connector.work.WorkWrapper.run(WorkWrapper.java:190)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:819)
    at java.lang.Thread.run(Thread.java:595)
    The code that caused this error is about as simple as it can get:
    EntityManager em = (EntityManager) emf.createEntityManager();
    UnitOfWork uow = em.getUnitOfWork();
    try
    // locate owning transaction and the RECEIVED_FROM_ESB type
    Transaction tx = locate( Transaction.class, em, uow, txId );
    ServerFunction fn = locate( ServerFunction.class, em, uow, fnId );
    TrackingType trackingType = locate( TrackingType.class, em, uow, TrackingType.RECEIVED_FROM_ESB );
    // create submission
    Submission submission = new Submission();
    submission.setPriority( priority );
    submission.setRequestId( requestId );
    submission.setNistId( nistId );
    submission.setFunction( fn );
    // create RECEIVED_FROM_ESB tracking status
    TrackingStatus status = new TrackingStatus();
    status.setTrackingType( trackingType );
    status.setStatusTime( new Timestamp( System.currentTimeMillis() ) );
    submission.addTrackingStatus( status );
    tx.addSubmission( submission );
    em.persist( submission );
    uow.commit();
    em.close();
    return submission.getId();
    finally
    if( uow.isActive() )
    uow.release();
    if( em.isOpen() )
    em.close();
    There is a One-To-Many mapping from Transaction to Submission, and a One-To-Many mapping from Submission to TrackingStatus.
    If anyone can offer any insight into what I'm doing wrong, I'd appreciate it!
    Thanks,
    Dan

  • Read exclusive lock  FileInputStream

    I would like to read a object from a file , how can it lock the file or read the file as exclusive lock?

    FileInputStream.getChannel().lock()when this method is called, does that ensure that no other application, java or otherwise can open/delete this file?

  • BAPI_TRANSACTION_COMMIT is releasing all the locks which aren't intended to

    Hi All,
    I have created a GR using BAPI "BAPI_GOODSMVT_CREATE"  and then the changes are commited using BAPI_TRANSACTION_COMMIT. And this is releasing all the locks which were not intended to GR.
    Please help me how to retain the locks.
    regards,
    Prasad GLN.

    Thanks for the reply
    The problem is like is have locked the program for a process order, after creating GR
    BAPI_TRANSACTION_COMMIT is releasing the program lock, there is some other updates i need to do after GR.
    As program lock is released its now allowing the program for the same process order.
    Regards,
    Prasad.

  • Monitor exclusive lock on a table and send notification email through EM

    Hi,
    I have Oracle10g and EM10G running on different servers.
    now one of my plsql code creates an exclusive lock on one of my tables.
    i want to monitor this exclusive lock on this table through the EM. and when the exclusive lock on the table is continuing for more than 1 hour, i want an email notification sent to me by the EM.
    How can i do this?
    Can someone help me achieve this above situation.
    Thanks.
    Philip.

    One of the nice about OEM is that a lot of the things are self explanatory. E.g. I never read docs to set up our first user defined metrics. It is really just to dive in there. Define a metric and the sql you want to use for monitoring the lock. Then you just go and create email notification for this when it hits warning or critical treshold.

Maybe you are looking for

  • Urgent!!!  checking a text file!

    Hello, I have a text file with some info in it. How do you cross-reference some text inside the text file with out importing the text file into a String??? example: File myFile = new File(/file.txt); // inside myFile contains the text: "the sun is gr

  • Post a mail on a particular date

    We have developed a site for a greeting shop.. Here we have few sanple cards to be send on an occassion. The problem here is, we need to send a mail on some other day(day selected by him - greater than today) automatically. like in greetings.yahoo.co

  • Usage of Bapi_Transaction_Commit?

    Sorry for not noticing that it is an ABAP Programming forum. Hi, How can I use Bapi_Transaction_Commit in conjunction with a standard BAPI_A( for e.g) in webdynpros? wdContext.currentBAPI_AElement.modelobject.execute(); The above source code would im

  • Making website universal no matter what program your viewing it on

    I have created a website for my church and I burned it to a cd to view before i publish it. When I open index.html it only opens the home page and does not show any links to other pages at the top. To view the other pages I have to open each site.htm

  • Is there any way to change IPTC metadata in psb files?

    I created an file by combining a number of images into a panorama. As is expected, the panorama picked up the IPTC metadata from one of the source images, and saved it into the resulting file. If I had saved the file as a psd or tiff, I could easily