Database locking

Hi all,
I have developed web application by oracle forms and connected with oracle 10g database.
Sometimes, User advised get notification to retry when edit record due to another user edited same record before but no commit.
can u help me that how to control ideal locking of database or config better than above for above situation ?
Besides, 11gR2 have new feature to enhance database locking ? How to do ?
tks a lot
Best Regards
Boris

borisys wrote:
I have developed web application by oracle forms and connected with oracle 10g database.
Sometimes, User advised get notification to retry when edit record due to another user edited same record before but no commit.A web application has stateless clients. This means that no client state exists in the database for the client. Therefore default database locking (called pessimistic locking) cannot be used.
You need to instead manually implement optimistic locking.
This means that rows are not locked in the database (using pessimistic db locks). Before an update of a row, the existing row needs to be checked against the original row that the web client has updated. If the database row is still the same, it means that the update can go ahead. If it is different, it means that another session has changed the row in the meantime.
There are a number of methods to use to implement optimistic locking - depending on the structure of the data and features of the database.
Keep in mind that this is not a database issue. The database supports locking just fine. But the clients do not as the clients have no state and thus locks cannot persist for the duration of that client's interaction with the database. With a web client, each and every time the client issues database requests, these are seen as brand new sessions and brand new requests by the database.
Optimistic locking is implemented in the application layer. Pessimistic locking exists in the database layer.

Similar Messages

  • Re: what is difference between sap locking and database locking

    hi,
        what is difference between sap locking and database locking. Iam locked the table mara by using lock objects.
    But iam unable to unlock the mara table. I give u the coding. Please check it.
    REPORT zlock .
    CALL FUNCTION 'ENQUEUE_EZTEST3'
    EXPORTING
       MODE_MARA            = 'S'
       MANDT                = SY-MANDT
       MATNR                = 'SOU-1'.
    call transaction 'MM02'.
    CALL FUNCTION 'DEQUEUE_EZTEST3'
         EXPORTING
              mode_mara = 'E'
              mandt     = sy-mandt
              matnr     = 'SOU-1'.
    IF sy-subrc = 0.
      WRITE: 'IT IS unlocked'.
    ENDIF.

    Hi Paluri
    Here is the difference between SAP locks and Database locks, i will try to find the solution to your code.
    Regards
    Ashish
    Database Locks: The database system automatically sets database locks when it receives change statements (INSERT, UPDATE, MODIFY, DELETE) from a program. Database locks are physical locks on the database entries affected by these statements. You can only set a lock for an existing database entry, since the lock mechanism uses a lock flag in the entry. These flags are automatically deleted in each database commit. This means that database locks can never be set for longer than a single database LUW; in other words, a single dialog step in an R/3 application program.
    Physical locks in the database system are therefore insufficient for the requirements of an R/3 transaction. Locks in the R/3 System must remain set for the duration of a whole SAP LUW, that is, over several dialog steps. They must also be capable of being handled by different work processes and even different application servers. Consequently, each lock must apply on all servers in that R/3 System.
    SAP Locks:
    To complement the SAP LUW concept, in which bundled database changes are made in a single database LUW, the R/3 System also contains a lock mechanism, fully independent of database locks, that allows you to set a lock that spans several dialog steps. These locks are known as SAP locks.
    The SAP lock concept is based on lock objects. Lock objects allow you to set an SAP lock for an entire application object. An application object consists of one or more entries in a database table, or entries from more than one database table that are linked using foreign key relationships.
    Before you can set an SAP lock in an ABAP program, you must first create a lock object in the ABAP Dictionary.

  • Database locks in OBPM 10gR3

    Environment:
    Oracle BPM 10gR3 Version: 10.3.1.0.0 Build: #99954
    WebLogic Server 10.0 MP1 Clustered domain
    JDBC Driver - WebLogic Type 4 XA ( weblogic.jdbcx.oracle.OracleDataSource )
    We have a BPM project deployed on the WLS 10.0 MP1 Cluster,which was running fine for the last 18 months. But all of a sudden we are experiencing the database locks errors for the last few days, when we try to restart the BPM Engine.
    WebLogic JTA Timeout = 30 seconds
    Database Distributed_Lock_Timeout = 60 seconds
    WebLogic Datasources for Directory and Engine XA Connection Timeout = 30 seconds
    Error
    Process '/Test#Default-1.0' could not be started. Details:\nProcess execution engine execution error.
    Caused by: Exception [java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-02049: timeout: distributed transaction waiting for lock ].
    Caused by: [BEA][Oracle JDBC Driver][Oracle]ORA-02049: timeout: distributed transaction waiting for lock
    fuego.papi.impl.EngineExecutionException: Process execution engine execution error.
         at fuego.server.execution.DefaultEngineExecution.executeImmediate(DefaultEngineExecution.java:139)
         at fuego.server.execution.DefaultEngineExecution.executeImmediate(DefaultEngineExecution.java:79)
         at fuego.server.execution.DefaultEngineExecution.executeWithoutComponentImmediate(DefaultEngineExecution.java:185)
         at fuego.server.execution.EngineExecution.executeWithoutComponentImmediate(EngineExecution.java:86)
         at fuego.ejbengine.service.EJBActiveProcessService.startProcess(EJBActiveProcessService.java:92)
         at fuego.server.service.ActiveProcessService.runProcessesLoader(ActiveProcessService.java:118)
         at fuego.server.service.ActiveProcessService.activateProcesses(ActiveProcessService.java:88)
         at fuego.ejbengine.service.EJBActiveProcessService.doActivateProcesses(EJBActiveProcessService.java:63)
         at fuego.ejbengine.cluster.DistributedEJBActiveProcessService.initialize(DistributedEJBActiveProcessService.java:37)
         at fuego.ejbengine.cluster.ClusterObjectFactory.initializeActiveProcessService(ClusterObjectFactory.java:33)
         at fuego.ejbengine.Engine.startServices(Engine.java:448)
         at fuego.ejbengine.Engine.start(Engine.java:129)
         at fuego.ejbengine.servlet.AbstractSchedulerServlet.init(AbstractSchedulerServlet.java:91)
         at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:282)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:63)
         at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
         at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
         at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:507)
         at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1853)
         at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1830)
         at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1750)
         at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2909)
         at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:973)
         at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:361)
         at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
         at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
         at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
         at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
         at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
         at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
         at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:26)
         at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
         at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
         at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
         at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
         at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:182)
         at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:359)
         at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
         at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:196)
         at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
         at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)
         at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
         at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
         at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
         at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
         at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
    Caused by: fuego.directory.DirectoryRuntimeException: Exception [java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-02049: timeout: distributed transaction waiting for lock ].
         at fuego.directory.DirectoryRuntimeException.wrapException(DirectoryRuntimeException.java:85)
         at fuego.directory.provider.jdbc.oracle.OraclePersistenceManager.mapSQLException(OraclePersistenceManager.java:183)
         at fuego.directory.provider.jdbc.datadirect.oracle.DataDirectOraclePersistenceManager.mapSQLException(DataDirectOraclePersistenceManager.java:50)
         at fuego.directory.provider.jdbc.JDBCServiceAccessor.mapSQLException(JDBCServiceAccessor.java:78)
         at fuego.directory.provider.jdbc.JDBCProcessAccessor.updateDeployedProcess(JDBCProcessAccessor.java:1330)
         at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at fuego.directory.provider.DirectorySessionImpl$AccessorProxy.invoke(DirectorySessionImpl.java:756)
         at $Proxy57.updateDeployedProcess(Unknown Source)
         at fuego.directory.DirDeployedProcess.update(DirDeployedProcess.java:1022)
         at fuego.server.ActiveProcessManager.handleProcess(ActiveProcessManager.java:496)
         at fuego.server.service.ActiveProcessService.startProcess(ActiveProcessService.java:136)
         at fuego.ejbengine.service.EJBActiveProcessService.startProcessImpl(EJBActiveProcessService.java:107)
         at fuego.ejbengine.service.EJBActiveProcessService.access$100(EJBActiveProcessService.java:32)
         at fuego.ejbengine.service.EJBActiveProcessService$2.execute(EJBActiveProcessService.java:95)
         at fuego.server.execution.DefaultEngineExecution$AtomicExecutionTA.runTransaction(DefaultEngineExecution.java:304)
         at fuego.transaction.TransactionAction.startBaseTransaction(TransactionAction.java:470)
         at fuego.transaction.TransactionAction.startTransaction(TransactionAction.java:551)
         at fuego.transaction.TransactionAction.start(TransactionAction.java:212)
         at fuego.server.execution.DefaultEngineExecution.executeImmediate(DefaultEngineExecution.java:123)
         ... 52 more
    Caused by: java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-02049: timeout: distributed transaction waiting for lock
         at weblogic.jdbc.base.BaseExceptions.createException(Unknown Source)
         at weblogic.jdbc.base.BaseExceptions.getException(Unknown Source)
         at weblogic.jdbc.oracle.OracleImplStatement.execute(Unknown Source)
         at weblogic.jdbc.base.BaseStatement.commonExecute(Unknown Source)
         at weblogic.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
         at weblogic.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
         at weblogic.jdbcx.base.BasePreparedStatementWrapper.executeUpdate(Unknown Source)
         at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:125)
         at fuego.jdbc.FaultTolerantPreparedStatement.executeUpdate(FaultTolerantPreparedStatement.java:623)
         at fuego.directory.provider.jdbc.JDBCPersistenceManager.update(JDBCPersistenceManager.java:946)
         at fuego.directory.provider.jdbc.JDBCProcessAccessor.updateDeployedProcess(JDBCProcessAccessor.java:1327)
         ... 68 more

    Hello -
    Following is the Oracle recommendation for BPM timeouts. Now you can try this.
    Increase the timeout:
    -in the Oracle Weblogic console go to Services -> JTA -> Timeout Seconds . Set the value to 300.
    also the DISTRIBUTED_LOCK_TIMEOUT value for BPM should follow the following formula:
    DISTRIBUTED_LOCK_TIMEOUT >= XA Transaction Timeout >= WebLogic Server JTA timeout
    This means that the configured "DISTRIBUTED_LOCK_TIMEOUT" value should be equal to or
    larger than the "XA Transaction Timeout" value which in turn should be equal to or larger than the "WebLogic Server JTA timeout".
    Note : Check your previous BPM Engine logs, you can see the timeout warning.
    BR,
    Justin.

  • Database Locks not working

    Hello!
    I am having some problems with the Berkley DB XML Locking System. My database is configured as follows:
         _envConfig = new EnvironmentConfig();
         _envConfig.setRunFatalRecovery(doFatalRecovery);
         _envConfig.setRunRecovery(!doFatalRecovery);
         _envConfig.setVerboseRecovery(true);
         _envConfig.setAllowCreate(true);         
         _envConfig.setCacheCount(1);
         envConfig.setCacheSize(DBCACHE_SIZE * 1024 * 1024);
         _envConfig.setInitializeCache(true);            
         _envConfig.setTransactional(true); 
         envConfig.setMaxLocks(MAXLOCKS);
         envConfig.setMaxLockers(MAXLOCKERS);
         envConfig.setMaxLockObjects(MAXLOCKOBJECTS);
         // enable locking
         _envConfig.setInitializeLocking(true);
         _envConfig.setLockTimeout(50000000);
         logInfo("Database locking enabled.");
         // Configure db to perform deadlock detection internally, and to
    // choose the transaction that has performed the least amount
    // of writing to break the deadlock in the event that one
    // is detected.
    _envConfig.setLockDetectMode(LockDetectMode.MINWRITE);
    Then I try to modify one object in my first thread:
    xmlTransaction = xmlManager.createTransaction();               
                   xmlContainer = xmlManager.openContainer( xmlTransaction, _collection);
                   context = xmlManager.createQueryContext(XmlQueryContext.LiveValues, XmlQueryContext.Eager);               
                   // Declare the read/modify/write cycle
              XmlDocumentConfig docConfig = new XmlDocumentConfig();
              docConfig.setLockMode(com.sleepycat.db.LockMode.RMW);
                   XmlQueryExpression xmlQueryExprDocs = _xmlManager.prepare( xmlTransaction, sQuery, xmlQueryContext);
         results = xmlQueryExprDocs.execute( xmlTransaction, _context, docConfig);            
         xmlQueryExprDocs.delete();     
         // document(s) found - create modify, update objects
         * Iterate over _result documents
         while (_results.hasNext()) {
                        modify = xmlManager.createModify();
                        updateContext = xmlManager.createUpdateContext();               
              docValue = _results.next();                  
              xmlDoc = docValue.asDocument();
              numMod = modify.execute(xmlTransaction, docValue, context, updateContext);                    
    In my second thread I try to read the same object:
    xmlTransaction = _xmlManager.createTransaction(null, cfg);     
    XmlContainer xmlContainer = getXmlManager().openContainer(xmlTransaction, sContainer, contConfig);
    context = _xmlManager.createQueryContext(XmlQueryContext.DeadValues, XmlQueryContext.Eager);             
    xmlQueryExpr = _xmlManager.prepare( xmlTransaction, sQuery, xmlQueryContext);
         results = xmlQueryExpr.execute( context);
    And then instead of waiting on the first object to unlock the database just logs:
    Transaction that opened the DB handle is still active
    I just want the db to wait until the modify is ready and then do the query in the second thread.
    What am I doing wrong?
    Thanks for your help!
    Edited by: user11285545 on 19.06.2009 04:18

    Hello,
    I think you want to post this to the [Db XML forum|http://forums.oracle.com/forums/forum.jspa?forumID=274] instead of the BDB JE forum.
    Charles Lamb

  • Unwanted Database Lock when using CAF BO method 'update'

    Hi all
    We are using the Composite Application Framework (CAF), and Business Objects (BOs) to save data on the database. A service call is using a BO ‘Update’ method as follows:
    _location.debugT("Test debug line 4");
    getBOSalesDataService().update(salesData);
    _location.debugT("Test debug line 5");
    The same method is then called by another service, while the first service is still active. It does not error, but it waits until the first service has timed out. You can see this from the following screenshot:
    I think this is because the first service sets a lock on the SQL database. This is not an explicitly coded lock, but a database lock. I’ve tried using the following statement:
    getBOSalesDataService().unlock(salesData.getKey(), IBusinessObjectNodeServiceBase.MODE_WRITE);
    It doesn’t work. I think this because the lock was not created by a ‘lock’ statement. Are there any other statements I can use to commit
    all database updates? If it was ABAP, I would use a ‘COMMIT WORK’, is there a Java / CAF equivalent?
    I have spoken to our Basis consultants, they have shown me Solution Manager where we can actually see the locks happening. Session ID 53
    is the first update, 54 is the second.
    Thanks
    Iwan

    For updates you actually need a lock to avoid inconsistencies.
    the lock should automatically be released when the JTA transaction is completed - in the case of CMP EJBs when the first service is finished...

  • ADF Database lock and Refresh

    I have two issues regarding ADF.
    Database lock :
    The problem :
    In most test-cases the database lock functionality is working correctly in my app. We have two users working on the same dataset trying to store at the same time, one user get to store, and the other get a message saying that the rowkey have been changed, and can after s short while store his data.
    However, in one .jsp saving at the same time gives a lock lasting for 15-20 minutes. The ViewObject related to this .jsp have many EntityObjects (6 EntityObject in one Viewobject), so it is more complex than the others.
    What we have tried :
    Changing the jbo.locking.mode to optimistic on the Appmodule.
    What more can we do in ADF for configuring the locking? Is there a way to trace to see what is creating the lock for 15 - 20 minutes?
    Refresh :
    The problem :
    In most cases ADF handles refresh of data correctly. But some places it seems to not update correctly. We are using JSF (ADF Faces)
    What we have tried :
    Changing the refresh condition on the iterator in the pageDef.xml to always.
    <iterator id="berpriListIterator" RangeSize="-1"
    binds="berpriList" Datacontrol="RegServiceDataControl1"
    CachResult="false"
    Refresh="always" />
    Adding InvokeAction :
    <invokeAction Binds="Execute" id="invokeExecute" RefreshCondition="${adfFacesContext.postback ==false }" />
    Editing the Action:
    <action IterBinding ="berpriListIterator" id="Execute" Instance=" " Datacontrol="" RequiresUpdateModel="true" Action="2" />
    This seems to work. Is this a bug in ADF or should we always add invokeAction on all pageDefs? Some places it seems to update correctly even without invokeAction.
    Is this issue also in 11g?

    Using jbo.locking.mode=optimistic I would never expect an ADF web application to hold only any database locks for longer than the span of the commit processing in the normal case. The locks would be attempted only during the commit processing and if any DML error (including a failed lock attempt) occurs, then the transaction should be rolled back to a SAVEPOINT that ADF acquires before beginning the commit processing.
    One way an ADF application could acquire and retain locks would be if your application is using the Transaction.postChanges() method to explicitly post, but not commit, pending database changes. Are you doing that by chance?
    There are occasions in the Oracle database when doing one operation like a delete or update can lock a table if you have unindexed foreign keys (see http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:292016138754 ). Not sure if that is your situation, but still the locks should only be around for the very short span of time during the commit processing.
    Regarding the refresh, you should be able to verify by launching two separate instances of the ADF Business Components Browser testing tool that, when you do the following:
    (Assuming app module has jbo.locking.mode=optimistic)
    * User A queries Employee with Empno = 7839
    * User B queries Employee with Empno = 7839
    * User A modifies Sal attribute from 5000 to 4999, Comm attribute from NULL to 1 and commits
    * User B modifies Comm attribute from NULL to 55 and commits
    * User B receives the "RowInconsistentException"
    And, you should see:
    * Modified value of Comm in User B's Emp row stays at its modified value (as would any attributes that are modified in its current transaction)
    * Any unmodified values (like User B's Emp row's Sal value) will be refreshed to the current state of the database, so it should now be 4999
    If you are using JSF and partial submits, you might need to configure PPR to see these data changes reflected accurately in the JSF page.

  • Database locks problem

    Hi,
    We encounter blocking locks within our applications on a frequent basis. We have various ways of detecting these but when we have locks we cannot see them via EM Grid Control.
    We navigate to <Database> - Performance - Database Locks - Blocking Locks - there are none displayed even though we know there are blocking locks.
    This is happening on a number of databases, all of which are 8.1.7.4.
    There are no error messages displayed in the Grid Control console - it draws the locks screen fine - but just displays no results.
    In the emoms.trc file we can see errors relating to locks and javanullpointer exceptions (see output below).
    Has anyone else had this problem?
    Any help appreciated.
    Thanks,
    Steve.
    Output from emoms.trc:
    [EMUI_13_45_56_/console/database/instance/lock] ERROR em.MetricEngine getMetricResult.1026 - MetricCollect
    orTarget[MetricCollector:LOCK_THREAD302:30] unable to get cached data for metric
    BLOCKING_LOCKS against target YBSL: java.lang.NullPointerException
    java.lang.NullPointerException
    at oracle.sysman.emo.perf.metric.rt.DbLockManagerQuery.getData(DbLockManagerQuery.java:316)
    at oracle.sysman.emo.perf.metric.rt.DbBlockingLocksQuery.getData(DbBlockingLocksQuery.java:72)
    at oracle.sysman.emSDK.emd.rt.MetricCollectorThread.getMetricResult(MetricCollectorThread.java:971)
    at oracle.sysman.emSDK.emd.rt.MetricCollectorTarget.getMetricResult(MetricCollectorTarget.
    java:534)

    Hi;
    Recently i have many (apps) user locks in my database . Any problem happen my database ?Which user? Seeded or customs? If one user locked which mean that user cant login database any more. Did you check those user end date?
    Can i kill that Inactive (apps) users manually ? If one session is İnactive it doesnt meant it can be not active anymore. Please see:
    session is still Alive-How to find the DB session is still Alive
    How to find the DB session is still Alive
    Regard
    Helios

  • Lock(Enque/Deque) is a logical lock & database lock

    Hi All,
    I have gone through various portals and SDN too, and found that locks are the logical locks and sometimes database locks too but still have some confusion.
    1) If these are the logical locks then why they are created by SE11 and once created then FM has been generated. All FM are stored somewhere right? So they would be in database.
    2) If these are the database locks then why they are at the application server level and few more things.
    Can anybody explain with the valid reasons? In which queue they fall and why?
    Thanks.
    An

    Hi Anurag,
    The SAP locks are created with naming standard EZ. They are not connected with the DB. It work like this
    You create Lock -> FM is automaically generated as follow EXample:   CALL FUNCTION 'DEQUEUE_EZARS_TRHDR_T'
        EXPORTING
    generated In your program you add CALL FUNCTION <name of your new lock enqueue FM>
    3. if object is not locked you can modify it.
    4. unlock it with second (dequeue) FM
    Information about these locks are stored in queue on specific application server (usually central instance) - in SM51 you can see it with description "Enqueue".
    So this is kind of mechanism that works if everybody goes according to rules. If someone will write it's own report were he access your objects, but he will ommitt this FM call (or ignore it's results), then he will be free to change it as he likes even if someone has already locked it.
    To use DB lockes other technices are used like SELECT SINGLE * FOR UPDATE

  • OSB: Implementing database locks

    Hi
    Tools: OSB11g, Oracle DB 11g, IntalioBPM
    I have a BS_BankProcessing business service which has "InsertBalance", "RetrieveBalance" and "UpdateBalance" operations. This BS is based on Account_Table in database.
    I created a proxy service - PS_BankProcessing which forwards requests to BS_BankProcessing.
    Then I invoked BPM process set for execution who are exposed to PS_BankProcessing. Around 100 process instances created and all accessed PS_BankProcessing for the same account number. As a result in database I could find several inconsistencies owed to simultaneous updation of DB by more than one BPM instance at the same time.
    That means simultaneous BPM instance requests were processed by OSB.
    How can I implement database locks in OSB or make PS_BankProcessing as a single instance proxy service so that there will be no conflicts in databasae updation?
    T&R
    Swapnil Kharwadkar

    well what I did was a real quick fix. Its not elegant but this is the way I did it.
    1. I created a workmanager in weblogic. Then I set its Max Threads Constraint=1. The same reference I gave in PS_BankProcessing. I am halfway through tests but this should make my PS_BankProcessing as singleton.
    2. Then I created DVM for JNDI name and my sql queries. These I extract at runtime in message flow and execute through xquery. It makes solution somewhat loose-coupled. At later stage I could change queries without changing code.
    But as Mr. Pierluigi said, it would be ideal to implement locks formally. I will try out that subsequently.

  • Database locking (state versus stateless) and indexes on oracle database

    Does anyone have a link to a document talking about database locking (state versus stateless) and talking about indexes in oracle database?

    No version information and no information as to what you mean by "locking" so no help is possible.
    You could mean LOCK TABLE in version 7.3.4 or SELECT FOR UPDATE in 11.1.0.7 or something else entirely.

  • Different between database lock and sap lock

    Hi All,
    What is different between database lock and sap lock why sap introduced locking mechanism.
    Thanks
    Santosh

    From a database perspective, every dialog step forms a physical and logical unit:
    the database transaction.. The database lock administration can only coordinate
    this type of database transaction. From an SAP point of view, however, this is
    not sufficient, because SAP transactions, which are formed from a sequence of
    logically related work steps that are consistent in business terms, are generally
    made up of several dialog steps. SAP systems need to have their own lock
    management. This is implemented using the enqueue work process. This also
    ensures that the platform-independence of the lock management is maintained.

  • Database locking using JSP and Oracle database

    Dear All
    I am reading about how to do database locking in general and i want to implement these mechanisms using JSP pages and oracle database, but i have the following questions:-
    1.If i write a “select for update” quesry in the JSP page will it locks the record ? or it will not lock the record because the connection between the JSP pages and the server will be stateless in most online systems?
    2.If i write all my jave code in transaction , something like this:-
    • Begin transaction
    • Commit or
    • Rollback
    Then should i be worried about the locking issues or the database manger will handle the locking mechanisms to insure data integrity(and what the default mechanism (if any) that the oracle database manger use to do the locking)?
    3. If the answer for question 2 is no, then how can i handle the optimistic and the pentemistic locking using JSP pages?
    BR

    One way to solve this issue is as follows:
    * You add a new column to each database table called 'version' which is of int type.
    * Each time you alter any field in a record, you increament the version number.
    * When you read a record and display it, you store the version number in your code
    * when you go to update the record, you write your sql something like this:
    update person set firstName=? where personId=? and version=?
    Where the version is whatever you stored locally. If someone altered the record in the database while your
    end user was looking at it, the version numbers will not match and the sql statement will
    return zero as the number of records it altered. If its zero, inform the end user someone altered the record
    while he was looking at it and weather or not he wants to proceed.
    The chances of two people altering the same record in a table while both are logged in and viewing the same set of data is small so such collisions will be few.
    You only need transactions if you are updating more than one record at a time (in the same table or multiple tables).
    You dont need it for reading records if you use a single sql statement to read (for example: to join multiple tables).
    In general, you get a (pooled) connection, use it, and close it as quickly as possible in a try/catch/finally block. You dont hold onto it for the duration of the user's session. A book on JDBC should help clarify this.

  • How to manage and prevent database lock for database admin and development

    how to manage and prevent database lock for database admin and development
    [email protected]

    Hi,
    can someone advise me some good book or even better a PDF or a white paper on the Web where it's explained well how to design and manage a relational database (that is normal forms, tuning, design, implemantation...)?
    I've been working on Oracle databases for a few years as pl sql programmer, but I'd like to read something describing well the relational database theory, because I've been asked to work as database designer.There are many books available in the market, please go through this link -- http://www.amazon.com/gp/bestsellers/books/549646/ref=pd_ts_b_nav
    I've been told to read "Fundamentals of Database Systems" by Ramez Elmasri, but I ask here for some more advices.I would strongly recommend reading this book, it was my best reference during my college study and even after starting my DBA career.
    Thanks,
    Hussein

  • Microsoft-Windows-Folder Redirection Error 502. CSC database locked by another user

    Dear all,
    We are finalizing our Windows 7 migration where we migrated 500+ clients. In our enterprise concept we implemented RUP (Roaming User Profiles) and Redirected Folders for all
    users. The Redirected Folders have been by enabled by a single GPO which redirects all folders from
    AppData to
    Searches \\servername.domain.name\documents$\%username%.
    Problem:
    The RUP and Redirected folders solution works fine until a new user wants to logon. This new user has been migrated to RUP and Redirected on another system and
    he just wants to work on another workplace or gets a temporary pc. What happens is that redirected folders do not work. The user gets a message that the folder is not reachable and desktop is empty.
    Troubleshooting:
    Soon I found out that something was being locked. If we used a user account which had working Redirect Folders than this
    worked for that user. An event of 10 was logged in OfflineFiles area of EventViewer to reconnect the path which was configured in the GPO.
    This is example screenshot. It says "Error on Open Folder. \\server.domain.name\documents$\%username%\Desktop refers to a location that is unavailable. It could be on a hard disk
    on this computer, or a on a network. Check to make sure that the disk is properly inserted, or that you are connected to the Internet or your network, and then try again. If it still cannot be located, the information might have been moved to a different location."
    These symptoms happen randomly and not on all workstations. The pain here is when it happens on a portable computer. For desktop we disabled the "Disable Offline Files' in "Manage
    Offline Files" control panel and then reboot. After the reboot the folders are directed
    and it works without these errors... On portable computer we can't use this work around as they need to work offline.
    If I connect to the share without the FQDN like \\servername\documents$\%username%\Desktop than this works fine and user can access all folders. When I try the FQDN path which is
    configured in the GPO to redirect user to like \\servername.domain.name\documents$\%username%\Desktop than it fails with this message. I personally think because the C:\Windows\CSC database is locked by the previous user who has been logged on this system.
    An example of the event generated in the Applications Event viewer part (I removed some username and server path):
    Log Name:      Application
    Source:        Microsoft-Windows-Folder Redirection
    Date:          1-2-2011 17:40:11
    Event ID:      502
    Task Category: None
    Level:         Error
    Keywords:     
    User:          domain\ivan
    Computer:      computer.domain.name
    Description:
    Failed to apply policy and redirect folder "Videos" to "\\servername.domain.name\documents$\ivan\Documents\My Videos".
     Redirection options=0x1001.
     The following error occurred: "Can not create folder "\\\servername.domain.name\documents$\ivan\Documents\My Videos"".
     Error details: "Access is denied.
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="Microsoft-Windows-Folder Redirection" Guid="{7D7B0C39-93F6-4100-BD96-4DDA859652C5}" />
        <EventID>502</EventID>
        <Version>0</Version>
        <Level>2</Level>
        <Task>0</Task>
        <Opcode>0</Opcode>
        <Keywords>0x8000000000000000</Keywords>
        <TimeCreated SystemTime="2011-02-01T16:40:11.486983400Z" />
        <EventRecordID>2754</EventRecordID>
        <Correlation ActivityID="{3211E6FB-2801-456D-BE6E-66AAE150A4DC}" />
        <Execution ProcessID="968" ThreadID="5856" />
        <Channel>Application</Channel>
        <Computer>computer.domain.name</Computer>
        <Security UserID="S-1-5-21-3705223304-2632712944-1292073641-26755" />
      </System>
      <EventData Name="EVENT_FDEPLOY_FailedToApplyPolicy">
        <Data Name="FromFolder">Videos</Data>
        <Data Name="ToFolder">\\servername.domain.name\documents$\ivan\Documents\My Videos</Data>
        <Data Name="Options">0x1001</Data>
        <Data Name="Error">Can not create folder "\\servername.domain.name\documents$\ivan\Documents\My Videos"</Data>
        <Data Name="ErrorDetails">Access is denied.
    </Data>
      </EventData>
    </Event> 
    Something like this I see in the Application Eventviewer:
    Environment:
    Windows 7 Enterprise client with patches until 1-Nov-2010
    Windows Server 2008 R2 for the Documents$ share
    Windows Server 2003 R2 as the domain controller
    I have tried all different option even to rebuild the CSC database but this also was not helping. I hope we are not dealing with a bug.
    Any help is much appreciated.
    Best regards, Ivan Versluis http://www.networknet.nl

    Ivan and SteveDIG - Thanks for taking the time to post detailed information about what you have found.  I have found the same things over the past few months and have been working with Microsoft to resolve this.  Like Ivan, I have been told by
    MS that this is a design problem in Windows 7, but they did admit it is a bug and did not charge me for the case.  That was the good news.  The bad news was that the problem is so 'deep' in Windows 7 that it will not be fixed until Windows 8 and
    the CSC engineering team in Redmond has rejected several requests to fix this issue in Windows 7 from several customers.  I personally feel we should have hauled our TAM in over this, but that wasn't my call so we haven't attempted to get an attitude
    change from MS.
    <RANT> I find this completely outrageous.  Windows is supposed to be a multi-user operating system suitable for deployment to mobile workforces spread around the world and often using slow VPN links.  Offline folders, folder redirection,
    slow link detection, etc. are all great on paper and as I did the design work for the W7 solution I've just built I sold these advantages heavily.  I now have serious egg on my face and am not happy.  Like others here I missed this in testing as
    multiple users are a fringe for us, but still important, I unfortunately didn't think to specifically test for multiple users, though I tested the features thoroughly and was happy with the results when used on single user machines.</RANT>
    As identified above, this issue manifests when more than one user uses a machine and their Offline folders (all redirected folders are configured this way by default) are in an offline state when the first user logs off.  The second user cannot access
    this 'offline' share so folder redirection fails.  We get burnt as we have latency=0 configured for slow link detection with Offline folders so users always work offline.  This is partly because of WAN optimisers in the network that lie to Windows
    so the online/offline transition doesn't work on slow links (not MS's fault), and partly because it made sense for other reasons.
    The workaround Microsoft and I came up with for our environment was to use individual file shares for each user.  We had been using a common file share with each user folder under that file share.  Changing to an individual share for each users
    means the share is not locked by the previous user.
    Examples
    This would cause a problem if John then Emma logged on to the same machine. Folder redirection would fail for Emma:
    \\FileServer1\Users$\john
    \\FileServer1\Users$\emma
    So would this if DFS was used
    \\my.domain\users\john            (points to \\FileServer1\Users$\John)
    \\my.domain\users\emma          (points to \\FileServer1\Users$\Emma)
    This would fix the problem:
    \\FileServer1\John$
    \\FileServer1\Emma$
    Unfortunately we then figured we could move these shares behind DFS like so:
    \\my.domain\homes\john             (points to \\FileServer1\John$)
    \\my.domain\homes\emma          (points to \\FileServer1\emma$)
    This was wrong.  The problem returned.  I assume the share that is being locked is now the DFS root and not the user share.
    The operations team here is very reluctant to go with direct access to the file servers and not use DFS as that will create issues for them in the future when they need to make file server changes.  I sympathise with them but can't see an alternative
    at the moment as we are deploying W7 and can't stop.  If I'd picked this up earlier a third party product might have been the solution (MS actually suggested this when I opened my case).
    I hope the information about individual shares above is helpful to someone.  Otherwise I don't really have more to add but I needed the rant :-)
    <RANT>BTW.  Has anyone tested changing a user’s home directory path once it is cached?  Try it. Test a scenario where you move the user from one file server to another.  You will not enjoy the results.  I'll say no more
    than this as it is off topic, but it shows the lack of investment in the CSC feature in Windows.  Very disappointing</RANT>

  • Transactions and database locks

    Hi,
                   We use Weblogic 4.5.1 on Windows NT 4.0 with Oracle 8.0.5. Our database
              isolation is set to TRANSACTION_READ_COMMITTED. I have an entity bean with
              TX_REQUIRED & TRANSACTION_READ_COMMITTED settings. If my client creates a
              transaction, and starts calling methods on this entity bean, is the
              corresponding database row locked for the duration of the transaction? We
              have concurrent SQl-plus sessions going on and we want make sure there is
              no data corruption. If the row is not locked, is it ok for me to explicitly
              lock it from inside my entity bean?
              Thanks,
              Srini.
              

    Hi. This should have been posted to the EJB or JDBC group, but I'll take it.
              This is an Oracle question. If you have a transaction as you've described,
              then the behavior will be exactly as if you had multiple SQL-PLUS sessions,
              and in one of them, you did:
              SQL> BEGIN;
              -- do what your bean would do;
              SQL> COMMIT;
              You can test this there. In general, you'll find that Oracle's optimistic locking
              will allow any number of simutaneous transactions to access a given row
              at one time. Oracle does not lock the real data while a transaction is ongoing,
              instead making a copy for the client to work off of. At commit time, depending
              on the isolation level semantics, some or all of the transactions may fail when
              Oracle tries to update the real data from the per-session private data.
              I would council against running with SERIALIZABLE mode because there
              is a serious bug in Oracle, where serializable transactions may fail silently.
              Details on request.
              Joe
              Srini wrote:
              > Hi,
              > We use Weblogic 4.5.1 on Windows NT 4.0 with Oracle 8.0.5. Our database
              > isolation is set to TRANSACTION_READ_COMMITTED. I have an entity bean with
              > TX_REQUIRED & TRANSACTION_READ_COMMITTED settings. If my client creates a
              > transaction, and starts calling methods on this entity bean, is the
              > corresponding database row locked for the duration of the transaction? We
              > have concurrent SQl-plus sessions going on and we want make sure there is
              > no data corruption. If the row is not locked, is it ok for me to explicitly
              > lock it from inside my entity bean?
              >
              > Thanks,
              > Srini.
              PS: Folks: BEA WebLogic is in S.F., and now has some entry-level positions for
              people who want to work with Java and E-Commerce infrastructure products. Send
              resumes to [email protected]
              The Weblogic Application Server from BEA
              JavaWorld Editor's Choice Award: Best Web Application Server
              Java Developer's Journal Editor's Choice Award: Best Web Application Server
              Crossroads A-List Award: Rapid Application Development Tools for Java
              Intelligent Enterprise RealWare: Best Application Using a Component Architecture
              http://weblogic.beasys.com/press/awards/index.htm
              

Maybe you are looking for

  • Why does my photo uploaded from my PC into the upload Photo Stream folder not show up on my iPhone or iPad?

    I just set up iCloud for my new iPhone 4S and iPad2. I have a PC running Windows 7. I have downloaded the iCloud for Windows 7 software. In experimenting with iCloud, I see the pictures that I took on my iPad and iPhone have been streamed to my PC, n

  • Report server engine

    Hi I using fusion middleware 11.1.2, i have report server and want to create multi engine, my question is if one engine crash is other engine still working or crash with first one, Regards

  • " Could not create SSL/TLS secure channel " error with Webtest of VS 2013

    hello ! I want to test my mvc web project with webtest tools of VS 2013 and I Record a test with Internet Explorer but when I run test appear this error for me at result of test run : Could not create SSL/TLS secure channel for some requested url , b

  • I need to merge two My BestBuy accounts.

    I bought a Vita 2-9-15 and used a point multiplier coupon as well. (though I forget by how much) Its well pasted the 15 day mark and at this point I guess it was put on my other best buy account. Can someone help me merge the two? Solved! Go to Solut

  • Importing Mono CDs question.

    I'm importing the 2009 Beatles Mono CDs and the Monkees Mono CDs and I was wondering if there was any encoding I had to do for mono songs. I'm trying to get the best sound that I can for the Mono songs for use on iTunes/Ipod. Thanks for the help.