Select count from large fact tables with bitmap indexes on them

Hi..
I have several large fact tables with bitmap indexes on them, and when I do a select count from these tables, I get a different result than when I do a select count, column one from the table, group by column one. I don't have any null values in these columns. Is there a patch or a one-off that can rectify this.
Thx

You may have corruption in the index if the queries ...
Select /*+ full(t) */ count(*) from my_table t
... and ...
Select /*+ index_combine(t my_index) */ count(*) from my_table t;
... give different results.
Look at metalink for patches, and in the meantime drop-and-recreate the indexes or make them unusable then rebuild them.

Similar Messages

  • Select count(x) on a table with many column numbers?

    Hi all,
    i have a table with physical data with 850 (!!) colums and
    ~1 Million rows.
    The select count(cycle)from test_table Statement is very, very slow
    WHY?
    The select count(cycle)from test_table is very fast by e.g 10 Colums. WHY?
    What has the number of columns, to do with the SELECT count(cyle).... statement?
    create test_table(
    cycle number primary key,
    stamp date,
    sensor 1 number,
    sensor 2 number,
    sensor_849 number,
    sensor_850 number);
    on W2K Oracle 9i Enterprise Edition Release 9.2.0.4.0 Production
    Can anybody help me?
    Many Thanks
    Achim

    hi lennert, hi all,
    many thanks for all the answers. I�m not an Oracle expert.
    Sorry for my english.
    Hi Lennert,
    you are right, what must i do to use the index in the
    query? Can you give me a pointer of direction, please?
    Many greetings
    Achim
    select count(*) from w4t.v_tfmc_3_blocktime;
    COUNT(*) ==> Table with 3 columns (very fast)
    306057
    Ausf�hrungsplan
    0 SELECT STATEMENT Optimizer=CHOOSE
    1 0 SORT (AGGREGATE)
    2 1 TABLE ACCESS (FULL) OF 'V_TFMC_3 _BLOCKTIME'    
    Statistiken
    0 recursive calls
    0 db block gets
    801 consistent gets
    794 physical reads
    0 redo size
    388 bytes sent via SQL*Net to client
    499 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed
    select count(*) from w4t.v_tfmc_3_value;
    COUNT(*)==> Table with 850 columns (very slow)
    64000
    Ausf�hrungsplan
    0 SELECT STATEMENT Optimizer=CHOOSE
    1 0 SORT (AGGREGATE)
    2 1 TABLE ACCESS (FULL) OF 'V_TFMC_3 _VALUE'    
    Statistiken
    1 recursive calls
    1 db block gets
    48410 consistent gets
    38791 physical reads
    13068 redo size
    387 bytes sent via SQL*Net to client
    499 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed

  • Calculating count from two fact tables

    Hi Guys,
    My requirement,
    i have two fact table F1, F2 connected with a D1 dimension table, all table connected with a id column
    F1 ---------D1------------F2
    n 1 1 n
    i want to find out the distinct count from Fact F1 where the value also present in F2( ie. F1.id= F2.id condition).
    this measure usefull through out my project so i want create a logical column, how to create it.
    I tried this way:
    i Created two fact table in to one fact table by adding logical source, and created a logical column from existing logical source where F1.id=D1.id and D1.id=F2.Id but it is wrong
    Can any suggestion for solve my problem.
    Thanks in advance!!!

    Hi,
    You can create an opaque view in physical layer and wrire a sql like
    Select f1.id,count(*) from f1,f2 where f1.id=f2.id group by f1.id.Join this through id with dimesnion and add this fact table in LTS of your fact and use count(*) in report.
    Regards,
    Sandeep

  • How can I select records from a DB table with intervals?

    Hello,
        Suppose my DB table is  having 20 lakh records. I need to fetch 50000(for eg, this number may change ) records intially then the next 50000 records and so on , so that I never get a runtime error "memory low".
    I can select the first 50000 records using "select up to " statement but once i select the first 50000 records how can i fetch the remainning records as parts.
    Please help.Urgent.
    Neeraj.

    Hi,
    Use packaze size statement in select statement.
    EX: This is syntax.
    SELECT ... INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE <itab> [PACKAGE SIZE <n>] ...
    1. If you want first 50000 records and do the required functionality with those and refresh the 50000 records and go for next 50000 means  use
    SELECT CARRID CONNID
    FROM   SPFLI
    INTO   CORRESPONDING FIELDS OF TABLE ITAB
          PACKAGE SIZE 50000.
    ENDSELECT.
    2. If you want to append all records means
    SELECT CARRID CONNID
    FROM   SPFLI
    INTO   APPENDING FIELDS OF TABLE ITAB
          PACKAGE SIZE 50000.
    ENDSELECT.
    Don't forghet to reward if useful....

  • Select count(*) from table in oracle 11g with direct path read takes time

    select count(*) from table takes long time, even more than couple of hours..
    direct path read is the wait event which is almost is at 99%..
    can u someone provide some info on this.. on solution.. thankx

    knowledgespring wrote:
    table has millions of records... 130 millions..
    select count(*) from BIG_SIZE_TABLE; --- executed in sql plus command prompt.
    Rows     Execution Plan
    0  SELECT STATEMENT   MODE: ALL_ROWS
    0   SORT (AGGREGATE)
    0    TABLE ACCESS   MODE: ANALYZED (FULL) OF 'BIG_SIZE_TABLE' (TABLE)
    Elapsed times include waiting on following events:
    Event waited on                             Times   Max. Wait  Total Waited
    ----------------------------------------   Waited  ----------  ------------
    SQL*Net message to client                       1        0.00          0.00
    enq: KO - fast object checkpoint                1        0.01          0.01
    Disk file operations I/O                       18        0.00          0.00
    direct path read                            58921        0.34        418.54direct path read time waited is : 58921 total time waited: 418.54
    That 418 seconds - not the hours you reported earlier. Is it possible that your connection to the database broke ?
    On a typical system, by the way, you can usually turn one direct read for tablescan into 1MB, so your scan seems to have covered about 59 GB, which seems to be in the right sort of ballpark for 130M rows.
    we have another query and when we test the query execution using v$sql, is_bind_sensitive =N, how to make is_bind_sensitive=Y all the time.. There is a hint /*+ bind_aware */ - I'd have to check whether or not it's documented at present. It might help.
    I would be interested in hearing why you think the hint should be bind sensitive when the optimizer doesn't.
    Regards
    Jonathan Lewis

  • How do I execute "Select count(*) from table " in OCI

    Hi,
    I am new to OCI and so this question may seem stupid. I would like to know how to execute the query "select count(*) from <table>" using OCI V8 functionality? Also after how do I get the result into a integer datatype? I have gone through most of the demo programs but is is of little help to me.
    Thanks in advance...
    Regards,
    Shubhayan.

    Hi,
    Here is sample code to give you some idea how to do it. If you want some more info let me know.
    Pankaj
    ub4 count;
    // Prepare the statement.
    char szQry = "SELECT count() FROM T1";
    if(OCI_ERROR == OCIStmtPrepare(pStmthp, pErrhp, (unsigned char*)szQry, strlen(szQry), OCI_NTV_SYNTAX , OCI_DEFAULT) )
         cout << "Error in OCIStmtPrepare" << endl;
         exit(1);
    // Bind the output parameter.
    OCIDefine *pDefnpp;
    if(OCI_ERROR == OCIDefineByPos ( pStmthp, &pDefnpp, pErrhp, 1,
    &count, sizeof(ub4), SQLT_INT,
    (dvoid *) 0, (ub2 *) 0, (ub2 *) 0,
                        OCI_DEFAULT) )
         cout << "Error in OCIDefineByPos" << endl;
         exit(1);
    if(OCI_ERROR == OCIStmtExecute(pSvchp, pStmthp, pErrhp, 1, 0, NULL, NULL, OCI_DEFAULT) )
         cout << "Error in OCIStmtExecute" << endl;
         exit(1);

  • Issue using one 2 Fact tables with one dimension Table.

    Hi,
    I have 1 Dimension table X and 2 Fact tables A and B
    X is joined to Both A and B for Loan Amount ( with A) and for colleatral amount (with B) when I am selecting the X.Product_Name, A.Loan_Amt, B.Collateral Amount, it is giving an error message
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 15018] Incorrectly defined logical table source (for fact table EIP Collateral FACT) does not contain mapping for [EIP Reporting FACT.PD ID]. (HY000)
    Any clues???
    Is there a Inner or Outer join which needs to be created or set in the RPD to get the desired results???

    Ok..
    I have one table which is Porfolio Details which has Portfolio name, Product Category , Product Name, Product ID, Product sources code.- This is my Dimension table.
    I have another 2 set of fact tables : EIP Reporting FACT and EIP Collateral FACT..
    These two tables are joined to Portfolio Details table.
    EIP Reprting FACT gives portfolio wise Loan Amount
    and EIP Collateral FACT gives Portfolio wise Collateral Amount details for same set of customer..
    Now, I am selecting Portfolio Name, Product Category, Product Name,SUM( EIP Reporting FACT.LOAN_AMOUNT), SUM(EIP Collaetral FACT.Collateral_Amt) in a report
    Now, on selecting these columns I am getting that error message which is related to mapping.
    If I take any column from Portfolio details table and any column from EIP Reporting FACT- It works.
    If I take any column from Portfolio details table and any column from EIP Colletral FACT- It works.
    But if I take any column from portfolio table and columns from both FACT tables it gives mapping error...
    Hope I am able to explain the issue in a better way now..
    Edited by: help-required on Mar 11, 2010 6:53 PM
    Edited by: help-required on Mar 11, 2010 6:53 PM

  • How do I select rows from the same table that have multiple occurances

    Hi Everybody,
    I am trying to select records from a detail table by grouping it. The table has more than 1 million records and the query is not performing well. The basic question is how to select a distinct record from a table which matches all values in one column and any in the other.
    desc SCV
    ID NUMBER PK (ID + SCRID)
    SCRID NUMBER FK(SC)
    ID SCRID
    1 1
    2 1
    3 1
    4 2
    5 2
    6 3
    7 4
    8 4
    desc PROJECTS
    ID NUMBER PK
    NAME VARCHAR2(100)
    ID NAME
    1 PROJECT1
    2 PROJECT2
    3 PROJECT3
    4 PROJECT4
    desc PJS
    ID NUMBER
    PROID NUMBER FK (PROJECTS)
    SCRID NUMBER FK (SCV(SCRID + SCVID)
    SCVID NUMBER
    ID PROID SCRID SCVID
    1 1 1 1
    2 1 1 2
    3 1 2 5
    4 1 3 6
    5 1 4 7
    6 2 1 3
    7 2 2 4
    8 2 2 5
    9 2 4 7
    There are over 1 million records in PJS.
    desc TBP
    SCRID NUMBER
    SCVID NUMBER
    SCRID SCVID
    1 1
    1 2
    1 3
    2 4
    2 5
    3 6
    4 7
    4 8
    The requirement is to select projects that have matching SCRID, SCVID from TBP such that
    all distinct SCRID should match and within that and any SCVID match will do. (A "AND" between each SCRID and an "OR" for each SCVID in that SCRID like 'SCRID = 1 AND (SCVID = 1 OR SCVID = 2 OR SCVID = 3) AND SCRID = 2 AND (SCVID =....)
    So, for the sample data it should return us PROID = 1
    I have few queries written for this:
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 1
    INTERSECT
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 2
    INTERSECT
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 3
    INTERSECT
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 4
    This query performs well but the cost is very high, hardcoding, sorting.
    The 2nd option is to:
    SELECT pjs.PROID proid
    FROM TBP tbp,
    PJS pjs
    WHERE pjs.SCVID = tbp.SCVID
    AND pjs.SCRID = tbp.SCRID
    GROUP BY pjs.PROID
    HAVING COUNT(DISTINCT pjs.SCRID) = (SELECT COUNT(DISTINCT SCRID ) FROM TBP)
    This has a low cost but runs slowly.
    One more way I tried was with the IN operator like
    SELECT DISTINCT PROID FROM PJS A,TBP T WHERE T.SCRID = 1 AND T.SCVID = A.SCVID
    AND PROID IN (SELECT PROID FROM PJS A,TBP T WHERE T.SCRID = 2 AND T.SCVID = A.SCVID
    AND PROID IN (...SO ON with each DISTINCT SCRID.
    Again this involves too much of sorting.
    Any help will be appriciated.
    Thanks in advance.

    Hi Andrew,
    Use DELETE t_itab statement inside the loop.
    I have modified your code. It is perfectly working.See bellow  -
    LOOP AT it_zmember01 INTO wa_zmember01.
    WRITE: / wa_zmember01-mnumber UNDER 'NUMBER',
    wa_zmember01-mname UNDER 'NAME',
    wa_zmember01-mdob UNDER 'DOB'.
    WRITE / '-----------------------------------------------------------------'.
    DELETE it_zmember01.               " Modified
    ENDLOOP.
    DELETE it_zmember01. statement inside the loop will delete the current row of the table.
    Regards
    Pinaki

  • Unexpected results getting data from two fact tables through conformed dim

    Hi all,
    We are getting an unexpected behaviour in our OBIEE 10.1.3.3.3. We have this scenario:
    We have {color:#0000ff}2 fact tables{color}{color:#000000} called F1 and F2. F1 has one measure, f1m1 and F2 has another one, f2m1.
    We have {color:#0000ff}4 conformed dimensions{color}, called D1, D2, D3, Date.
    When we are requesting for individual fact tables, we are getting:
    date d1 d2 d3 f1m1
    dt1 - x - y - z - m1
    dt1 - x - y - z' - m2
    date d1 d2 d3 f2m1
    dt1 - x - y - z - m3
    dt1 - x - y - z'' - m4
    But, trying to obtain a compare scenario, we are getting
    date d1 d2 d3 f1m1 f2m1
    dt1 x y z m1 m4
    Instead of
    date d1 d2 d3 f1m1 f2m1
    dt1 x y z m1 m3
    Looking at query log, we have catched the reason. That's why BI Server is using to solve this request using ROW_COUNT() to join SAWITH0 and SAWITH1 in SAWITH2 result set. So, the order may not be the same in the results sets in every fact table. More or less, generated query is like:
    WITH
    SAWITH0 AS
    (select ....
    from F1),
    SAWITH1 AS
    (select ...
    from F2),
    SAWITH2 AS
    select from (select ...
    ROW_NUMBER() OVER PARTITION (....) c10
    from SAWITH0.d1 full outer join SAWITH1.d1 ....) D1
    {color:#ff0000}where (D1.c10 = 1){color}
    select SAWITH2. ....
    from SAWITH2
    order by c1..c10
    The problems seems to be that BI server is ordering the result sets SAWITH0 and SAWITH1 and getting row number to join this results sets, but this is not getting the correct result.
    Any ideas?
    TIA
    Javier
    {color}
    Edited by: jirazazábal on Mar 13, 2009 2:46 PM

    I have done a logical fact table with two fact table source on it.
    The Sql performed against the database was this one.
    -------------------- Sending query to database named PRODS_AIX (id: <<153418>>):
    WITH
    SAWITH0 AS (select sum(T21296.CONSUMERS_SALES_EURO) as c1,
         T21309.DIVISION_CODE as c2
    from
         DIVISION T21309,
         C_CONSUMERS_SALES T21296
    where  ( T21296.DIVISION = T21309.DIMENSION_KEY )
    group by T21309.DIVISION_CODE),
    SAWITH1 AS (select sum(T21356.ORDER_VALUE) as c1,
         T21309.DIVISION_CODE as c2
    from
         DIVISION T21309,
         DWH_SALES_ORDER_OVERVIEW T21356
    where  ( T21309.DIMENSION_KEY = T21356.DIVISION_KEY )
    group by T21309.DIVISION_CODE)
    select distinct case  when SAWITH0.c2 is not null then SAWITH0.c2 when SAWITH1.c2 is not null then SAWITH1.c2 end  as c1,
         SAWITH0.c1 as c2,
         SAWITH1.c1 as c3
    from
         SAWITH0 full outer join SAWITH1 On nvl(SAWITH0.c2 , 'q') = nvl(SAWITH1.c2 , 'q') and nvl(SAWITH0.c2 , 'z') = nvl(SAWITH1.c2 , 'z')
    order by c1As you can see one select (SAWITH0) for the first fact table C_CONSUMERS_SALES and one select for the second fact table DWH_SALES_ORDER_OVERVIEW (SAWITH1 ) and the two statement are joined with a full outer join.
    I ask me why you have the three select (SAWITH0,SAWITH1 and SAWITH2). Can you please paste the complete SQL performed ?
    Can you tell us also which SQL is performed if you select only the columns from one fact table and not for the other ?
    Regards
    Nico
    http://gerardnico.com

  • Joining two fact tables with different dimensions into single logical table

    Hi Gurus,
    I try to accomplish in Oracle Business Intelligence 11.1.1.3.0:
    F1 (D1, D2 and D3)
    F2 (D1 and D2 and D4)
    And we want to build a report F1 F2 D1 D2 D3 D4 to have data for:
    F1 that match only for D1-D2-D3
    and data for
    F2 that match only D1-D2-D4
    all that in one row, so D3 and D4 are not common dimensions.
    I can only do:
    F3 (D1, D2)
    F4 (D1, D2 and D4)
    And report
    F3 F4 D1,D2,D4 (all that in one row, and only D4 is not a common dimension)
    Here is the very good example how to accomplish the scenario 1
    http://108obiee.blogspot.com/2009/08/joining-two-fact-tables-with-different.html
    But looks like it does not work in 11.1.1.3.0
    I get
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 14025] No fact table exists at the requested level of detail: [,,Clients,,Day,ROI,,,,EW_Names,,,,,,,,,,,,,,,,,]. (HY000)
    I am sure I set up everything correctly as advised in the blog but it works with only one not a common dimension
    Is it a bug in 11.1.1.3.0 or something?
    Thanks,
    Kate

    Thanks for all your replies.
    Actually, I've tried the solutions you guys mentioned. Generally speaking, the result should be displayed. However, my scenario is a little bit tricky.
    table Y's figures are not the aggregation of table X for D dimension. Instead, table Y's figures include not only D dimension total, but also others (others do not mean A, B, C dimension). For example, table Y stores all food's figure, while table X stores only drink's figure. D dimension is only about drink's detail. In my scenario, other foods' figure is not provided.
    So, even if I set D dimension to all/total for table X, table X's result is still not the same as table Y.
    Indeed, table Y does not have a column key to join to D dimension's key. So, if I select D dimension and table Y's measures at the same time in BI Answer, result returns no data. Hence, I can't compare table X and table Y's results with selection of D dimension.
    Is there any solution to solve this problem?
    Edited by: TomChan on Jun 3, 2009 9:36 AM

  • Logical fact table with fragmented data sources with different dimensions

    Hello.
    I have a logical fact table with four logical table sources. Three of the LTS's share the same dimensions, but the fourth LTS has one dimension (called Dim_A) less. In the physical layer the dimension Dim_A is joined to the first three physical fact tables, but not to the fourth fact table (since it doesn't have that dimensionality). In the BMM layer the logical fact table is joines to the logical dimansion Dim_A.
    When I run an analysis on this RPD the measures from the logical fact is aggregated correctly (union of all four table sources) as long as I doesn't include Dim_A, but as soon as I include dimension Dim_A I get the error message:
    +State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 14052] Internal Error: Logical column Dim_A.Column_X has no physical sources that can be joined to the physical fact table source [Logical table sources (Priority=0): Fact_B.Fact_Y]. (HY000)+
    I would like a solution where the analysis returns correctly aggregated measures also for the LTS with the "missing" dimension, but with a dimension value NULL for this LTS. Or something like this.
    Is there a way to set this up in the RPD.
    Thanks,
    Henning Eriksen

    The SQL could look something like this.
    SELECT dim_a.col_1, fact_a.measure_1
    FROM db.dim_a
    JOIN
    db.fact_a
    ON fact_a.col_2 = dim_a.col_2
    WHERE fact_a.date = '28-nov-2012'
    UNION ALL
    SELECT dim_a.col_1, SUM (fact_b.measure_1)
    FROM db.dim_a
    JOIN
    db.fact_b
    ON fact_b.col_2 = dim_a.col_2
    WHERE fact_b.date = '28-nov-2012'
    UNION ALL
    SELECT dim_a.col_1, SUM (fact_c.measure_1)
    FROM db.dim_a
    JOIN
    db.fact_c
    ON fact_c.col_2 = dim_a.col_2
    WHERE fact_c.date = '28-nov-2012'
    UNION ALL
    SELECT NULL, SUM (fact_d.measure_1)
    FROM    db.fact_d
    WHERE fact_d.date = '28-nov-2012'
    I would appreciate if you could give me some hints for the RPD.
    Thanks,
    Henning

  • Select Count(*) from Sample_table - how to get the count using JDBC?

    Hi All,
    It would be glad if anyone could help me with this. The problem is that I have to get the 'count' of records selected from a arbitrary table say, 'sample_table'. Is that possible to form the SQL in JDBC as
    Select Count(*) from Sample_table
    and get the value of the count? If yes, how?
    Thanks in advance
    Prabz

    stmt = con.createStatement();
    ResultSet recordcnt_rs = stmt.executeQuery("Select Count (*) as record_ctr From Sample_table");
    recordcnt_rs.next();     
    record_ctr = recordcnt_rs.getInt("record_ctr");
    hope this helps.

  • Confirmed Dimensions. OBIEE Not able to pull data from two fact tables.

    Hi Experts,
    I have a very simple set up of Star Schema with two fact tables and 1 dimension. Both fact tables joined to the dimension at the same level.
    When i pull a column from both fact tables and the dimension table in OBIEE, it has to create simple SQL like below:
    select FACT1.column1,
    Fact2.Column1,
    Dim.Column1
    from FACT1, FACT2, DIM
    where FACT1.ID = DIM.ID and FACT2.ID = DIM.ID
    but instead it creating a query in a very complex way:
    select case  when D1.c2 is not null then D1.c2 when D2.c2 is not null then D2.c2 end  as c2,
         D1.c1 as c3,
         D2.c1 as c4
    from
         (select FACT1.Column1 as c1,
                   DIM.Column1 as c2
              from
                   DIM T1287863,              
                   FACT1 T1287945              
       where  (DIM.ID = FACT1.ID)
           ) D1 full outer join (
            select FACT2.Column1 as c1,
                   DIM.Column1 as c2
              from
                   DIM,              
                   FACT2
              where  ( DIM.ID = FACT2.ID)
         ) D2 On isnull(D1.c2 , '1') = isnull(D2.c2 , '1') and isnull(D1.c2 , '2') = isnull(D2.c2 , '2')
    I even tried setting the levels for both the fact tables and it still creates the query in avove way. Any thoughts on this will be vary helpful.

    Subramanian,
    see below the code we're using for the RFM.
    on the ct_containers table i'm passing a line, and its getting updated after the call.
    on the ct_errors table i just want to receive the errors and i only receive the line, we add manually there ('Serious error with validation code').
    kr, achim
    FUNCTION zbapi_ra_validations .
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(IS_RA_SCREEN) TYPE  ZBAPI_S_RA_SCREEN
    *"  CHANGING
    *"     VALUE(CT_ERRORS) TYPE  ZRA_T_ERRORS
    *"     VALUE(CT_CONTAINERS) TYPE  ZRA_T_CONT_IP
      DATA:
        lo_badi_handle TYPE REF TO zra_validation_rule,
        ls_error       TYPE zra_s_error.
      GET BADI lo_badi_handle.
      TRY.
          CALL BADI lo_badi_handle->validate_rules
            EXPORTING
              is_screen_flds = is_ra_screen
            CHANGING
              ct_containers  = ct_containers
              ct_errors      = ct_errors.
        CATCH zcx_ra.
          ls_error-message = 'Serious error with validation code'.
          APPEND ls_error TO ct_errors.
      ENDTRY.
    ENDFUNCTION.
    if i call this rfm in SE37 the ct_errors table is populated with all errors and the manually created line.
    Message was edited by: Achim Hauck

  • "select count(*) from dba_jobs_running" takes 5 minutes to return

    Hi,
    I login as sys or system from sql*plus to run query "select count(*) from dba_jobs_running". This query takes about 5 minutes to run.
    Querying other DBA_* views returns instantly, only this dba_jobs_running view is troubling.
    I have 11 records in dba_jobs, and 18 records in v$lock as usual.
    No error or warning in logfile, no trace file.
    What's possibly wrong with the server?
    Thanks,
    Harry

    Hi,
    The following are the exact statements I used to create the trace file:
    alter session set timed_statistics=true;
    alter session set max_dump_file_size=unlimited;
    alter session set events '10046 trace name context forever, level 12';
    select count(*) from dba_jobs_running;
    exit;
    The content of the trace file is attached at the end.
    If it is CPU bound, I have no activity on the db host. I am solely using it to analyze this problem.
    load averages: 0.02, 0.02, 0.07 22:16:38
    48 processes: 47 sleeping, 1 on cpu
    CPU states: 98.4% idle, 1.6% user, 0.0% kernel, 0.0% iowait, 0.0% swap
    Memory: 1792M real, 983M free, 517M swap in use, 2937M swap free
    PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
    655 oracle 1 59 0 0K 0K sleep 1:14 0.32% oracle
    865 oracle 1 59 0 2072K 1184K cpu 0:00 0.14% top
    667 oracle 1 59 0 0K 0K sleep 0:13 0.08% oracle
    663 oracle 1 59 0 0K 0K sleep 0:27 0.07% oracle
    665 oracle 1 59 0 0K 0K sleep 0:15 0.02% oracle
    671 oracle 1 59 0 0K 0K sleep 0:00 0.02% oracle
    645 oracle 18 59 0 0K 0K sleep 0:23 0.01% oracle
    657 oracle 1 59 0 0K 0K sleep 0:14 0.00% oracle
    649 oracle 1 59 0 0K 0K sleep 0:02 0.00% oracle
    659 oracle 1 59 0 0K 0K sleep 0:01 0.00% oracle
    251 root 20 59 0 3256K 2512K sleep 0:00 0.00% nscd
    70 root 5 59 0 2864K 2096K sleep 0:00 0.00% picld
    224 root 3 59 0 3912K 2008K sleep 0:00 0.00% automountd
    271 root 1 59 0 4408K 1896K sleep 0:00 0.00% sendmail
    588 oracle 1 59 0 2600K 1864K sleep 0:00 0.00% bash
    Any help is greatly appreciated.
    <-- TRACE FILE CONTENT -->
    *** 2006-11-21 21:34:54.413
    *** SESSION ID:(21.832) 2006-11-21 21:34:54.412
    APPNAME mod='[email protected] (TNS V1-V3)' mh=0 act='' ah=0
    =====================
    PARSING IN CURSOR #1 len=69 dep=0 uid=0 oct=42 lid=0 tim=107123626140 hv=2004533713 ad='97219d80'
    alter session set events '10046 trace name context forever, level 12'
    END OF STMT
    EXEC #1:c=0,e=346,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=4,tim=107123625473
    WAIT #1: nam='SQL*Net message to client' ela= 11 p1=1650815232 p2=1 p3=0
    WAIT #1: nam='SQL*Net message from client' ela= 6476024 p1=1650815232 p2=1 p3=0
    =====================
    PARSING IN CURSOR #1 len=37 dep=0 uid=0 oct=3 lid=0 tim=107130104260 hv=2246554324 ad='97c21958'
    select count(*) from dba_jobs_running
    END OF STMT
    PARSE #1:c=0,e=548,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=107130104237
    BINDS #1:
    EXEC #1:c=0,e=1412,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=107130106034
    WAIT #1: nam='SQL*Net message to client' ela= 12 p1=1650815232 p2=1 p3=0
    *** 2006-11-21 21:40:53.931
    FETCH #1:c=350760000,e=344612113,p=0,cr=2,cu=16652,mis=0,r=1,dep=0,og=4,tim=107474718456
    WAIT #1: nam='SQL*Net message from client' ela= 1936 p1=1650815232 p2=1 p3=0
    FETCH #1:c=0,e=6,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=0,tim=107474721309
    WAIT #1: nam='SQL*Net message to client' ela= 8 p1=1650815232 p2=1 p3=0
    *** 2006-11-21 21:56:30.972
    WAIT #1: nam='SQL*Net message from client' ela= 915075702 p1=1650815232 p2=1 p3=0
    XCTEND rlbk=0, rd_only=1
    STAT #1 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE (cr=2 r=0 w=0 time=100535896 us)'
    STAT #1 id=2 cnt=0 pid=1 pos=1 obj=0 op='NESTED LOOPS (cr=2 r=0 w=0 time=100535876 us)'
    STAT #1 id=3 cnt=5550 pid=2 pos=1 obj=0 op='MERGE JOIN CARTESIAN (cr=2 r=0 w=0 time=128639 us)'
    STAT #1 id=4 cnt=10 pid=3 pos=1 obj=0 op='NESTED LOOPS OUTER (cr=2 r=0 w=0 time=5839 us)'
    STAT #1 id=5 cnt=10 pid=4 pos=1 obj=69 op='FIXED TABLE FULL X$KSQRS (cr=0 r=0 w=0 time=4790 us)'
    STAT #1 id=6 cnt=10 pid=4 pos=2 obj=202 op='INDEX UNIQUE SCAN OBJ#(202) (cr=2 r=0 w=0 time=561 us)'
    STAT #1 id=7 cnt=5550 pid=3 pos=2 obj=0 op='BUFFER SORT (cr=0 r=0 w=0 time=90039 us)'
    STAT #1 id=8 cnt=555 pid=7 pos=1 obj=16 op='FIXED TABLE FULL X$KSUSE (cr=0 r=0 w=0 time=1277 us)'
    STAT #1 id=9 cnt=0 pid=2 pos=2 obj=0 op='VIEW (cr=0 r=0 w=0 time=344148954 us)'
    STAT #1 id=10 cnt=105477 pid=9 pos=1 obj=0 op='UNION-ALL (cr=0 r=0 w=0 time=343814331 us)'
    STAT #1 id=11 cnt=105476 pid=10 pos=1 obj=0 op='VIEW (cr=0 r=0 w=0 time=203487737 us)'
    STAT #1 id=12 cnt=105476 pid=11 pos=1 obj=0 op='UNION-ALL (cr=0 r=0 w=0 time=202961626 us)'
    STAT #1 id=13 cnt=0 pid=12 pos=1 obj=272 op='FIXED TABLE FULL X$KDNSSF (cr=0 r=0 w=0 time=13633786 us)'
    STAT #1 id=14 cnt=105476 pid=12 pos=2 obj=72 op='FIXED TABLE FULL X$KSQEQ (cr=0 r=0 w=0 time=188317145 us)'
    STAT #1 id=15 cnt=0 pid=10 pos=2 obj=253 op='FIXED TABLE FULL X$KTADM (cr=0 r=0 w=0 time=76301426 us)'
    STAT #1 id=16 cnt=1 pid=10 pos=3 obj=254 op='FIXED TABLE FULL X$KTCXB (cr=0 r=0 w=0 time=62693462 us)'
    STAT #1 id=16 cnt=1 pid=10 pos=3 obj=254 op='FIXED TABLE FULL X$KTCXB (cr=0 r=0 w=0 time=62693462 us)'
    <---- END of TRACE FILE -->

  • 'select count(*) from x' returns 5460 rows and 'Select * from x' returns 0 rows

    As you can see in the next lines something is wrong in my Oracle (8.0.6 on Win NT 4.0 sp 6a) :
    Oracle8 Enterprise Edition Release 8.0.6.0.0 - Production
    With the Partitioning option
    PL/SQL Release 8.0.6.0.0 - Production
    SQLWKS> SELECT * FROM V_TERRA_TE;
    PERIOD_DATE PERIOD_TIME TERRARCV TERRASND TERCV TESND
    0 rows selected.
    SQLWKS> SELECT COUNT(*) FROM V_TERRA_TE;
    COUNT(*)
    5460
    1 row selected.
    V_TERRA_TE is a complex join of 5 Tables :
    CREATE OR REPLACE VIEW "ACTUATE".V_TERRA_TE AS Select to_date(to_char(p1.period_date,'YYYYMMDD'),'YYYYMMDD') "PERIOD_DATE",
    to_date(to_char(p1.period_time,'HH24:MI'),'HH24:MI') "PERIOD_TIME",
    to_number(p1.caudalrcv + ((p3.caudalrcv + p4.caudalrcv)*(confterrate.conexadslterra/confterrate.conexadsltotal))) "TERRARCV",
    to_number(p1.caudalsnd + ((p3.caudalsnd + p4.caudalsnd)*(confterrate.conexadslterra/confterrate.conexadsltotal))) "TERRASND",
    to_number((p2.caudalrcv * confterrate.pctinfonegocio) + ((p3.caudalrcv + p4.caudalrcv)*(confterrate.conexadslte/confterrate.conexadsltotal)))"TERCV",
    to_number((p2.caudalsnd * confterrate.pctinfonegocio) + ((p3.caudalsnd + p4.caudalsnd)*(confterrate.conexadslte/confterrate.conexadsltotal)))"TESND"
    from p1,p2,p3,p4,confterrate
    where (p1.period_date=p2.period_date)and
    (p1.period_date=p3.period_date)and
    (p1.period_date=p4.period_date)and
    (p1.period_time=p3.period_time)and
    (p1.period_time=p4.period_time)and
    (p1.period_time=p2.period_time)and
    to_char(p1.period_date,'MMYYYY')=to_char(confterrate.period_datetime,'MMYYYY');
    I think that some not reported error happens in the select * with some temporary space or similar but only the message '0 rows selected' is displayed (instead the real error)
    Could somebody help me ?
    Thanks in advance
    Francisco

    Forcing the Join/sort to be made on Disk (not on memory) the problem not happens. This demostrate that ORACLE has a VERY IMPORTANT BUG : It returns 0 rows wich is false.
    To force it to work on disk i use this parameters :
    alter session set sort_area_size=0
    alter session set hash_join_enabled=false
    Note : probably is not the best combination or use of parameters, but using it the query works as espected.

Maybe you are looking for