Select Statement Blocking Delete Operation

Hi Experts,
In a Single table am trying to do delete operation but it has been blocked by simple select query.
Database setting : Read Committed Snapshot already set to ON for that database.
Any Idea why SELECT blocking DELETE.
FYI : Before Select statement I could noticed the following setting "set transaction isolation level  read committed".
Kindly Advise
Regards,
Nandhu

FYI : Before Select statement I could noticed the following setting "set transaction isolation level  read committed".
Hi NandhuJana,
1. Did you read
Uri Dimant's response?
Please try to remove this statement and check again
2. When we ask you for DDL+DML , the idea is to let us the option to (1) reproduce the issue in some cases, (2) get the best information which is the real database structure, queries, etc'. In this case for example I do not see the isolation level statement
in your code and we need it to understand what is happening :-) The order and structure (nested transactions for example) of statements is what important here.
3. you can check your isolet level using one of those options to make sure what is going in your script:
SELECT TRANSACTION_ISOLATION_LEVEL = CASE transaction_isolation_level
WHEN 0 THEN 'Unspecified'
WHEN 1 THEN 'ReadUncommitted'
WHEN 2 THEN 'ReadCommitted'
WHEN 3 THEN 'Repeatable'
WHEN 4 THEN 'Serializable'
WHEN 5 THEN 'Snapshot'
END
FROM sys.dm_exec_sessions
where session_id = @@SPID
GO
DBCC USEROPTIONS WITH NO_INFOMSGS
GO
I hope this is helpful :-)
  Ronen Ariely
 [Personal Site]    [Blog]    [Facebook]

Similar Messages

  • How can write select statement inside case operator

    Hi all,
    I like to write a query which get result from other table in case operator.
    e.g
    select a,b,c from dual
    where a=1
    and b=case when b is null then "select any value from other table" else null end;
    Please help me to write this query.
    Thanks

    sorry, but thats funny.
    You ask for case with subquery and choosed a solution with decode as correct.
    Furthermore, the solution proposed might not be so useful.
    First of all many people prefer case over decode, because of understandability and readability of the code (toad has this as a coding rule built in too)
    Secondly in this case the decode does nothing. Take a closer look:
    select a,b,c from tableA a
    where a.a = 1
    and a.b =(select decode(a.b,null,( select 1 from tableB b where rownum = 1 ),a.b) from dual)the decode chooses the subselect if a.b is null. But if a.b is null the a.b on the left side is null also, so the predicate will never be true.
    aside from this, you can write this shorter as
    a.b=nvl(a.b,(select 1 from tableB b where rownum = 1))so what will work in such a case might be
    ANEXPRESSION(Literal, scalar subquery, ...) =nvl(a.b,(select 1 from tableB b where rownum = 1))otherwise look for a solution with case ;-)
    regards
    Edited by: chris227 on 12.05.2012 02:12

  • Bind Variable in SELECT statement and get the value  in PL/SQL block

    Hi All,
    I would like  pass bind variable in SELECT statement and get the value of the column in Dynamic SQL
    Please seee below
    I want to get the below value
    Expected result:
    select  distinct empno ,pr.dept   from emp pr, dept ps where   ps.dept like '%IT'  and pr.empno =100
    100, HR
    select  distinct ename ,pr.dept   from emp pr, dept ps where   ps.dept like '%IT'  and pr.empno =100
    TEST, HR
    select  distinct loc ,pr.dept   from emp pr, dept ps where   ps.dept like '%IT'  and pr.empno =100
    NYC, HR
    Using the below block I am getting column names only not the value of the column. I need to pass that value(TEST,NYC..) into l_col_val variable
    Please suggest
    ----- TABLE LIST
    CREATE TABLE EMP(
    EMPNO NUMBER,
    ENAME VARCHAR2(255),
    DEPT VARCHAR2(255),
    LOC    VARCHAR2(255)
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (100,'TEST','HR','NYC');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (200,'TEST1','IT','NYC');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (300,'TEST2','MR','NYC');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (400,'TEST3','HR','DTR');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (500,'TEST4','HR','DAL');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (600,'TEST5','IT','ATL');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (700,'TEST6','IT','BOS');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (800,'TEST7','HR','NYC');
    COMMIT;
    CREATE TABLE COLUMNAMES(
    COLUMNAME VARCHAR2(255)
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('EMPNO');
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('ENAME');
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('DEPT');
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('LOC');
    COMMIT;
    CREATE TABLE DEPT(
    DEPT VARCHAR2(255),
    DNAME VARCHAR2(255)
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('IT','INFORMATION TECH');
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('HR','HUMAN RESOURCE');
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('MR','MARKETING');
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('IT','INFORMATION TECH');
    COMMIT;
    PL/SQL BLOCK
    DECLARE
      TYPE EMPCurTyp  IS REF CURSOR;
      v_EMP_cursor    EMPCurTyp;
      l_col_val           EMP.ENAME%type;
      l_ENAME_val       EMP.ENAME%type;
    l_col_ddl varchar2(4000);
    l_col_name varchar2(60);
    l_tab_name varchar2(60);
    l_empno number ;
    b_l_col_name VARCHAR2(255);
    b_l_empno NUMBER;
    begin
    for rec00 in (
    select EMPNO aa from  EMP
    loop
    l_empno := rec00.aa;
    for rec in (select COLUMNAME as column_name  from  columnames
    loop
    l_col_name := rec.column_name;
    begin
      l_col_val :=null;
       l_col_ddl := 'select  distinct :b_l_col_name ,pr.dept ' ||'  from emp pr, dept ps where   ps.dept like ''%IT'' '||' and pr.empno =:b_l_empno';
       dbms_output.put_line('DDL ...'||l_col_ddl);
       OPEN v_EMP_cursor FOR l_col_ddl USING l_col_name, l_empno;
    LOOP
        l_col_val :=null;
        FETCH v_EMP_cursor INTO l_col_val,l_ename_val;
        EXIT WHEN v_EMP_cursor%NOTFOUND;
          dbms_output.put_line('l_col_name='||l_col_name ||'  empno ='||l_empno);
       END LOOP;
    CLOSE v_EMP_cursor;
    END;
    END LOOP;
    END LOOP;
    END;

    user1758353 wrote:
    Thanks Billy, Would you be able to suggest any other faster method to load the data into table. Thanks,
    As Mark responded - it all depends on the actual data to load, structure and source/origin. On my busiest database, I am loading on average 30,000 rows every second from data in external files.
    However, the data structures are just that - structured. Logical.
    Having a data structure with 100's of fields (columns in a SQL table), raise all kinds of questions about how sane that structure is, and what impact it will have on a physical data model implementation.
    There is a gross misunderstanding by many when it comes to performance and scalability. The prime factor that determines performance is not how well you code, what tools/language you use, the h/w your c ode runs on, or anything like that. The prime factor that determines perform is the design of the data model - as it determines the complexity/ease to use the data model, and the amount of I/O (the slowest of all db operations) needed to effectively use the data model.

  • Delete operation is not working to delete selected row from ADF table

    Hi All,
    We are working on jdev 11.1.1.5.3. We have one ADF table as shown below. My requirement is to delete a selected row from table, but it is deleting the first row only.
    <af:table value="#{bindings.EventCalendarVO.collectionModel}" var="row"
    rows="#{bindings.EventCalendarVO.rangeSize}"
    emptyText="#{bindings.EventCalendarVO.viewable ? applcoreBundle.TABLE_EMPTY_TEXT_NO_ROWS_YET : applcoreBundle.TABLE_EMPTY_TEXT_ACCESS_DENIED}"
    fetchSize="#{bindings.EventCalendarVO.rangeSize}"
    rowBandingInterval="0"
    selectedRowKeys="#{bindings.EventCalendarVO.collectionModel.selectedRow}"
    selectionListener="#{bindings.EventCalendarVO.collectionModel.makeCurrent}"
    rowSelection="single" id="t2" partialTriggers="::ctb1 ::ctb3"
    >
    To perform delete operation i have one delete button.
    <af:commandToolbarButton
    text="Delete"
    disabled="#{!bindings.Delete.enabled}"
    id="ctb3" accessKey="d"
    actionListener="#{AddNewEventBean. *deleteCurrentRow* }"/>
    As normal delete operation is not working i am using programatic approach from bean method. This approach works with jdev 11.1.1.5.0 but fails on ver 11.1.1.5.3
    public void deleteCurrentRow (ActionEvent actionEvent) *{*               DCBindingContainer bindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding dcItteratorBindings =
    bindings.findIteratorBinding("EventCalendarVOIterator");
    // Get an object representing the table and what may be selected within it
    ViewObject eventCalVO = dcItteratorBindings.getViewObject();
    // Remove selected row
    eventCalVO.removeCurrentRow();
    it is removing first row from table still. Main problem is not giving the selected row as current row. Any one point out where is the mistake?
    We have tried the below code as well in deleteCurrentRow() method
    RowKeySet rowKeySet = (RowKeySet)this.getT1().getSelectedRowKeys();
    CollectionModel cm = (CollectionModel)this.getT1().ggetValue();
    for (Object facesTreeRowKey : rowKeySet) {
    cm.setRowKey(facesTreeRowKey);
    JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)cm.getRowData();
    rowData.getRow().remove();
    The same behavior still.
    Thanks in advance.
    Rechin
    Edited by: 900997 on Mar 7, 2012 3:56 AM
    Edited by: 900997 on Mar 7, 2012 4:01 AM
    Edited by: 900997 on Mar 7, 2012 4:03 AM

    JDev 11.1.1.5.3 sounds like you are using oracle apps as this not a normal jdev version.
    as it works in 11.1.1.5.0 you probably hit a bug which you should file with support.oracle.com...
    Somehow you get the first row instead of the current row (i guess). You should debug your code and make sure you get the current selected row in your bean code and not the first row.
    This might be a problem with the bean scope too. Do you have the button (or table) inside a region? Wich scope does the bean have?
    Anyway you can try to remove the iterator row you get
    public void deleteCurrentRow (ActionEvent actionEvent) { DCBindingContainer bindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding dcItteratorBindings =
    bindings.findIteratorBinding("EventCalendarVOIterator");
    dcItteratorBindings.removeCurrentRow();Timo

  • Operation in Select Statement

    Hi,
    In an ABAP select statement, how to do operations on two columns of a dictionary transparent table(say division or multiplication on two column values) ?
    Reward points will be awarded .
    TIA
    Regards,
    Anindita

    hi,
    see the below link
    i hope it will useful for u .
    http://help.sap.com/saphelp_nw04/helpdata/en/62/10a423384746e8bf5f15ccdd36e8b1/content.htm
    SELECT AVG(salary) FROM employees
    SELECT COUNT(*) FROM employees
    SELECT COUNT(DISTINCT employee_name) FROM employees
    SELECT employee_name, salary + benefit
                   FROM employees
                   WHERE salary < 0.8 *
                      ( SELECT MAX( salary ) FROM employees )
    Arithmetic Expressions. For all employees that have a salary not exceeding 80% of the salary of the maximum salary of all employees, this query returns the name of the employee and the sum of its salary and its benefit.
    reward if its useful
    Edited by: p541399 on Feb 28, 2008 5:49 PM

  • Delete adjacent duplicates how to use in the below select statement

    hi i have a problem
    i am suing the below select statement
    SELECT    a~extno
              a~guid_lclic       " for next select
              e~ctsim
              e~ctsex
    *revised spec 3rd
              f~guid_pobj
              f~amnt_flt
              f~amcur
              f~guid_mobj
              e~srvll     "pk
              e~ctsty     "PK
              e~lgreg  "PK
      INTO TABLE gt_sagmeld
      FROM /SAPSLL/LCLIC  as a
      INNER JOIN /sapsll/tlegsv as e on elgreg = algreg
      inner join /sapsll/legcon as f on fguid_lclic = aguid_lclic   " for ccngn1 selection
      inner join /sapsll/corcts as g on gguid_pobj = fguid_pobj
                               where   a~extno in s_extno.
      sort gt_sagmeld by guid_lclic lgreg ctsty srvll GUID_POBJ GUID_MOBJ.
      delete adjacent duplicates from gt_sagmeld comparing guid_lclic lgreg ctsty srvll GUID_POBJ GUID_MOBJ .
    now i am confused how to use delete adjacent dupliacate and on which fields
    as first table /sal../lclic primary key is guid_lclic
    and it is joined to table
    legcon by guid_lclci ( not a primary key here)
    legcon primary key is guid_legcon
    and table 3 legsv by lgreg (pk here)
    table 3 has tow more primary key srvll and ctsty also
    NOW MY QUESTIO IS TAHT IS I USE ABOVE DELETE ADJACENT STATMENT IT FETCHES 20 LAKH RECORDS
    I WANT TO REDUCE IS LET ME KNOW ON WHAT fields i need to use delete adjacen duplicates
    or use comparing all fields?
    regards
    Arora

    hi sudha
    if u see my select statement is contains four Primary keys
    srvll
    lgreg
    ctsty
    guid_lclic
    but the next table connected to this table legcon is by guid_pobj and anothe table by guid_mobj
    and if i take this gt_sagmeld to another temp table and i find abt 10 lakh uniques guid_pobj
    similary 6 lakh guid_mobj so the next slect is hanpering because of this
    not COMING TO OUR POINT IF I SORT ONLY BY OUR PRIMARY KEYS NOT TAKING INTO ACCOUNT TEH GUID_POBJ AND GUID_MOBJ
    THE ENTRIES ARE VERY LESS BUT IF I TAKE INOT ACCCOUNT IN GT_SAGMELD THE ENTRIES ARE ABT 20 LAKH
    SO I AM NOT SURE WHETHER TO TAKNE GUID_POBJ AND GUID_MOBJ INOT ACCOUNT FOR DELECTING ADJACENT DUPLICATES?
    HENCE THE QUESTION OF ON WHICH FIRLD DELETE OR COMPARING ALL FIELDS I USE?

  • FETCHING VALUES IN MULTI RECORD BLOCK FROM ANOTHER TABLE USING SELECT STATEMENT.

    Hi,
    I have one multi record block in which i want to fetch values
    (more then one record) from another table using select statement
    IN KEY NEXT ITEM.I am getting following error.
    ORA-01422: exact fetch returns more than requested number of rows
    Thanks in advance.

    In your case I see no reason to use non-database block and to try to populate it from a trigger with a query, instead of using the default forms functionality where you can associate the block and the fields with table, create where clause using bind variables and simply use execute_query() build-in to populate the block. The power of the forms is to use their build-in functionality to interact with the database.
    Also, you can base your block on a query, not on a table and you dynamically change this query using set_block_property() build-in. You can use any dynamic queries (based on different data sources) and you simply need to control the column's data type, the number of the columns and their aliases. Something like creating inline views as a block data source.
    However, you can replace the explicit cursor with implicit one like
    go_block('non_db_block_name');
    first_record();
    FOR v_tab IN (SELECT *
    FROM tab
    WHERE col_name = :variable)
    LOOP
    :non_db_block_name.field1 := v_tab.col1;
    :non_db_block_name.field2 := v_tab.col2;
    next_record();
    END LOOP;

  • Cp  operator in select statement

    Hi i am getting error when i write the below select statement, could any one please let me know, how to use  CP operator in select statement
    my code was
    SELECT lifnr name1 FROM lfa1 INTO CORRESPONDING
            FIELDS OF TABLE lt_lfa1 
            WHERE lifnr CP lv_lifnr AND
                  name1 CP  lv_name1.
    Thanks
    Srini
    Message was edited by: Manish Kumar <spoonfeeding, thread locked by moderator>
    Message was edited by: Manish Kumar

    either you have select-options with lifnr and name and use them in the below query as
    SELECT lifnr name1 FROM lfa1 INTO CORRESPONDING
            FIELDS OF TABLE lt_lfa1 
            WHERE lifnr in s_lifnr AND
                  name1 in s_name1.
    else you need to declare internal tables with structure as below..
    DATA: begin of ls_user1,
        sign type c,
        option(2) type c,
        low(90) type c,
        high(90) type c,
       end of ls_user1.
    data: lt_lifnr like ls_user1 occurs 0,
             lt_name1 like ls_user1 occurs 0.
    and then populate these as
    ls_user1-sign = 'I'.
    ls_user1-option = 'CP'.
    ls_user1-low = '*'.  populate with whatever pattern you want
    APPEND ls_user1 TO lt_lifnr
    similarly do it for NAME1 and use them in the query.

  • Select statement from a join file deletes the primary records with MS Expl.

    Hello,
    is reality,
    Select statement from a join file deletes the primary records with MS Explorer 6, Firefox not, this with a normal data provider or with a normal "select..." statement.
    This is very strange, I should have a.a.s.p. a solution or workaround
    Thanks, Franco.
    Message was edited by:
    fbiaggi

    Please see the following excerpt from the online documentation.
    http://docs.oracle.com/cd/E11882_01/server.112/e22490/ldr_modes.htm#SUTIL1332
    Enabled Constraints
    During a direct path load, the constraints that remain enabled are as follows:
    NOT NULL
    UNIQUE
    PRIMARY KEY (unique-constraints on not-null columns)
    NOT NULL constraints are checked at column array build time. Any row that violates the NOT NULL constraint is rejected.
    Even though UNIQUE constraints remain enabled during direct path loads, any rows that violate those constraints are loaded anyway (this is different than in conventional path in which such rows would be rejected). When indexes are rebuilt at the end of the direct path load, UNIQUE constraints are verified and if a violation is detected, then the index will be left in an Index Unusable state. See "Indexes Left in an Unusable State".

  • Help in Delete operation

    I have a problem when deleting rows from a table. When I created the database the following delete statement worked fine, but now it takes a lot to complete. To delete 600 rows it takes more than 10 minutes. Maybe the transaction log is full, but i don't know how to check the space assigned to it or where is it.
    The delete operation is the following one.
    DELETE FROM event_TTT WHERE event_TTT.event_id IN
    (SELECT event.event_id FROM event WHERE event_TTT.event_id=event.event_id and event.MM_id=1328)

    Thank you for your information about statistics. After reading some papers and after checking that automatic statistics are being gathered in my system, I think that my tables do not fulfill the requirements to gather statistics manually ("statistics on tables which are significantly modified during the day"). Maybe I'm wrong. I'll continue reading about this.
    Anyway, I've new data about my delete operation. I think it is very slow, but I'll give you the details:
    DELETE FROM event_track e
    WHERE EXISTS
    SELECT
    NULL
    FROM event e1
    WHERE e1.event_id = e.event_id
    AND e1.pdep_mission_id = 1328
    AND ROWNUM = 1
    The is an index on e1.pdep_mission_id.
    e1.event_id and e.event_id are primary keys.
    Number of rows on e = 117000.
    Number of rows on e1 = 120000
    Number or rows to delete = 3500
    This is the execution plan (with autotrace):
    Plan hash value: 660928614
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | DELETE STATEMENT | | 1 | 254 | 217K (1)| 00:31:20 |
    | 1 | DELETE | EVENT_TRACK | | | | |
    |* 2 | FILTER | | | | | |
    | 3 | TABLE ACCESS FULL | EVENT_TRACK | 119K| 28M| 667 (3)| 00:00:06 |
    |* 4 | COUNT STOPKEY | | | | | |
    |* 5 | TABLE ACCESS BY INDEX ROWID| EVENT | 1 | 9 | 2 (0)| 00:00:01 |
    |* 6 | INDEX UNIQUE SCAN | PK_EVENT271 | 1 | | 1 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - filter( EXISTS (SELECT 0 FROM "PDEP"."EVENT" "E1" WHERE ROWNUM=1 AND
    "E1"."EVENT_ID"=:B1 AND "E1"."PDEP_MISSION_ID"=1305))
    4 - filter(ROWNUM=1)
    5 - filter("E1"."PDEP_MISSION_ID"=1305)
    6 - access("E1"."EVENT_ID"=:B1)
    Estadísticas
    11207 recursive calls
    26273 db block gets
    24517966 consistent gets
    23721872 physical reads
    4316076 redo size
    932 bytes sent via SQL*Net to client
    1105 bytes received via SQL*Net from client
    6 SQL*Net roundtrips to/from client
    12 sorts (memory)
    0 sorts (disk)
    3518 rows processed
    This operation took 2 hours and 5 minutes to complete the deletion of 3500 rows. Do I have to assume that this is correct or maybe I'm doing something wrong ??
    Thank you in advance.

  • Excessive flashback log generates with select statement

    Hi everyone;
    We have some extractions taken from a "flashback on" database.
    Extractions are just select statements but when they are run, database produces excessive flashback logs.
    What may be the reason database produce flashback logs with just select statements?
    (It's certain that there are no insert-update-delete operations)
    Version: 10.2.0.4.3
    Thanks...

    Do you do heavy update/delete before you select the statements ?
    I am not very sure if delayed block cleanout also have the same effect on flashback logs but the output below is leading me to think that way
    HR@ORACOS> select * from v$flashback_database_stat;
    BEGIN_TIME        END_TIME          FLASHBACK_DATA    DB_DATA  REDO_DATA ESTIMATED_FLASHBACK_SIZE
    20100527 15:32:53 20100527 15:50:16      875266048 1207132160 2038729728                        0
    20100527 14:32:50 20100527 15:32:53      248160256  127295488  450139648               1.3215E+10
    20100527 13:32:48 20100527 14:32:50       10452992   15646720    4400640               1.5549E+10
    20100527 12:32:43 20100527 13:32:48      745693184  948461568 1311620608               2.2789E+10
    20100527 11:25:56 20100527 12:32:43     1262026752 1984741376 2358546432               2.7212E+10
    HR@ORACOS> set autotrace traceonly statistics
    HR@ORACOS>  update base_table_np set y='INVALID';
    commit;
    4021808 rows updated.
    Statistics
           2512  recursive calls
        8341430  db block gets
        4069140  consistent gets
         120569  physical reads
    1908471980  redo size
            848  bytes sent via SQL*Net to client
            793  bytes received via SQL*Net from client
              3  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
        4021808  rows processed
    HR@ORACOS> set autotrace off;
    HR@ORACOS> select * from v$flashback_database_stat; 
    HR@ORACOS>
    BEGIN_TIME        END_TIME          FLASHBACK_DATA    DB_DATA  REDO_DATA ESTIMATED_FLASHBACK_SIZE
    20100527 15:32:53 20100527 16:00:36     1236664320 2021974016 4019910656                        0
    20100527 14:32:50 20100527 15:32:53      248160256  127295488  450139648               1.3215E+10
    20100527 13:32:48 20100527 14:32:50       10452992   15646720    4400640               1.5549E+10
    20100527 12:32:43 20100527 13:32:48      745693184  948461568 1311620608               2.2789E+10
    20100527 11:25:56 20100527 12:32:43     1262026752 1984741376 2358546432               2.7212E+10
    HR@ORACOS> set autotrace traceonly statistics
    HR@ORACOS> select * from base_table_np;
    4021808 rows selected.
    Statistics
            139  recursive calls
              0  db block gets
          53908  consistent gets
           4404  physical reads
        1652384  redo size                                                  ------->delayed block cleanout effect
      175008833  bytes sent via SQL*Net to client
          88996  bytes received via SQL*Net from client
           8045  SQL*Net roundtrips to/from client
              4  sorts (memory)
              0  sorts (disk)
        4021808  rows processed
    HR@ORACOS> set autotrace off
    HR@ORACOS> select * from v$flashback_database_stat;    ----flashback data size increases
    HR@ORACOS>
    BEGIN_TIME        END_TIME          FLASHBACK_DATA    DB_DATA  REDO_DATA ESTIMATED_FLASHBACK_SIZE
    20100527 15:32:53 20100527 16:01:11     1305264128 2054594560 4021728256                        0
    20100527 14:32:50 20100527 15:32:53      248160256  127295488  450139648               1.3215E+10
    20100527 13:32:48 20100527 14:32:50       10452992   15646720    4400640               1.5549E+10
    20100527 12:32:43 20100527 13:32:48      745693184  948461568 1311620608               2.2789E+10
    20100527 11:25:56 20100527 12:32:43     1262026752 1984741376 2358546432               2.7212E+10Basically what I do is I update a 4 million table big redo generated with flashback logs
    When I do select after the update I still see the redo generated because of delayed block cleanout but what I also see is the slight increase in flashback data size (check the first row of flashback_database_stat) which suits what you asking for. Select statement generates flashback log
    Tested on 11.2.0.1 with single active session on the db
    Coskan Gundogar
    Blog: http://coskan.wordpress.com
    Twitter: http://www.twitter.com/coskan
    Linkedin: http://uk.linkedin.com/in/coskan
    ---------

  • Oracle 11g :SELECT query blocked..??

    Hi Experts,
    could you please explain why the below SQL query is blocked?
    SELECT 1 FROM DUAL is blocking the SQL statement on GTTAPPUSR@gttccuatcriba04 ( SID=469 ) blocked SQL -> DELETE FROM GTTDB.PURCHASE_ENTRY_ID=:1
    SELECT 1 FROM DUAL is blocking the SQL statement on GTTAPPUSR@gttccuatcriba04 ( SID=367 ) blocked SQL -> DELETE FROM GTTDB.PURCHASE_ENTRY_ID=:1
    I am scratching my head without any solution when I had a look at the db today. Thanks in advance for your help.
    Regards,
    Boris
    Edited by: user12075620 on Dec 4, 2012 8:58 AM

    The SELECT statement is not blocking the UPDATE. As I said in the previous reply, the string that this query produces does not match the logic.
    This query is (at least on the surface) correctly identifying that session 1 is blocking session 2. Session 1 holds some lock that session 2 is waiting on. So far, so good. Since session 2 is waiting on the lock, we can easily enough see what session 2 is running (the UPDATE statement). But since session 1 is not blocked, it is potentially off running a ton of other SQL statements (or no SQL statement at all). The query is looking to see what session 1 is running currently. It has no way of determining what session 1 ran at some point in the past to acquire the lock in the first place.
    Going back to my KING example,
    At noon, session 1 runs
    UPDATE emp
       SET sal = sal * 2
    WHERE ename = 'KING'Session 1 now has a lock on the KING row in the EMP table. But session 1 neither commits nor rolls back, it is still in a transaction. Session 1 might not have any more activity for a long time-- the user might go off to lunch, for example (obviously, applications should not be designed to allow users to maintain open transactions indefinitely, but not all applications are designed correctly). Or it might start running other queries. Let's say that session 1 now runs a query that is going to go for an hour
    SELECT *
      FROM giant_view_with_lots_of_computationsNow, at 12:45, session 2 comes in and runs
    UPDATE emp
       SET bonus = 100
    WHERE ename = 'KING'Session 2 is blocked. Session 2 is running the UPDATE statement. Session 1 still holds the lock but it is running some completely unrelated SQL statement.
    If we run the query you posted, the query will correctly report that session 1 is running the query against the GIANT_VIEW_WITH_LOTS_OF_COMPUTATIONS but incorrectly imply that this SELECT query is the source of the lock. It is not. It simply happens to be the query that the session that does hold the lock happens to be executing at the current moment (why the application seems to be running a lot of queries that select a constant from dual is a separate question).
    Justin

  • Index not being used in Select statement

    Friends
    I have the following SQL statement:
    SELECT
    a.acct,
    a.date_field,
    UPPER(b.feegroup) feegrp,
    SUM (a.fee1) fee1,
    SUM (a.fee2) fee2,
    SUM (a.fee3) fee3
    FROM table1 a, table2 b
    WHERE 1 = 1
    AND a.fee_id = b.fee_id
    GROUP BY a.acct, a.date_field, b.feegroup;
    Both the tables have index on fee_id column. When I run the explain plan for this statement, I am getting the following output:
    Operation | Option | Object Name | Position
    SELECT STATEMENT | | | 560299
    HASH | GROUP BY| |1
    TABLE ACCESS | FULL| table2 | 1
    TABLE ACCESS | FULL| table1 | 2
    Why Oracle is not using the index?
    Edited by: darshilm on Dec 10, 2009 3:56 PM

    The proposed plan is the optimal according to your current conditions in the "where clause" where you have only the equality join condition and therefore the CBO can use HASH JOIN. Using any kind of index access would just increase the amount of required work unless you would add some very restrictive conditions which will select rows from relatively small amount of blocks. Here I have to mention that what really counts in the CBO cost calculation is the amount of blocks accessed and not the number of rows. The "currency" for I/O in Oracle is a block and not a row. CBO always uses an assumption that there is nothing in the buffer cache and it will have to perform a physical read for every block.
    How many blocks will actually be accessed depends on the data distribution. It can happen that every single row that you have to retrieve resides in a different block and although you access only 1000 rows out of a million row table you would have to visit almost every block of that table. For such a situation a FULL TABLE SCAN is the best access path and Oracle will use multiblock I/O for that. On the other side you can have those 1000 rows only in a few blocks and then the index access would be the most appropriate one. For index access Oracle uses single block I/O. Usually the actual situation is somewhere between this two extreme situations. But you can run some tests by yourself and see when an index access will be replaced by a full table scan while you will make your predicates less selective.
    HTH, Joze
    Co-author of the forthcoming book "Expert Oracle Practices"
    http://www.apress.com/book/view/9781430226680
    Oracle related blog: http://joze-senegacnik.blogspot.com/
    Blog about flying: http://jsenegacnik.blogspot.com/
    Blog about Building Ovens, Baking and Cooking: http://senegacnik.blogspot.com

  • Select statement works in 8.1.5  but does not work in 8.1.7 why???????

    I have written a select statement as part of cursor in a
    Database Trigger, the following statement works fine in Oracle
    8i ver 8.1.5.0 but the same statement returns error PLS-00103
    (Parser related error) in Oracle 8i version 8.1.7.0!!!!!!
    The error shown is
    PLS-00103Encountered the symbol")" when expecting one of the
    following:
    from
    The Sql statement in a Database Trigger is as follows
    select opn_stk,iss_qty,rec_qty,ROWID
    from mnth_bal
    where to_date(lpad(to_char(month),2,'0')||to_char
    (year),'mmyyyy') >= SYSDATE AND
    REV_NO = :NEW.REV_NO AND
         ITEM_STOCK_ITEM_CD = :NEW.ITEM_CD and
    unit_cd = :NEW.unit_cd and
    store_cd = :new.store_cd
    order by to_date(lpad(to_char(month),2,'0')
    ||to_char(year),'mmyyyy') ;
    Can any one please tell me whats the problem ? In 8.1.5.0 the
    same statement in the trigger runs absolutely fine &
    compiles.Because of this problem the trigger is not compiling in
    8.1.7.0
    Would be grateful for any solutions given

    Relating line numbers in compile errors to source code.
    Oracle does not count blank lines in line numbers. Commenting
    with "--" blank lines or deleting blank lines will make the line
    counter more accurate.
    Oracle counts comments delimited with /*...*/ as one line, no
    matter how many lines are in the source code. Using only "--"
    will make the line counter more accurate.
    Oracle does not count lines before the PL/SQL block DECLARE when
    compiling triggers. (CREATE ... TRIGGER....FOR EACH...WHEN(...))
    parts of the syntax are not counted. The line in the source
    code with the DECLARE of the trigger's PL/SQL block will be line
    1.
    Hint: Avoid uncertainty. Use "SHO ERR TRIGGER <trigger_name>"
    when looking at compile problems.
    Good Luck....

  • Delete Operation in JDBC Sender Adapter not works

    Hi,
        I have one student table which contains the fields ID,Name,BirthMonth,BirthYear,ReadFlag fields. ReadFlag is a character field or lenght 1 which contains only values either 'Y' or ' '. 
         I want to execute delete operation in this table ie to delete the records which contains the readflag = 'Y'. So, I set the below values for the following parameters.
    DELETE FROM student WHERE READFLAG = ' Y '
    Query SQL Statement : SELECT * FROM student WHERE readflag = 'Y'
    Update SQL Statement : DELETE FROM student WHERE READFLAG = 'Y'
    Poll Interval : 60 Seconds.
        There are more records in this table which contains readflag = 'Y'. But, the Adapter does not delete those records from the table i.e delete operation is not executed. At the same time, in Comm. Channel monitoring it does not show any error, but the delete operation is not carried out in the table.
         I tried after 'COMMIT' the table also. But it does not work. What could be the reason ? or How to use Delete Operation effectively on the table ?
         Kindly help me friends to solve this problem.
    Thanking you.
    Kind Regards,
    Jeg.

    http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm >>>
    <i>Adapter Work Method
    You must add an indicator that specifies the processing status of each data record in the adapter (data record processed/data record not processed) to the database table.
    The UPDATE statement must alter exactly those data records that have been selected by the SELECT statement. You can ensure this is the case by using an identical WHERE clause. (See Processing Parameters, SQL Statement for Query, and SQL Statement for Update below).
    <b>Processing can only be performed correctly when the isolation level for transaction is set to repeatable_read or serializable.
    Example
    SQL statement for query: SELECT * FROM table WHERE processed = 0;
    SQL statement for update: UPDATE table SET processed = 1 WHERE processed = 0;
    processed is the indicator in the database.</b></i>
    try with repeatable_read or serializable !!!
    Also go thru this thread - DELETE Querey in JDBC SENDER

Maybe you are looking for

  • Pedido de Compra com Item Category = D

    Olá Pessoal, Alguém sabe me informar qual é o tratamento que a solução SAP SPED Fiscal apresenta quando usamos mestre de serviço e o pedido de compra fica com código do material (EKPO-MATNR) branco. Faço esta pergunta porque a partir do SPED todos os

  • Songs, Artists, and Albums showing up in Compliations....

    I have several artists, songs, and albums in my iTunes library that show up under "compliations" but not as an actual artist--even though all the I have all the artist, song, and album info. Also--the same happens with my iPod: the artist shows up ON

  • How do I move all my movies onto an external hard drive and still run imovie

    My Mac hard drive is full due to 300GB's of movies. I don't want to lose the movies and still want to work on them/create projects etc. I've bought an external hard drive so have copied and pasted all the movies across from MAC hard drive to external

  • Shortcuts to switch views in Finder don't work

    I am reading that Apple-1, Apple-2, and Apple-3 will switch between the icon, list, and column view in the Finder. Yet when I try this, nothing happens. Does it work on your machine, and if so, any idea why it doesn't work on mine?

  • Clearing music?

    I cleared the songs I did not want on my iPod out of iTunes and it said it would clear them from my iPod also; is there something more I need to do to get the undesired songs off of my iPod? 2gb nano   Windows XP