Lock Object Creation

Hi,
Is it possible to create lock objects at runtime? if not, how do I lock tables at runtime when the table name is specified in the selection screen by the user?
Thanks.
Tyken

Hi tyken,
Try this.
Lock Objects are Created using Tcode SE11.
The Lock object name must be start with EZur name.
Mainly lock objects are used for locking the transactions, tables --etec.
Multiple users can not updated the same transaction at the same time.
Whenever u create a lock object using se11. SAP internally
creates a two function modules:
Enqueue_lockobjname ---For Locking purpose,
dequeue_lockobjname---For Unlocking purpose.
U make use of these fms to lock and unlock transctions, tables..etc.
Steps to create lock objects :
GO TO SE11
Select the radio button "Lock object"..
Give the name starts with EZ or EY..
Example: EYTEST
Press Create button..
Give the short description..
Example: Lock object for table ZTABLE..
In the tables tab..Give the table name..
Example: ZTABLE
Save and generate..
Your lock object is now created..You can see the LOCK MODULES..
In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
The example is as follws:
EPORT ZLOCK_UNLOCK
MESSAGE-ID ZBDC.
TABLES ZSTUD.
DATA text(8) TYPE c.
CALL SCREEN 100.
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'SELECT'.
SELECT SINGLE * FROM ZSTUD WHERE ROLLNO = ZSTUD-ROLLNO.
MESSAGE i004 WITH 'SY-SUBRC:' sy-subrc.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'ENQUEUE'.
CALL FUNCTION 'ENQUEUE_EZLOCK1'
EXPORTING
MODE_ZSTUD = 'X'
ROLLNO = ZSTUD-ROLLNO
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
CASE sy-subrc.
WHEN 0.
MESSAGE i004 WITH 'Enqueue successful'(001).
WHEN 1.
text = sy-msgv1.
MESSAGE e004 WITH 'Record already'(002) 'locked by'(003)
text.
CALL TRANSACTION 'SM12'.
WHEN 2 OR 3.
MESSAGE e004 WITH 'Error in enqueue!'(004)
'SY-SUBRC:' sy-subrc.
ENDCASE.
WHEN 'DEQUEUE'.
CALL FUNCTION 'DEQUEUE_EZLOCK1'
EXPORTING
MODE_ZSTUD = 'X'
ROLLNO = ZSTUD-ROLLNO
EXCEPTIONS
OTHERS = 1.
CASE sy-subrc.
WHEN 0.
MESSAGE i004 WITH 'Dequeue successful'(005).
WHEN 1.
MESSAGE e004 WITH 'Error in dequeue!'(006).
ENDCASE.
WHEN 'SM12'.
CALL TRANSACTION 'SM12'.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'BASIC'.
ENDMODULE. " STATUS_0100 OUTPUT
Regards,
Chitra

Similar Messages

  • Can i use the SAP standard package for lock object creation ?

    Dear Guru ,
    I want to create a new lock ojbect for my abap program .
    When i completed the creation , SAP required a new request and it said the object only can be imported to SAP standard package .
    But i saw the help from SAP said :
    >* Package begins with A-S or U-X:
    >These packages are for SAP standard objects. Customer objects cannot be created in them. Changes to objects of these packages are recorded by the Transport Organizer (Request management) and can be transported (see field transport layer.
    In this case ,  Can i use one of the SAP standard package for this creation ? Does it will affect the SAP system ( such as the system upgrade ) ?
    Thanks .
    Best Regards,
    Carlos Zhang
    Moderator message - Please do not use code tags to format text - it should only be used for code
    Edited by: Rob Burbank on May 25, 2010 11:12 AM

    Hi Carlos...
    First , You will never be able to use any standard SAP Package for your custom programs. So don't go for it.
    So in your case what you need to do is , when you save your Lock object , 
    - if you want Transport request to be created , then 
    in the screen shown you need to enter the Z package name (the same package as that of your ABAP Program)
    or
    -if you want it to be stored as local object , then
    specify package as $tmp
    Regards,
    Uma

  • Error while lock object creation

    Hi
    When I tried to create a lock object, I get the following error.
    Error: "Total length of lock argument for table XXXXXXXXX longer than 150"
    I have 3 tables in which Table1 is the check table for the value tables (Table2 & Table3). During the process of deletion of a record from Table1 (CT) I need the lock tobe established on value tables and then I delete all the corresponding entries in value tables are also deleted.
    Would like to know If there is any other std ways of doing this ? and
    Solution to overcome the error.
    Regards
    Karthick

    Hi,
    I think the error is becoz you have given too many LOCK parameters in the lock object. the total length of the PARAMTERS of lock object should not exceed 150.
    By default all the KEY fields will be taken as Lock paramters, so your table key's length is more than 150.
    Also why dont you create 3 lock objects for each table and then use only KEY's of each table as LOCK PARAMETERS.
    Then Lock T1 record first then lock T2 and T3 records, then delete records from T2 and T3.
    Then you delete T1 record.
    The execute DEQUEUE_ALL.
    Regards,
    Sesh

  • Let me know creation of lock object

    let me know creation of lock object

    Hi
    <b>Lock Objects</b>
    Lock object concept
    Lock modes
    Creating a lock object (example)
    Lock object sample code
    SAP data dictionary provides you with a locking mechanism to synchronize simultaneous data access by different users.
    Lock objects are created in SE11.
    Customer lock objects must begin with EY or EZ .
    Three possible lock modes exist for lock objects.
    <b>Lock Mode</b>
    Lock mode E: This sets a lock for changing data for single user. This lock can be accumulated.
    Lock mode X: This mode is used like mode E for changing data. The only technical difference from mode E is that the respective lock does not allow accumulation.
    Lock mode S: This mode ensures that data displayed in your program cannot be changed by other users during the entire display time. Here you do not want to change the data yourself (allows read only access for data).
    <b>Creating Lock object</b>
    SE11
    1)Enter lock object name beginning with EY or EZ
    and hit create.
    2)Enter table names containing data records that should be locked and the lock mode.
    Enter short text /tbale/lockmode.
    3) The primary keys of the specified tables are automatically selected as lock parameters.
    It automatically selects the primary key for the selected table.
    To set a lock in the application program
    call a function module ENQUEUE_<LOCK_OBJECT>.
    For our example, it would be ENQUEUE_EZMARA.
    To release the lock in the application program
    call a function module DEQUEUE_<LOCK_OBJECT>.
    For our example, it would be DEQUEUE_EZMARA.
    Refer the code executed by user (say abap1) for
    matnr = ’000000000000000012’.
    Lock Objects are used to synchronize access to the same data by more than one user. Function modules that can be used in application programs are generated from the definition of a lock object in the ABAP Dictionary.
    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 .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.
    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
    Data Dictionary/ Lock Objects
    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 positiontable.
    Lock Mode
    The lock mode controls whether several users can access data records at the same time. The lock mode can be assigned separately for each table in the lock object. When the lock is set, the corresponding lock entry is stored in the
    lock table of the system for each table. Access by more than one user can be synchronized in the
    following ways:
    Exclusive lock: The locked data can only be displayed or
    edited by a single user. A request for another exclusive lock
    or for a
    shared lock is rejected.
    Shared lock: More than one user can access the locked data
    at the same time in display mode. A request for another
    shared lock is accepted, even if it comes from another user. An exclusive lock
    is rejected. Exclusive but not cumulative: Exclusive locks can be requested
    several times from the same transaction and are processed
    successively. In contrast, exclusive but not cumulative locks
    can be called only once from the same transaction. All other
    lock requests are rejected.
    1) Select object type Lock object in the initial screen of the ABAP Dictionary, enter an object name and choose Create. The name of a lock object should begin with an E (Enqueue).The maintenance screen for lock objects is displayed.
    2) Enter an explanatory short text in the field Short text. You can then use the short text to find the lock object at a later time, for example with the R/3 Repository Information System.
    3) Enter the name of the primary table of the lock object. All other tables in the lock object must be linked with the primary table using foreign keys.
    4) Select the lock mode of the primary table in the field below it The lock mode is used as the default value for the corresponding parameters of the function modules generated from the lock object.
    5) Choose Add if you want to lock records in more than one
    table with the lock object. A list of all the tables linked with the primary table using valid foreign keys is displayed. Select the appropriate table. The lock
    mode of the primary table is copied as lock mode. You can change this setting as required, for example you can assign the lock mode separately for each table.
    Similarly, you can add a table linked with the secondary table just added with foreign keys. To do this, place the cursor on the name of the secondary table and choose Add.
    If no lock mode is assigned to a table, no lock is set for the
    entries in this table when the generated function modules are
    called. You should not assign a lock mode if a secondary table
    was only used to define a path between the primary table and
    another secondary table with foreign keys.
    6) Save your entries.
    A dialog box appears in which you have to assign the lock
    object a development class.
    7) You can define whether the function modules generated from
    the lock object should be RFC-enabled on the Attributes tab
    page. If you set the Allow RFC flag, the generated function
    modules can be called from within another system with Remote
    Function Call. If you permit Remote Function Calls for an
    existing lock object, you must ensure that the generated
    function modules are called from within an ABAP program with
    parameters appropriate for the type. You should therefore check
    all programs that use the associated function modules before
    activating the lock object with the new option.
    8) Choose Activate
    <b>Reward if u sefull</b>

  • Patch 9239090 - ORA-04021: timeout occurred while waiting to lock object

    Hello Guys,
    I need help urgently to comlete an upgrade of ebs 12.1.1 to 12.1.3.
    We are upgrading ebs 11i to 12i going live this weekend. We have encountered "ORA-04021: timeout occurred while waiting to lock object" on patch 9239090 with two Workers:
    In adctrl:
    1 Run AutoPatch R120 AFUTLGRS.pls FAILED
    2 Run AutoPatch R120 AFUTLOGS.pls FAILED
    sqlplus -s APPS/***** @/u02/applfinp/apps/apps_st/appl/admin/OFPROD/out/p001invok.sql
    Connected.
    create or replace package wf_bes_cleanup AUTHID CURRENT_USER as
    ERROR at line 1:
    ORA-04021: timeout occurred while waiting to lock object
    I have done everything everything imaginable but cannot get pass these 2 failed workers.
    1) I have checked are there are no locks blocking on any objects:
    select s1.username || '@' || s1.machine
    || ' ( SID=' || s1.sid || ' ) is blocking '
    || s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status
    from v$lock l1, v$session s1, v$lock l2, v$session s2
    where s1.sid=l1.sid and s2.sid=l2.sid
    and l1.BLOCK=1 and l2.request > 0
    and l1.id1 = l2.id1
    and l2.id2 = l2.id2 ;
    2) I also checked and there is space in the database.
    3) From adctrl, I have tried restarting the jobs one by one but the worker 1 hangs at and eventually fails on several (12) attempts.
    4) The solution on Doc ID 1291064.1 is not the problem:
    SQL> select SUPPLEMENTAL_LOG_DATA_MIN, SUPPLEMENTAL_LOG_DATA_PK, SUPPLEMENTAL_LOG_DATA_UI, FORCE_LOGGING
    from v$database;
    SUPPLEME SUP SUP FOR
    NO NO NO NO
    5) Manual execution still gave ORA-04021:
    sqlplus -s APPS/apps @/u02/applfinp/apps/apps_st/appl/admin/OFPROD/out/p001invok.sql
    sqlplus -s APPS/apps @/u02/applfinp/apps/apps_st/appl/admin/OFPROD/out/p002invok.sql
    6) The alert log has no related errors
    7) I Finally, after over 6 hours of waiting, I could only get the patch to continue after by using adctrl option 8 to skip these two workers.
    After proceeding, I have yet hit two more errors and now stuck:
    I have hit another error with the same patch:
    create or replace package body FND_LOG as
    /* $Header: AFUTLOGB.pls 120 ...
    AD Worker error:
    ORA-04021: timeout occurred while waiting to lock object
    Unable to process file in PACKAGE mode.
    Not converting file for Invoker's Rights because it appears to be a package body creation script (based on the filename).
    File is: /u02/applfinp/apps/apps_st/appl/fnd/12.0.0/patch/115/sql/AFUTLOGB.pls
    AD Worker warning:
    Product Data File
       /u02/applfinp/apps/apps_st/appl/admin/xniprod.txt
       does not exist for product "xni".
      This product is registered in the database but the above file does not exist in APPL_TOP.  The product will be ignored without error
    AD Worker error:
    The following ORACLE error:
    ORA-04063: package body "APPS.FND_LOG" has errors
    ORA-06508: PL/SQL: could not find program unit being called: "APPS.FND_LOG"
    ORA-06512: at "APPS.FND_FUNCTION", line 834
    ORA-06512: at "APPS.FND_MENU_ENTRIES_C_DELTRG", line 4
    ORA-04088: error during execution of trigger 'APPS.FND_MENU_ENTRIES_C_DELTRG'
    Can I stop and restart this patch 9239090?

    Hello,
    I later executed the failed jobs or scripts manually (successfully) for the patch to continue
    sqlplus -s APPS/apps @/u02/applfinp/apps/apps_st/appl/admin/OFPROD/out/p001invok.sql
    sqlplus -s APPS/apps @/u02/applfinp/apps/apps_st/appl/admin/OFPROD/out/p002invok.sql
    The patch ended with the following :
    The following Oracle Reports objects did not generate successfully:
    ap reports/US APXARATE.rdf
    ar reports/US ARXCTA.rdf
    fa reports/US FASRSVED.rdf
    ont reports/US OEXOEORD.rdf
    pa reports/US PAXACMPT.rdf
    pa reports/US PAXALRUN.rdf
    pa reports/US PAXACRPT.rdf
    pa reports/US PAXCPGAL.rdf
    pa reports/US PAXPCRFD.rdf
    The patch execution ended but the patch number is not record in apps.ad_bugs table:
    select TO_CHAR(CREATION_DATE,'dd-Mon-yyyy, hh24:mm:ss'), BUG_NUMBER from apps.ad_bugs where bug_number in ('9239090');
    no rows selected
    JFI
    Patches located in ad_applied_patches to which there is no a corresponding record in ad_bugs:
    SQL> SELECT a.patch_name, TO_CHAR(max(a.last_update_date),'dd-Mon-yyyy, hh24:mm:ss')
    2 FROM applsys.ad_applied_patches a
    3 WHERE NOT EXISTS (SELECT '1'
    4 FROM ad_bugs b
    5 WHERE b.bug_number = a.patch_name)
    6 group by a.patch_name;
    PATCH_NAME TO_CHAR(MAX(A.LAST_UP
    9239090 26-Oct-2013, 00:10:27
    AutoConfig 25-Oct-2013, 17:10:51
    merger9179588 25-Oct-2013, 11:10:30
    merger_post_5903765 27-Apr-2013, 23:04:45
    mergeu6678700 25-Oct-2013, 16:10:09
    What could have happened that this was not recorded in ad_bugs?
    How to I get this recorded in the ad_bugs table?
    Thanks
    Mathias

  • Lock Object  Confusion

    Hello All ,
                  I have create one Module Pool program.it is having three t code for creation ,change and display. it is having two table Header and details table.
    I have decided to go for shared lock as per requirement. That's why created on lock object with the help of  t code  se11 .
      My problem is how do I call that lock object in program, because all the lock object are called using called function PATTERN.  When I am also trying to do the same it give me message function not found.
    Can some one tell me :
    1 . How do I called lock object in my program.
    2.  Lock object : lock parameter are there ,Means the primery key of lock object on the logic of this the lock object is called.
    3.  would the same lock I can called for Create and change also. Would i work ?.  At the same time other operation can perform.
    Please provide me the ansower of the question.
    regards
    Swati namdeo

    Hi
    Hope it will help you.
    Pls reward if help.
    Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
    SAP Provide three type of Lock objects.
    - Read Lock(Shared Locked)
    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
    - Write Lock(exclusive lock)
    protects write access to an object. The write lock allows other transactions neither read nor write access to
    the locked area of the table.
    - Enhanced write lock (exclusive lock without cumulating)
    works like a write lock except that the enhanced write lock also protects from further accesses from the
    same transaction.
    You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
    Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
    Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
    Technicaly:
    When you create a lock object System automatically creat two function module.
    1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
    2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
    You have to use these function module in your program.
    check this link for example.
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    tables:vbak.
    call function 'ENQUEUE_EZLOCK3'
    exporting
    mode_vbak = 'E'
    mandt = sy-mandt
    vbeln = vbak-vbeln
    X_VBELN = ' '
    _SCOPE = '2'
    _WAIT = ' '
    _COLLECT = ' '
    EXCEPTIONS
    FOREIGN_LOCK = 1
    SYSTEM_FAILURE = 2
    OTHERS = 3
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Normally ABAPers will create the Lock objects, because we know when to lock and how to lock and where to lock the Object then after completing our updations we unlock the Objects in the Tables
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    purpose: If multiple user try to access a database object, inconsistency may occer. To avoid that inconsistency and to let multiple user give the accessibility of the database objects the locking mechanism is used.
    Steps: first we create a loc object in se11 . Suppose for a table mara. It will create two functional module.:
    1. enque_lockobject
    1. deque_lockobject
    before updating any table first we lock the table by calling enque_lockobject fm and then after updating we release the lock by deque_lockobject.
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    GO TO SE11
    Select the radio button "Lock object"..
    Give the name starts with EZ or EY..
    Example: EYTEST
    Press Create button..
    Give the short description..
    Example: Lock object for table ZTABLE..
    In the tables tab..Give the table name..
    Example: ZTABLE
    Save and generate..
    Your lock object is now created..You can see the LOCK MODULES..
    In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
    Lock objects:
    http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    Match Code Objects:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
    http://searchsap.techtarget.com/tip/0,289483,sid21_gci553386,00.html
    See this link:
    http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
    Check these links -
    lock objects
    Lock Objects
    Lock Objects

  • Query To Kill Locked Object's Session

    Hi ,
    Im trying to write script to getting sid & Serial# for frequently locked objects in my database.
    i have tried with 3 ways as following, Pl Guide me for choosing better.
    Query 1:
    SELECT SID,SERIAL# FROM V$SESSION WHERE SID IN (SELECT SID FROM V$LOCKED_OBJECT WHERE OBJECT_ID IN ('34943','34957','34966')));
    Query 2:
    select
         sess.sid,
         sess.serial#
    from
         v$locked_object lo,
         dba_objects ao,
         v$session sess
    where
    ao.object_id = lo.object_id
         and
    lo.session_id = sess.sid
         AND
    AO.OBJECT_ID IN('34943','34957','34966');
    Query 3:
    select
    sid,
    serial#
    from
    select
    sid,
    serial#
    from
    v$session
    ) y,
    select
    b.session_id
    from
    select
    object_id,
    session_id,
    locked_mode
    from
    v$locked_object
    ) b,
    select
    object_id,
    object_name,
    owner
    from
    dba_objects
    where
    object_name in ('PMA_DEFECT_DETAILS',
    'PMA_DEFECT_HEADER',
    'PMA_DEFECT_TRANS')
    ) c
    Where
    b.object_id = c.object_id
    ) x
    Where
    x.session_id = y.sid ;
    Edited by: Abk on Jan 2, 2009 6:31 PM
    Edited by: Abk on Jan 2, 2009 6:34 PM

    Hi..
    To know the lock you can use the query below, you will know the sid and find the serial# from v$session.
    >
    col sid for 9999
    col id1 for 99999999
    col id2 for 99999999
    col lmode head "Lock Held" form a14
    col request1 head "Lock Request" form a16
    col type head "Lock Type" form a40
    col ctime head "Time Held" form 99999
    select sid,
    DECODE(TYPE,
    'BL','Buffer hash table',
    'CF','Control File Transaction',
    'CI','Cross Instance Call',
    'CS','Control File Schema',
    'CU','Bind Enqueue',
    'DF','Data File',
    'DL','Direct-loader index-creation',
    'DM','Mount/startup db primary/secondary instance',
    'DR','Distributed Recovery Process',
    'DX','Distributed Transaction Entry',
    'FI','SGA Open-File Information',
    'FS','File Set',
    'IN','Instance Number',
    'IR','Instance Recovery Serialization',
    'IS','Instance State',
    'IV','Library Cache InValidation',
    'JQ','Job Queue',
    'KK','Redo Log "Kick"',
    'LS','Log Start/Log Switch',
    'MB','Master Buffer hash table',
    'MM','Mount Definition',
    'MR','Media Recovery',
    'PF','Password File',
    'PI','Parallel Slaves',
    'PR','Process Startup',
    'PS','Parallel Slaves Synchronization',
    'RE','USE_ROW_ENQUEUE Enforcement',
    'RT','Redo Thread',
    'RW','Row Wait',
    'SC','System Commit Number',
    'SH','System Commit Number HWM',
    'SM','SMON',
    'SQ','Sequence Number',
    'SR','Synchronized Replication',
    'SS','Sort Segment',
    'ST','Space Transaction',
    'SV','Sequence Number Value',
    'TA','Transaction Recovery',
    'TD','DDL enqueue',
    'TE','Extend-segment enqueue',
    'TM','DML enqueue',
    'TS','Temporary Segment',
    'TT','Temporary Table',
    'TX','Transaction',
    'UL','User-defined Lock',
    'UN','User Name',
    'US','Undo Segment Serialization',
    'WL','Being-written redo log instance',
    'WS','Write-atomic-log-switch global enqueue',
    'XA','Instance Attribute',
    'XI','Instance Registration',
    decode(substr(TYPE,1,1),
    'L','Library Cache ('||substr(TYPE,2,1)||')',
    'N','Library Cache Pin ('||substr(TYPE,2,1)||')',
    'Q','Row Cache ('||substr(TYPE,2,1)||')',
    '????')) TYPE,
    id1,id2,
    decode(lmode,
    0,'None(0)',
    1,'Null(1)',
    2,'Row Share(2)',
    3,'Row Exclu(3)',
    4,'Share(4)',
    5,'Share Row Ex(5)',
    6,'Exclusive(6)') lmode,
    decode(request,
    0,'None(0)',
    1,'Null(1)',
    2,'Row Share(2)',
    3,'Row Exclu(3)',
    4,'Share(4)',
    5,'Share Row Ex(5)',
    6,'Exclusive(6)') request1,
    ctime, decode(BLOCK,
              0, 'Not Blocking',
              1, 'Blocking',
              2, 'Global',block) status
    from
    v$lock
    where sid>5
    and type not in ('MR','RT')
    order by decode(request,0,0,2),block,5
    ==================================================
    To know the session:--
    col username for a20
    col program for a20
    col osuser for a15
    SELECT NVL(s.username, '(oracle)') AS username,
    s.osuser,
    s.sid,
    s.serial#,
    p.spid,
    s.status,
    s.module,
    s.machine,
    s.program,
    TO_CHAR(s.logon_Time,'DD-MON-YYYY HH24:MI:SS') AS logon_time
    FROM v$session s,
    v$process p
    WHERE s.paddr = p.addr
    ORDER BY s.username, s.osuser;
    >
    HTH
    Anand

  • Frequent Object Creation vs. synchronized

    HI all,
    I'm just looking to prompt a discussion I can learn from. Apologies if I'm missing something.
    Having just read the excellent articles over at:
    http://www-106.ibm.com/developerworks/java/library/j-threads1.html
    http://www-106.ibm.com/developerworks/java/library/j-threads2.html
    http://www-106.ibm.com/developerworks/java/library/j-threads3.html
    I was left wondering about the (largely unmentioned) trade-off between object creation and use of synchronization.
    If a particular part of a given system is heavily accessed then one might consider instantiating, and caching references to, components in an initialisation stage. In a multithreaded environment, this can obviously pose a problem.
    If these components aren't threadsafe then at some point use will have to be made of a synchronized block, unless the unsafe components are instantiated for every thread.
    The articles do mention the overrated cost of synchronization - how does this compare with the cost of frequent object instantiation?
    Thanks for your time,
    JohnG

    Well, let's time it (test program below):
    using no synchronization: 180 ms (baseline measurement, not thread safe)
    using new: 1111 ms
    using uncontended sync: 491 ms
    using contended sync: 49531 ms
    new is fast - ten million temporary object allocations and frees per second. A magnitude faster than in traditional malloc()/free() -based languages. new is rarely a performance problem in Java programs.
    Uncontended locks are fast - twenty million per second.
    Heavily contended locks slow you down. Way down. A second becomes a minute.
    Don't try to optimize unless you have measured a real performance bottleneck.
    Object pooling is unlikely to help. Exceptions being objects that are expensive to initialize and are created often (e.g. large buffers or arrays, cryptographic engines that take time to initialize, or connections to external systems such as databases). You'll need to measure first if object creation really is the bottleneck.
    public class t
        static class Calculator
         private int value;
         void initialize(int n)
             value = n;
         int result()
             return value * 2;
        static class NewThread
         extends Thread
         int result;
         public void run()
             for (int n = 0; n < 1000 * 1000; n++) {
              Calculator x = new Calculator();
              x.initialize(n);
              result += x.result();
        static class SyncThread
         extends Thread
         static Calculator x = new Calculator();
         int result;
         public void run()
             for (int n = 0; n < 1000 * 1000; n++) {
              synchronized (x) {
                  x.initialize(n);
                  result += x.result();
        // Not thread safe
        static class BaselineThread
         extends Thread
         static Calculator x = new Calculator();
         int result;
         public void run()
             for (int n = 0; n < 1000 * 1000; n++) {
              x.initialize(n);
              result += x.result();
        public static void main(String args[])
         throws Exception
         int thread_count = 10;
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++) {
              // threads run consecutively, not in parallel
              (threads[m] = new BaselineThread()).start();
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using no synchronization: " +
                          (end - start) + " ms");
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++)
              (threads[m] = new NewThread()).start();
             for (int m = 0; m < thread_count; m++)
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using new: " + (end - start) + " ms");
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++) {
              // threads run consecutively, not in parallel
              (threads[m] = new SyncThread()).start();
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using uncontended sync: " +
                          (end - start) + " ms");
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++)
              (threads[m] = new SyncThread()).start();
             for (int m = 0; m < thread_count; m++)
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using contended sync: " +
                          (end - start) + " ms");
    }

  • Lock object is not working automatically

    Hi experts,
    i have a problem , A table is updated by a program which is used by multiple user . I have used lock function module 'ENQUEUE_E_TABLE ' and 'DEQUEUE_E_TABLE' for that . when updation section occurs first user which come first go through it and for rest users amessage cones 'table is locked by XYZ user' . When first completes the updation resr users is not updating automatically they stand at that position where message comes. How to solve this issue?
    Avadhesh Chandra

    Hi,
    We can lock the table before updating the entries. Two types of locks are there.
    1. To lock the entire table. Here when the table is locked by one program, another program will not be able to modify it.
    2. To lock the particular record only. Here when the record is locked by one program, the other program can modify records other than the one locked.
    For option 1
    Use the FM ENQUEUE_E_TABLEE to lock the table and FM DEQUEUE_E_TABLEE to unlock table.
    For option 2
    Go to SE11. There enter the name of your lock object and create it. Next screen you have to mention which field you want to lock.
    For more info. on LOCK OBJECTS go to
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    If you want to lock the entire table, then use the FM said in option 1 in DO-ENDDO loop. 
    Run the loop till it gets successful (sy-subrc = 0)
    DO.
    *Call the FM.
    IF sy-subrc = 0.
        EXIT.
    ENDIF.
    ENDDO.
    If you want to just try some number of times rather than keep on looping then can use for eg: DO 100 TIMES.

  • How to show object creation in UML

    How to show object creation in UML

    In a sequence diagram, it's a line (with arrow) pointing to the new object and the <creates> or <new> tag as mentioned above.
    | obj 1  |
         |
         |    <creates>     ----------
         | -------------->  | obj 2  |
         |                  ----------or----------
    | obj 1  |
         |
         |      <new>       ----------
         | -------------->  | obj 2  |
         |                  ----------

  • Ora-04021 timeout occurred while waiting to lock object

    Hai All
    When adding a column into a table then an error comes error
    Error Message:
    ORA-04021: timeout occurred while waiting to lock object .....
    How it happens ...what is the solution....please help
    Shiju..

    Hi
    Identify the session that is using this object, kill it and then perform the ALTER table... or wait until the session that is accessing this table release it.
    Rgds
    Adnan

  • JDAPI Error: ORA-04020: deadlock detected while trying to lock object

    I have written a JDAPI program to perform read-only impact analysis and report any problems.
    The following error is occurring:
    "A deadlock among DDL and parse locks is detected.
    This deadlock is usually due to user errors in the design of an application or from issuing a set of concurrent statements which can cause a deadlock.
    ORA-04020: deadlock detected while trying to lock object /NSPC6/CHECK_FOR_FORM_CHANGE"
    The error refers to a procedure in a PL/SQL library.
    In one case the error occurred after my final "end of processing" message, which is followed only by a call to "Jdapi.shutdown()".
    Any ideas?
    Thanks,
    Neville Sweet.

    I have written a JDAPI program to perform read-only impact analysis and report any problems.
    The following error is occurring:
    "A deadlock among DDL and parse locks is detected.
    This deadlock is usually due to user errors in the design of an application or from issuing a set of concurrent statements which can cause a deadlock.
    ORA-04020: deadlock detected while trying to lock object /NSPC6/CHECK_FOR_FORM_CHANGE"
    The error refers to a procedure in a PL/SQL library.
    In one case the error occurred after my final "end of processing" message, which is followed only by a call to "Jdapi.shutdown()".
    Any ideas?
    Thanks,
    Neville Sweet.

  • FIM MA Export errors. There is an error executing a web service object creation.

    While checking for the permission, we have figured that the Built-In Synchronization account is being deleted by an Expiration Workflow.
    FIM MA Export errors. There is an error executing a web service object creation.
    While checking for the permission, we have figured that the Built-in Synchronization account was deleted by an Expiration Workflow
    Is there a way to restore. Thanks.

    I would re-run FIM setup - I think it can re-create this account
    If you found my post helpful, please give it a Helpful vote. If it answered your question, remember to mark it as an Answer.

  • Unable to delete Transport Request which contain locked objects

    Hi all,
    I need to delete  some unusable transport requests but as they contain locked objects, it's not possible to delete them. Release operation is just allowed. After releasing these transport requests, I can not find them any more in queue. Please help to find these  transport requests which are released and also provide a solution to delete instead of releasing them.
    Thanks in advance,
    Sanaz.

    Hi,
    Thank you for the reply.
    1. What do you mean by transport request , Shipment Request, Shipment Order or Tour.
    A. I mean requests which can be transported between SAP Systems using TMS (Transport Management System).
    2. What are the objects which has been locked and due to that you are facing this problem.
    A. There are diffrent object types. For examle some customizing have booen done or SAP Note correction has been implemented, ... Therefore some objects have been locked due to these operations
    3. Let's say if it's an freight Unit, then Pls confirm that System dump / error is not the cause for this.
    A. I have no idea about "Freight Unit".
    Thanks,
    Sanaz.

  • Xdb_installation_trigger does not support object creation of type SNAPSHOT

    hi everyone, i'm using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit on solaris sparc 5.10
    we like to send an email through SSL, and after searching here and there I found out that oracle DB 11g able to go throught the SSL.
    since upgrade our DB to 11g would not be an option, so i tried to export XDB of 11g and import it into XDB 10gR2 schema, it was a mess...
    then i just reinstall XDB using catnoqm.sql & catqm.sql
    and now one of our programmer cant run some script like above
    CREATE MATERIALIZED VIEW FIFSYS_MKT_SCHEME_MV_COY
    TABLESPACE MARKETING_TABLES
    PCTUSED    40
    PCTFREE    10
    INITRANS   2
    MAXTRANS   255
    STORAGE    (
    INITIAL          64K
    MINEXTENTS       1
    MAXEXTENTS       UNLIMITED
    PCTINCREASE      0
    FREELISTS        1
    FREELIST GROUPS  1
    BUFFER_POOL      DEFAULT
    +)+
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    REFRESH FORCE ON DEMAND
    WITH PRIMARY KEY
    AS
    +/* Formatted on 9/23/2010 1:07:42 PM (QP5 v5.114.809.3010) */+
    SELECT   coy_id,
    appl_branch_id,
    appl_object_code,
    product_type,
    ppdcf_paid_date,
    SUM (scheme_adm) scheme_adm,
    SUM (appl_unit) appl_unit,
    SYSDATE mkt_sysdate
    FROM   (SELECT   NVL (a.coy_id, '01') coy_id,
    a.branch_id appl_branch_id,
    DECODE (a.buss_unit, 'NMC', '2101', 'UMC', '2102', '2352')
    appl_object_code,
    a.platform product_type,
    TRUNC (c.contract_active_date) ppdcf_paid_date,
    NVL (s.ms_amt, 0) scheme_adm,
    NVL (o.total_item, 0) appl_unit
    FROM   ordmgmt.om_trn_appl_ms_lvl_object s,
    ordmgmt.om_trn_appl_hdr a,
    acctmgmt.ar_trn_sum_contracts c,
    +( SELECT appl_no, COUNT ( * ) total_item+
    FROM   ordmgmt.om_trn_appl_object
    GROUP BY   appl_no) o
    WHERE       s.appl_no = a.appl_no
    AND a.appl_no = o.appl_no
    AND s.ms_code IN ('MS03', 'MS14')
    AND c.appl_no = a.appl_no
    AND c.contract_no = a.contract_no
    +/*AND c.office_code = a.branch_id*/+
    AND NVL (a.coy_id, '01') = NVL (c.coy_id, '01'))
    GROUP BY   coy_id,
    appl_branch_id,
    appl_object_code,
    product_type,
    ppdcf_paid_date;
    COMMENT ON MATERIALIZED VIEW FIFSYS_MKT_SCHEME_MV_COY IS 'snapshot table for snapshot MARKETING.FIFSYS_MKT_SCHEME_MV_COY';
    and this error shown:
    ORA-00604 error occurred at recursive SQL level 1
    ORA-20000 Trigger xdb_installation_trigger does not support object creation of type SNAPSHOT
    ORA-06512 at line 32
    maybe some of you know how to solve this problem??
    and, this in the script of the xdb_installation_trigger
    DROP TRIGGER SYS.XDB_INSTALLATION_TRIGGER;
    CREATE OR REPLACE TRIGGER SYS.xdb_installation_trigger
    BEFORE
    CREATE ON DATABASE
    DECLARE
    sql_text varchar2(200);
    val number;
    BEGIN
    if (dictionary_obj_owner != 'XDB') then
    if (dictionary_obj_type = 'FUNCTION' or
    dictionary_obj_type = 'INDEX' or
    dictionary_obj_type = 'PACKAGE' or
    dictionary_obj_type = 'PACKAGE BODY' or
    dictionary_obj_type = 'PROCEDURE' or
    dictionary_obj_type = 'SYNONYM' or
    dictionary_obj_type = 'TABLE' or
    dictionary_obj_type = 'TABLESPACE' or
    dictionary_obj_type = 'TYPE' or
    dictionary_obj_type = 'VIEW' or
    dictionary_obj_type = 'USER'
    +)then+
    if (dictionary_obj_type  != 'PACKAGE BODY'
    +) then+
    sql_text := 'select count(*) from ALL_OBJECTS where owner = :1 and object_name = :2 and object_type = :3';
    execute immediate sql_text into val using dictionary_obj_owner, dictionary_obj_name, dictionary_obj_type;
    if (val = 0) then
    sql_text := 'select count(*) from dropped_xdb_instll_tab where owner = :1 and object_name = :2 and object_type = :3';
    execute immediate sql_text into val using dictionary_obj_owner, dictionary_obj_name, dictionary_obj_type;
    if (val = 0) then
    insert into xdb_installation_tab values
    +(dictionary_obj_owner, dictionary_obj_name, dictionary_obj_type);+
    end if;
    end if;
    end if;
    else
    raise_application_error(-20000, 'Trigger xdb_installation_trigger does not support object creation of type '||dictionary_obj_type);
    end if;
    end if;
    end;
    +/+
    /********************************************************************************/

    i'm so careless, after checking a fresh installation of the same version DB, i dont found xdb_installation_trigger.
    so just by simply remove that trigger & everything works just fine. :)

Maybe you are looking for

  • Custom field in General data of Travel request

    Hi All, I need to add a custom field in the General data section of the travel request screen.The requirement is such that if user creates an expense report corresponding to that travel request then the same field with the value should appear.Can any

  • Help needed in using exceptions

    can anyone please correct the code for me. i am posting the code after doing all my homework , i tried the best of me not able to solve the error. thanks in advance i would prefer a clue how to solve the error even after the clue if im not able to so

  • No sound from TomTom with Ford Bluetooth

    I have connected the IP4s with the Ford Bluettoth system and when trying to use TomTom I get not TTS. But when I discount the bluetooth I get TTS from TomTom. Has anyone had a similar problem and found a work around?

  • Unicode characters Autonumbering

    Hello all, I have FrameMaker 8 and I often work with Russian text. I didn't find how I can make up the cyrillic numbering display style. Like this: 1. 2. 3. 4.      а.      б.      в.      г. 5. 6. ... Thank you!

  • Creator 2 for OS X on Intel Core Duo?

    Hi, Does anyone know if the current Creator2 release for Mac OS X supports the machines with the new Intel Core Duo chips (e.g. iMac)? If not, does anyone know when the new machines are expected to be supported? I tried installing Creator2 on an iMac