Select on a lock table

Hi all,
i have this problem. there is a process that lock a table to execute many operation. I need to check if these operation are correct during the time that the table is locked. Its possible connect to the database and execute a select during the locked time of the table ?
Best regards
Walter

In Oracle, writers never block readers. Thus, you should be able to connect to the database and do a standard SELECT without a problem.
You won't, presumably, be able to see the changes that have been made by the process that is locking the table until that process finishes. Since locks are released when a transaction is committed or rolled back, I'm presuming that this process is doing everything in a single transaction.
Justin

Similar Messages

  • Lock Table and permit only SELECT-Statement

    Hi all,
    can I lock a Table and permit only SELECT-statements on a Table?
    Regards
    Leonid

    Hi Kamal,
    I would like to configure it in such a way that if I implement the SELECT statement, another user can't insert
    a data into the table.
    If it is possible, I even the LOCK would like in such a way to configure the fact that the entry of the user arrives into the buffer and if the table is unlocked, all lines from the Buffer again into the table.
    I make it in such a way:
    SQL Script script_test.sql:
    set echo off
    set verify off
    set pagesize 0
    set termout off
    set heading off
    set feedback off
    lock table mytable in share row exclusive mode;
    spool c:\Temp\script_info.lst
    select id||'|'||dae||'|'||name||'|'||name1||'|'||hiredate
    ||'|'||street||'|'||nr||'|'||plznum||'|'||city
    ||'|'||email||'|'||telephon||'|'||cddfeas||'|'||number
    ||'|'||why||'|'||fgldwer||'|'||wahl||'|'||adress
    ||'|'||las
    from mytable
    where las is null
    spool off
    spool c:\Temp\select_from_all_tables.lst
    select *
    from all_tables
    order by owner
    spool off
    spool c:\Temp\select1_from_all_tables.lst
    select *
    from all_tables
    order by owner
    spool off
    update mytable
    set las = 'x';
    commit;
    set feedback on
    set heading on
    set termout on
    set pagesize 24
    set verify on
    set echo on
    Afterwards I start another session:
    insert into briefwahl
    values(38,'11.06.2003 09:37','Test','Test','01.01.1990',
    'Test','12','90000','Test',
    '[email protected]','12345657','test','123',
    'test','test','test','test',
    null);
    Then I go into the first session and start script. And I go immediately into the second session and do commit; And although I have the table closed, the new entries are spent also with spool into the .lst-File. Why, I do not understand. And in the table all lines become updated.
    Regadrs
    Leonid
    P.S. Sorry for my English. I have write with translator.

  • LOCK TABLE vs select for update

    Hello All,
    if the requirement is to lock an entire huge table to prevent any users from performing any update statement, which statement has more performance gain and why: LOCK TABLE or select fro update nowait?
    is there any overhead of using LOCK TABLE statement?
    Thanks,

    The reason I said to revoke update privilege is because I do not understand the requirement. Why do you want to prevent users from updating the table? I am assuming that users should never be allowed to update the table. In that case locking the table and select for update would be no good. If you want to stop users from updating while some one else is updating, why? All the lock table or select for update will do is cause their session to wait (hang) until the locking process commits or rolls back. This could generate a few (sic) complaints that the user application is slow/freezing.
    If you can state the business problem, perhaps we can offer a solution.

  • Lock tables when load data

    Are there any way to lock tables when i insert data with SQL*Loader? or oracle do it for me automatically??
    how can i do this?
    Thanks a lot for your help

    Are there any problem if in the middle of my load (and commits) an user update o query data ?The only problem that I see is that you may run short of undo space (rollback segment space) if your undo space is limited and the user is running a long SELECT query for example: but this problem would only trigger ORA-1555 for the SELECT query or (less likely since you have several COMMIT) ORA-16XX because load transaction would not find enough undo space.
    Data is not visible to other sessions, unless, the session which is loading data, commits it. That's the way Oracle handle the read committed isolation level for transaction.
    See http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96524/c21cnsis.htm#2689
    Or what happens if when i want to insert data someone has busy the table?You will get blocked if you try to insert data that has the same primary key as a row being inserted by a concurrent transaction.

  • System error: Unable to lock table/view V_T077K_M

    Hi,
    Not able to work on field selection (OMSG) i am getting an error "System error: Unable to lock table/view V_T077K_M" checked in SM 12 also, but dint get there anything.
    please cud you help me in this regard,

    contact your basis team,  there might be an overflow of the lock table because of mass changes from other users (even for other tables)

  • Select query on a table with 13 million of rows

    Hi guys,
    I have been trying to perform a select query on a table which has 13 millions of entries however it took around 58 min to complete.
    The table has 8 columns with 4 Primary keys looks like below:
    (PK) SegmentID > INT
    (PK) IPAddress > VARCHAR (45)
    MAC Address > VARCHAR (45)
    (PK) Application Name > VARCHAR (45)
    Total Bytes > INT
    Dates > VARCHAR (45)
    Times > VARCHAR (45)
    (PK) DateTime > DATETIME
    The sql query format is :
    select ipaddress, macaddress, sum(totalbytes), applicationname , dates,
    times from appstat where segmentid = 1 and datetime between '2011-01-03
    15:00:00.0' and '2011-01-04 15:00:00.0' group by ipaddress,
    applicationname order by applicationname, sum(totalbytes) desc
    Is there a way I can improve this query to be faster (through my.conf or any other method)?
    Any feedback is welcomed.
    Thank you.
    Mus

    Tolls wrote:
    What db is this?
    You never said.
    Anyway, it looks like it's using the Primary Key to find the correct rows.
    Is that the correct number of rows returned?
    5 million?
    Sorted?I am using MySQL. By the way, the query time has been much more faster (22 sec) after I changed the configuration file (based on my-huge.cnf).
    The number of rows returned is 7999 Rows
    This is some portion of the my.cnf
    # The MySQL server
    [mysqld]
    port = 3306
    socket = /var/lib/mysql/mysql.sock
    skip-locking
    key_buffer = 800M
    max_allowed_packet = 1M
    table_cache = 256
    sort_buffer_size = 1M
    read_buffer_size = 1M
    read_rnd_buffer_size = 4M
    myisam_sort_buffer_size = 64M
    thread_cache_size = 8
    query_cache_size= 16M
    log = /var/log/mysql.log
    log-slow-queries = /var/log/mysqld.slow.log
    long_query_time=10
    # Try number of CPU's*2 for thread_concurrency
    thread_concurrency = 6
    Is there anything else I need to tune so it can be faster ?
    Thanks a bunch.
    Edited by: user578505 on Jan 17, 2011 6:47 PM

  • Select record from database table

    how to select a record from data-base table for current month in module-pool, i.e if current month is august then records selected should between 1/08/10 to 31/08/10.
    And, i also want to select records for last month i.e if current month is august then records selected should be between 1/07/10 to 31/07/10.
    And one thing more, it should work for every scenario. Like for months are changing then it should work according to that.
    Example: If month changes to October then current month ll be October and last month ll become September.
    Plz help me out.
    Moderator message: you chose a better forum this time, but the question is still too basic to be asked here, please (re)search yourself first, these forums are not catering to beginners.
    locked by: Thomas Zloch on Aug 8, 2010 9:41 PM

    Hi Nishant,
    You can use the option <b>ORDER BY </b> in your SELECT clause.
    This is the SAP Documentation for <b>ORDER BY </b> option.
    <i>Variant 1</i>
    <b>...ORDER BY PRIMARY KEY</b>
    <b>Effect</b>
    Sorts the selected lines in ascending order by the primary key of the database table. This variant is only permitted for SELECT * ....
    <i>Notes</i>
    Since views do not have a primary key, specifying ORDER BY PRIMARY KEY only makes sense with database tables. If, however, you do specify ORDER BY PRIMARY KEY with a view, all fields of the view are sorted in ascending order.
    <i>Variant 2</i>
    <b>ORDER BY f1 ... fn</b>
    <i>Effect</i>
    Sorts the selected records in ascending order by the specified column references f1 ... fn. If a list is also specified in the SELECT clause, the column references f1, ..., fn must appear in this list.
    By supplementing the statement with DESCENDING, you can sort in descending order using any of the fields f1, ..., fn.
    The default sort sequence is ascending order, but you can make this explicit by adding the addition ASCENDING.
    Consider this code this will select the latest 10 records form DB table(Note can use <b>Variant 2</b> for DB tables also.
    REPORT zarun_1.
    DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE.
    START-OF-SELECTION.
      SELECT * FROM mara
                INTO TABLE it_mara
                <b>UP TO 10 ROWS                "No of rows you need(give 1 here)
               ORDER BY matnr DESCENDING.    "Specify the Key Fields here.</b>
      LOOP AT it_mara.
        WRITE : / it_mara-matnr,
                  it_mara-mtart.
      ENDLOOP.
    Regards,
    Arun Sambargi.
    Message was edited by: Arun Sambargi

  • Lock table overflow 1 & Error 7 when sending an IDoc

    dear all,
    we r getting error in purchasing cube for itm datasource
    2lis_o2_itm for delta...
    1.Lock table overflow 1
    2.Error 7 when sending an IDoc
    3.Errors in source system
    when i check in details it is showing :
    Data Package 1 : arrived in BW ; Processing : Selected number does not agree with transferred n
    its daily delta..plz give me solution its urgent....
    at request in manage...we got some records...wat shud  the process..
    Thanks in adv
    pinky reddy
    Edited by: pinky reddy on Apr 8, 2008 7:42 AM

    solved

  • Select from view -v- table

    Hi Guys,
    I was just hoping to get your opinion on something.
    I have a procedure in Production that is taking longer and longer to finish and sticks on one certain section of code.
    The code is an INSERT into the main dimension table.
    This same procedure runs fine on TEST and the section of code completes an awful lot quicker.
    The traffic on Production is a lot heavier and there have been applications developed by people other than myself which SELECT from this dimension table. I'm assuming, based on the fact the code in Test and Production are identical, that this increased traffic could be eating up the bandwith and slowing the jobs.
    So, I was thinking - if I create Views and let the other applications hit the views as opposed to the main table, will this help speed it up. I did this before on a Teradata platform using a 'dirty read' which worked quite well but Oracle doesn't seem to offer this option.
    What do you guys think? Could this work or do I need to take a different approach.
    Thank You.

    GerardMcL wrote:
    I meant ordinary views.
    I was wondering if there was a way of putting some locking code in or asking for a dirty read that would speed up the SELECT from the table?There is no such thing as a dirty read with Oracle -- Teradata, SQL Server, Sybase, IBM, etc., have different locking architectures where reads can block write and writes can block reads, and that is not an issue with Oracle.
    If there's a query performance problem, which is what that will be if the SELECTs are slow, then if you could follow the following links, that will help diagnosis immensely:
    [How to Post A Tuning Request|http://forums.oracle.com/forums/thread.jspa?threadID=863295&tstart=0]
    And:
    [When your Query takes too long|http://forums.oracle.com/forums/thread.jspa?messageID=1812597#1812597]
    There is such as thing as stale reads, against Materialized Views, which are views that actually materialize and store the results of a query, and which then can subsequently be queried.

  • Lock table overflow ???

    Hi All,
    We just installed a BW - IDES system, and in the process of activation of Business Content. There is a problem while activation, after the collection of CRM BI Content the system is giving following error, while installing the BI Content:
    <b>Message no. MC603</b>
    <b>Diagnosis</b> - This table overflowed when trying to enter SAP locks in the lock table.
    <b>System Response</b> - The locks could not be set.
    <b>Procedure</b> - Contact your system administrator. If this error occurs frequently, change the size of the profile parameter 'enque/table_size'. This parameter defines the size of the lock table in KByte.
    Can someone please list down the steps to be taken to resolve the error or change the size of profile parameter.
    Thanks & Regards,
    Vikas Sharma

    Hallo,
    goto trans: /nRZ10 --> Select your instance profil and change or add parametere: 'enque/table_size' with the appropiate size. Best: Contact your BASIS people to change this parameter. And restart the system.
    Best Regards,
    Suan Liono

  • Insert & Update while Locking tables

    Update & Insert
    Is it possible for me to insert a record and update 2 fields in another record, whil locking the database tables for the process to take place?
    If so, how?
    Thanks
    Pete

    I don't know which database server you are using. But in MySQL, you can do something like this:
    <?php
    function get_next_number( $field = 'id' )
         $id = 0;
         //Lock the table for write
         mysql_query('LOCK TABLES name_of_table WRITE');
         $sql = 'SELECT '.$field.' FROM name_of_table ORDER BY '.$field.' DESC LIMIT 1';
         $query = mysql_query($sql);
         if ( mysql_num_rows($query) > 0 )
              $row = mysql_fetch_row($query);
              //Get the $field value
              $id = $row[0];
         //Unlock tables
         mysql_query('UNLOCK TABLES');
         return ++$id;
    ?>
    I didn't test this function, but the idea is that
    Check if you are connected to MySQL server
    Regards,
    Rafael

  • Locking tables

    I am declaring and using the following cursor:
         CURSOR curCompany IS
              SELECT c.Company_ID, c.No_Employees
                   FROM Company c
                   WHERE (SELECT COUNT(*) FROM Student s
                        WHERE s.Company_ID = c.Company_ID) > 0;I would like to include a FOR UPDATE OF Student.col to it so rows could be locked while they are being updated, but can't.
    1) What is the best way of locking the table? I've been reading up on LOCK TABLE and am willing to use it but would like to hear what you guys have to say on this.
    2) Is there an operator/function like EXISTS that would replace the sub-query in the WHERE clause?

    I will tell you real world scenario:
    <br><br>
    Let suppose I have a table from I am getting series for my transaction depending on some parameter.<br>
    <br>
    Here at the time of pre insert in my form I use as follows:
    <br><br>
    Select series from table_name FOR UPDATE;
    <br><br>
    Offcourse I add in condition also.
    <br><br>
    At the time of post insert I release the lock as follows:
    <br><br>
    Update table_name SET series+1 with condition.
    <br><br>
    Why I am doing this because I want to make sure same number is not used by two transaction.
    <br><br>
    Raj<br><br>
    <b>www.oraclebrains.com<a>
    <br><font color="#FF0000" size="1">POWERED by the people, to the people and for the people WHERE ORACLE IS PASSION.</font></b>

  • Few lock table questions ...

    I have an app with Java + Oracle. I have a few tables which can be modified ( select, insert, up, del) by more than one user.
    For ex
    //---------- get info from database
    SELECT a FROM A;
    // later
    SELECT b FROM B;
    // --------- end
    Q1). how can I make sure that after I select from A, no one modifies table B, until I select from B ?
    Q2). If I have 3 tables and I have to insert some values, in all of them, how should I do this ? ( lock tables, put the insert * 3 into an transaction, release locks)
    Q3). I know that jdbc-odbc isn't very good, but still, can I use it ?

    Q1). how can I make sure that after I select from A,
    no one modifies table B, until I select from B ?No one modifies table B in any way at all? While the user goes for a coffee break? Why would you want that?
    Q2). If I have 3 tables and I have to insert some
    values, in all of them, how should I do this ? ( lock
    tables, put the insert * 3 into an transaction,
    release locks)Just insert the records. You can put the three inserts in a transaction, if you need that, but there's no point in preventing other users from accessing the tables while you do that.
    Database applications that use Oracle or other databases designed for large numbers of users rarely lock tables. If your design leads you into a place where you have to lock tables then you probably need to go back and fix your design so that it supports multiple users in a normal way.
    Q3). I know that jdbc-odbc isn't very good, but
    still, can I use it ?Sure. But Oracle comes with its own JDBC drivers so you don't need to.

  • Lock table for update in adf

    dear all ,
    am using Jdeveloper 11.1.1.3 with oracle database 10g,
    now what i need to do is when inserting a new row in one of my entities i need to lock the entire database table until the commit happen...
    i'll explain to u why I need to do this,,, let say that the table x contains the following columns
    x_pk number, ( which is the primary key )
    x_serial number,
    x_type varchar2 );
    now am getting x_pk from a sequence on a database so its not a problem,
    but for x_serial it needs to be serialized per x_type , now in oracle forms developer i used to do the following in per-insert trigger on the block level-->
    lock table for update then selecting the max serial per the type then use it for setting the :x_serial that is in the same block...
    now in ADF , i should do this in the do_dml when the operation==DML_INSERT but am not sure what to write and if it will be working same as it was in the form developer
    thanks ,
    Lama

    Delta,
    I wrote a [url http://stegemanoracle.wordpress.com/2006/03/15/using-updatable-views-with-adf/]blog post some time ago for an earlier version of JDeveloper that implemented some custom locking behaviour for EOs - perhaps you can adapt the technique there to your needs?
    John

  • Lock table in share mode

    hi ...
    what is the benifit to lock the table explicitily using sql command
    "lock table <table_name> in share mode"
    is there any performance gain. ?
    code....
    ==================
    *Here, we lock the table in share mode
    EXEC SQL
    LOCK TABLE GLDM IN SHARE MODE
    END-EXEC.
    EXEC SQL
    LOCK TABLE GLDV IN SHARE MODE
    END-EXEC.
    EXEC SQL DECLARE D_ACCOUNT_CURSOR CURSOR FOR
    SELECT /*+ FIRST_ROWS */
    ===================================================

    As others have pointed out, this type of locking should be unnecessary. Unless there is documentation explaining why the locks are there, we can only guess the intention. Here are a couple of thoughts:
    a) The cursor select is used to create results that are copied from one table to another (e.g. the query is against gdlm and the results are used to update gdlv in a loop) - a lock on the table being updated might then be seen as necessary to ensure that no other process updates it in a conflicting fashion whilst the loop is running - thus avoiding problems of inconsistent results, or a locking/deadlocking issues.
    b) If the cursor loop takes a long time to run then (for read consistency purposes) the session has to keep generating clones of blocks that have changed since the query started. So the table locking may have been introduced as a way of reducing this cloning work by stopping any other changes. This could be seen as a performance enhancer - at a cost of blocking anyone else who wants to update the tables.
    c) For reasons similar to (b) it may have been introduced to reduce the risk of Oracle error ORA-01555 (Snapshot too old).
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk

Maybe you are looking for

  • How do I delete a Dependant Activity that was accidentally added to a Service Request?

    It does not let me "delete" the activity, any other I add I can delete. Also I tried to "Cancel" the Service Request, and it gave me an error, shown below. Any Suggestions? This is the second time I have had this issue, but before I was able to cance

  • The downloads window does not open

    I am running Beta 4.0b7 and whilst I am able to download files I cannot see the downloads window. I have tried selecting the window via tools and downloads but it does not appear. However, after doing this it is listed in the 'window' menu, although

  • Buffalo Linkstation is not recognized when plugged directly into mac

    I recently received a Buffalo Linkstation and tried setting it up, when i got it all up and running, the lights come on, but it won't connect to my mac, it's connected via ethernet cable I do not have it plugged into a router and don't want to go get

  • Cannot send mail - server does not allow relaying

    I keep getting a sporadic error message on my ipad: "cannot send mail. The recipient was rejected by the server because it does not allow relaying". Sometimes it doesn't happen and the mail sends fine. Sometimes I get the error message but the messag

  • Wifi printer not connected

    MB Pro with Lion 10.7.5 working with Epson Stylus SX535WD was fine with wifi printing and suddenly, from one print job to the next, announces "The printer is not connected".  Works fine from my other MBP running the same software.  I have a feeling t