Issue Analytics ORA-30089

Hello-
worked with analytical sql in a little bit so maybe I'm just rusty.

Goal: run the query to return data) 1 week and 2) a current view an average of 52 weeks

Sample data and the ddl:

DDL:
CREATE TABLE my_fact
(product_id NUMBER,
 customer_id NUMBER,
 week_no number,
 transaction_date DATE, 
 stock_on_hand NUMBER,
 stock_in_transit number);

INSERT INTO my_fact VALUES (1,45, 29, SYSDATE, 100,70);
INSERT INTO my_fact VALUES (1,45, 29, SYSDATE, 200,170);
INSERT INTO my_fact VALUES (1,45, 15, SYSDATE -100, 300,70); -- added
INSERT INTO my_fact VALUES (1,55, 29, SYSDATE, 100,70);
INSERT INTO my_fact VALUES (2,32, 15, SYSDATE -100, 100,70);
INSERT INTO my_fact VALUES (2,32, 10, SYSDATE-130, 100,70);
INSERT INTO my_fact VALUES (3,32, 20, SYSDATE-66, 100,70);
INSERT INTO my_fact VALUES (3,78, 29, SYSDATE, 100,70);
now my query:
SELECT product_id, customer_id, week_no,
avg(stock_on_hand)  avg_current_week, 
avg(avg(stock_on_hand)) OVER (ORDER BY (trunc(transaction_date)) RANGE BETWEEN INTERVAL '364' DAY(3) PRECEDING AND INTERVAL '1' PRECEDING) avg_52week
FROM my_fact
WHERE to_char(SYSDATE, 'WW') = week_no -- OTHER THAN THE ANALYTICAL AGGREGATE JUST WANT TO LOOK AT CURRENT WEEK
GROUP BY product_id, customer_id, week_no, TRUNC(transacion_date)
Get the error ora-30089 and don't know why?
Also, according to my goal above is this structured correctly query (the analytical part)?

Thank you!

Published by: padawan on July 19, 2010 11:32

Hello

It would be better to display full ressults you want, not just a line.

I think not only analytical help in this problem. Just use the AVG aggregation, with a CASE expression to get an average based on a subset of the results (for example, current week).

SELECT        product_id
,       customer_id
,       MAX (week_no)          AS week_no
,       AVG ( CASE
              WHEN  week_no           = TO_CHAR (SYSDATE, 'WW')
              AND       transaction_date     > SYSDATE - 7     -- to guard against same week in an earlier year
              THEN  stock_on_hand
          END
           )               AS avg_current_week
,       AVG (stock_on_hand)     AS avg_52_week
FROM       my_fact
WHERE       transaction_date     >= TRUNC (SYSDATE) - 364
AND       transaction_date     <  TRUNC (SYSDATE) + 1
GROUP BY  product_id
,       customer_id
HAVING       MAX (week_no)     = TO_CHAR (SYSDATE, 'WW')
;

If you average per week and then take the average of the averages, you are then weighted averages; in the contrary case, the average of 150 of the current week and 300 a another week would be 150 + 300 / 2 = 225, which is not what you want you want each of the lines that contributes to the average of the first (on 150) to be considered separately.

Tags: Database

Similar Questions

  • Issue Analytics

    Not sure what is wrong, any user can connect to Analytics that we have not configured with any AD, we simply use default authenticator as required in the optional indicator.

    One has faced this issue before?

    Thank you

    Ahmed.

    I tried all the things when I tried the optional control indicator and sufficient, that is to say that authentication failed when I connect to Analytics

  • Pivot does not work; Issue Analytics

    I had a lot of things this weekend on difficult request for me but now have other questions. You must run the query top to understand the understand the second.

    Background:
    It is a reporting period that includes amounts of beginning of year as last year.

    My report example is for 9 period which begins on August 24, 2009
    Period has 5 weeks (most of the times have 4).
    Also if delay is required in week 3 and then just a few weeks 1 and 2 will be reflected on report


    The report looks like this: (data provided should produce these numbers except perhaps the column for a YEAR.)
                 WEEK1       WEEK2           WEEK3         WEEK4             WEEK5       Period-to-date          Year-to-date
    Net - Landau     11,485.79   11,416.60      11,609.01     11,049.76      12,867.10      58,428.00             454,231.37       
    Net - AW     0.00               0.00          0.00        0.00                   0.00          0.00              0.00
    Net - LJS     0.00                   0.00           0.00         0.00           0.00          0.00            0.00
    Net - TB     7,118.17     7,228.13    7,657.94      7,699.53           7,958.53      37,662.00            306,115.59       
    Total Net     18,603.96    18,644.73      19,266.95     18,749.29         20,825.63      96,091.00            760,346.96       
    
    Last Year Sales     23,515.95    24,244.37       23,962.74    23,134.79      24,440.87      119,299.00           856,363.36      
    Increase     (4,911.99)  (5,599.64)      (4,695.79)  (4,385.50)           (3,615.24)     (23,208.00)           (96,016.40)      
    Last year 
      Next Week     24,244.37    23,962.74       23,134.79    24,440.87      23,055.87      118,839.00           879,419.23      
    -= Is the current year dates
    Beginning of the period: (BOP) Mon Aug 24
    Week 1: Mon Aug 24-30 August
    Week 2: Monday 11 August - 6 September
    Week 3: my Sep 7 - September 13
    Week 4: Monday 14 September - 20 September
    Week 5: Lun 21 Sept - 27 September
    Beginning of the fiscal year (BOY) = 28 December 08 '

    -= Is last year's dates
    Beginning of the period: Mon Aug 25 (BOP_LY)
    Week 1: Mon Aug 25-31 August
    Week 2: Monday 1st August - 7 September
    Week 3: my 8 Sep - 7 14
    Week 4: Monday, September 15-21 7
    Week 5: Mon Sept 22-28 Sept
    Beginning of the fiscal year (BOY) = 31 December 07 '


    My weekend challenge was to get a full year of data vs only period data.
    There are 7 columns on the report. 5 weeks period, (the weeks total) PeriodToDate and YearToDate (PeriodToDate + sum of all data from the beginning of the year at the end of the previous period.
    I'm not really interested in the PTD, the program can handle it. I had the BOY date with the following code:

    All data is summarized for the week and grouped by storeid and TRUNC (date, 'IW') which is set at the Monday of each week.
    each week. (The result set contains data for 2 stores instead of 1. This is only to make sure that my request was correctly filtering)
    drop table my_csh_main;
    
     CREATE TABLE MY_CSH_MAIN
       (     "FK_STR_MAIN_ID" NUMBER, 
         "BUSI_DATE" DATE, 
         "CONF_NUMB2" NUMBER, 
         "CONF_NUMB49" NUMBER, 
         "CONF_NUMB44" NUMBER, 
         "CONF_NUMB3" NUMBER, 
         "CONF_NUMB4" NUMBER, 
         "CONF_NUMB38" NUMBER, 
         "CONF_NUMB56" NUMBER
       );
     
    REM INSERTING into MY_CSH_MAIN
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (141,to_date('28-AUG-08','DD-MON-RR'),22103.69,0,0,119,0,4605.21,0);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (141,to_date('27-AUG-09','DD-MON-RR'),18081.37,0,0,0,0,3533.45,0);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (141,to_date('17-SEP-09','DD-MON-RR'),18211.29,0,0,0,0,3806.32,0);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (221,to_date('04-SEP-08','DD-MON-RR'),24244.37,0,0,284.94,0,0,9395.63);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (221,to_date('03-SEP-09','DD-MON-RR'),18644.73,0,0,85.48,0,0,7228.13);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (141,to_date('24-SEP-09','DD-MON-RR'),16809.21,0,0,64.99,0,3014.61,0);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (221,to_date('25-SEP-08','DD-MON-RR'),24440.87,0,0,0,0,0,9469.64);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (221,to_date('28-AUG-08','DD-MON-RR'),23515.95,0,0,0,80.38,0,9379.9);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (221,to_date('24-SEP-09','DD-MON-RR'),20825.63,0,0,73.97,0,0,7958.53);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (221,to_date('17-SEP-09','DD-MON-RR'),18749.29,0,0,0,0,0,7699.53);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (141,to_date('11-SEP-08','DD-MON-RR'),22839.3,0,0,206.39,116.74,4493.28,0);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (141,to_date('04-SEP-08','DD-MON-RR'),22627.74,0,0,279.98,0,4423.83,0);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (221,to_date('27-AUG-09','DD-MON-RR'),18603.96,0,0,81.25,0,0,7118.17);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (221,to_date('11-SEP-08','DD-MON-RR'),23962.74,0,0,153.1,0,0,9335.35);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (221,to_date('18-SEP-08','DD-MON-RR'),23134.79,0,0,44.12,0,0,8978.87);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (141,to_date('25-SEP-08','DD-MON-RR'),24950.45,0,0,129.98,0,5330.22,0);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (221,to_date('10-SEP-09','DD-MON-RR'),19266.95,0,0,0,0,0,7657.94);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (141,to_date('03-SEP-09','DD-MON-RR'),17183.25,0,0,0,0,3487.12,0);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (141,to_date('18-SEP-08','DD-MON-RR'),21372.82,0,0,0,0,4546.15,0);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (141,to_date('10-SEP-09','DD-MON-RR'),17688.41,0,0,113.12,0,3424.17,0);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (141,to_date('31-DEC-08','DD-MON-RR'),611016.24,0,0,1276.62,724.96,122236.02,0);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (221,to_date('31-DEC-08','DD-MON-RR'),667612.63,0,0,1018.81,0,0,269777.87);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (141,to_date('02-JAN-08','DD-MON-RR'),1676737.13,0,0,5652.47,3850.68,345971.1,500.5);
    Insert into MY_CSH_MAIN (FK_STR_MAIN_ID,BUSI_DATE,CONF_NUMB2,CONF_NUMB49,CONF_NUMB44,CONF_NUMB3,CONF_NUMB4,CONF_NUMB38,CONF_NUMB56) values (221,to_date('02-JAN-08','DD-MON-RR'),1786451.11,0,0,3167.61,175.38,0,788438.73);
    
    
    
      CREATE TABLE  LANDAU_REPORT_STORES 
       (     "COMPANYNAME" CHAR(40 BYTE), 
         "DISTRICTNAME" VARCHAR2(50 BYTE), 
         "STOREID" NUMBER(4,0) NOT NULL ENABLE, 
         "STORENAME" VARCHAR2(70 BYTE), 
         "STORENBR" CHAR(4 BYTE) NOT NULL ENABLE
       )  
    
    
    REM INSERTING into LANDAU_REPORT_STORES
    Insert into LANDAU_REPORT_STORES (COMPANYNAME,DISTRICTNAME,STOREID,STORENAME,STORENBR) values ('Landau                                  ','DIST 10',64,'N_Main','0004');
    Insert into LANDAU_REPORT_STORES(COMPANYNAME,DISTRICTNAME,STOREID,STORENAME,STORENBR) values ('Landau                                  ','DIST 10',65,'Belvidere','0005');
    Insert into LANDAU_REPORT_STORES(COMPANYNAME,DISTRICTNAME,STOREID,STORENAME,STORENBR) values ('Landau                                  ','DIST 10',104,'Mulford','0032');
    Insert into LANDAU_REPORT_STORES(COMPANYNAME,DISTRICTNAME,STOREID,STORENAME,STORENBR) values ('Landau                                  ','DIST 50',141,'Charleston','0043');
    Insert into LANDAU_REPORT_STORES(COMPANYNAME,DISTRICTNAME,STOREID,STORENAME,STORENBR) values ('Landau                                  ','DIST 10',61,'Kilburn','0002');
    Insert into LANDAU_REPORT_STORES(COMPANYNAME,DISTRICTNAME,STOREID,STORENAME,STORENBR) values ('Landau                                  ','DIST 10',62,'11th_St','0003');
    
       with WeeklyTotals as 
       ( select                           StoreId
                                         , week_date
                                         , net_sales
                                         , ljs_food_sales
                                         , total_drink_sales
                                         , net_food
                                         , CASE
                                              WHEN net_food is null  then 0
                                              WHEN net_food  = 0  then 0
                                              ELSE Ljs_food_sales / net_food
                                           END as LJS_Percent
                                         , CASE
                                              WHEN net_food is null  then 0
                                              WHEN net_food = 0  then 0
                                              else total_drink_sales * (ljs_food_sales / net_food)
                                           END as LJS_Drinks
                                         , aw_sales
                                         , tb_sales
              FROM                            (Select fk_str_main_id as StoreId, 
                                                                               trunc(csh.busi_date, 'IW') as week_date, 
                                                                         sum(csh.conf_numb2) As net_sales,
                                                                         sum(conf_numb49) as ljs_food_sales,
                                                                         sum(conf_numb44)  As total_drink_sales,
                                                                         sum(csh.conf_numb2) - sum(CONF_NUMB44) - sum(conf_numb3) - sum(conf_numb4) AS net_food,
                                                                         sum(conf_numb38) As aw_sales,
                                                                         sum(conf_numb56)  as tb_sales
                                                     from my_csh_main csh
                                                     WHERE BUSI_DATE BETWEEN  TO_DATE( '28-Dec-08' ,'DD-MON-YY') AND  TO_DATE( '27-SEP-09' ,'DD-MON-YY') 
                                                    and fk_str_main_id in (141, 221)
                                                    GROUP BY CSH.FK_STR_MAIN_ID,    trunc(csh.busi_date, 'IW')
                                               ) 
       )
       ,  WeeklyFoodSalesLY as
     (
        SELECT    fk_str_main_id AS storeid
               ,  TRUNC(busi_date, 'iw') week_date
               ,  SUM(csh.conf_numb2) AS net_sales
        FROM   my_csh_main csh
        WHERE busi_date BETWEEN   to_date('31-DEc-07', 'dd-Mon-yy')  and  to_date('28-Sep-08', 'dd-Mon-yy')
        GROUP BY fk_str_main_id, TRUNC(busi_date, 'iw')
     )
      , StoreDetails  AS
     (
             select * from LANDAU_REPORT_STORES where STORENAME NOT like  '%CLOSED%'  order by DistrictNAme, StoreNbr
     )
       Select  
                 foods.storeid
              ,   CASE
                   WHEN   to_date(Foods.week_date, 'dd-Mon-yy')  =  to_date('24-AUG-09', 'dd-Mon-yy')  then 1
                   WHEN   to_date(Foods.week_date, 'dd-Mon-yy')  =  to_date('24-AUG-09', 'dd-Mon-yy') + 7 then 2
                   WHEN   to_date(Foods.week_date, 'dd-Mon-yy')  =  to_date('24-AUG-09', 'dd-Mon-yy') + 14 then 3
                   WHEN   to_date(Foods.week_date, 'dd-Mon-yy')  =  to_date('24-AUG-09','dd-Mon-yy') + 21 then 4
                   WHEN   to_date(Foods.week_date, 'dd-Mon-yy')  =  to_date('24-AUG-09', 'dd-Mon-yy') + 28 then 5
                   ELSE  0
             end as WeekNBr 
        ,   foods.week_date  as CurrWeekDate
        ,   foodsLY.week_date as LastYearWEekDate    
        ,   ROUND(NVL(foods.net_sales - (aw_sales + tb_sales + ljs_drinks + ljs_food_sales ), 0), 2) as Landau_Net_Sales
        ,   ROUND(NVL(aw_sales, 0), 2) as aw_sales
        ,   ROUND(NVL(tb_sales, 0), 2) as tb_sales
        ,   ROUND(NVL(ljs_drinks + ljs_food_sales, 0),2)    as ljs_net_sales
        ,   ROUND(NVL(foods.Net_Sales, 0), 2) as net_sales
        --==
        -- Last Year Sales and Last Year Next Year Sales
       --==
     ,    ROUND(NVL(foodsLY.Net_Sales, 0),2)    as    WTDLYNetSales
     ,    ROUND(NVL(Foods.Net_Sales -  FoodsLY.Net_Sales, 0),2)  as    WTDSalesIncrease
     -- ,    ROUND(NVL(FoodsLY_NextWeek.Net_Sales, 0), 2)          as    WTDFoodsSalesLY  
     ,   stores.*
     from WEeklyTotals Foods  
     LEFT OUTER JOIN Weeklyfoodsalesly foodsly ON foodsly.storeid = foods.storeid
                                              AND foodsly.week_date = DECODE(foods.week_date,
                                                                             to_date('24-AUG-09', 'dd-Mon-yy') ,       to_date('25-AUG-08', 'dd-Mon-yy') ,
                                                                             to_date('24-AUG-09', 'dd-Mon-yy')  + 7,   to_date('25-AUG-08', 'dd-Mon-yy') + 7,
                                                                             to_date('24-AUG-09', 'dd-Mon-yy')  + 14,  to_date('25-AUG-08', 'dd-Mon-yy') + 14,
                                                                             to_date('24-AUG-09', 'dd-Mon-yy')  + 21,  to_date('25-AUG-08', 'dd-Mon-yy') + 21,
                                                                             to_date('24-AUG-09', 'dd-Mon-yy')  + 28,  to_date('25-AUG-08', 'dd-Mon-yy') + 28)
    LEFT OUTER  JOIN  StoreDetails             stores  ON     stores.storeid   = Foods.storeid;
    one exception. In a With statement, I get a recordset containing all the data of the last few years. I couldn't understand the Pivot
    for the past year next week. This means that next week, a year ago. I pulled out a snippet to work with, but could not
    at work:


    The problem came when I tried to rotate the last year's sales. I shot this code snippet to test with, but couldn't make it work.
     with   WeeklyFoodSalesLY  as
     (         SELECT  fk_str_main_id AS storeid
                 ,   TRUNC(busi_date, 'iw') week_date
                 ,   sum(conf_numb2)   conf_numb2 
               FROM  my_csh_main csh     
               WHERE busi_date BETWEEN   to_date('31-dec-07', 'dd-Mon-yy')  and  to_date('28-Sep-08', 'dd-Mon-yy') + 7
               and fk_str_main_id = 141   
               GROUP BY  fk_str_main_id , TRUNC(busi_date, 'iw')       
     )
     ,  sales_ly as 
     (    SELECT      storeid 
                    , week_date 
                    , sum(conf_numb2) as net_sales 
          from WeeklyFoodSalesLY
          WHERE week_date BETWEEN   to_date('25-Aug-08', 'dd-Mon-yy')  and  to_date('28-Sep-08', 'dd-Mon-yy')  
          GROUP BY  storeid , week_date     
          UNION ALL
          SELECT      storeid 
                    , week_date 
                    , sum(conf_numb2) as net_sales 
          from WeeklyFoodSalesLY
          WHERE week_date BETWEEN   to_date('25-Aug-08', 'dd-Mon-yy') + 7   and  to_date('28-Sep-08', 'dd-Mon-yy') + 7
          GROUP BY  storeid , week_date 
          UNION ALL
          SELECT      storeid 
                    , week_date 
                    , sum(conf_numb2) as net_sales 
          from WeeklyFoodSalesLY
          WHERE week_date < to_date('25-Aug-08', 'dd-Mon-yy')  
          GROUP BY  storeid , week_date 
     ) 
    ,  pivoted_sales_ly as 
    (    SELECT          storeid 
                         week_date
                    ,    MAX(DECODE(week_date, to_date('25-Aug-08', 'dd-Mon-yy'),          net_sales))        as lastyear
                    ,    MAX(DECODE(week_date, to_date('25-Aug-08', 'dd-Mon-yy') + 7,      net_sales))        as lastyearnextweek
                    ,    MAX(DECODE(week_date, to_date('31-dec-07', 'dd-Mon-yy'),          net_sales))        as lastyeartotal
          from sales_ly
          GROUP BY  storeid, week_date
     ) 
    Select * 
    from pivoted_sales_ly;  
    What am I do wrong here? Once I get this I can work in the original query.


    Analytics:


    Boneist gave me a code to try it last week:
    The combination refCursors and summary
    who created the PTD column.

    I could never make it work because I was twisting so much with the request, but is there a way of getting the PTD without
    to add an additional column of PTD for each week.



    Another thing:
    I would like to know how to use analytics to roll up report of division in another cursor.

    Published by: TheHTMLDJ on October 26, 2009 04:50

    Published by: TheHTMLDJ on October 26, 2009 04:59

    TheHTMLDJ wrote:
    Can you tell me why this code in my original query do not rotate correctly: (:)

    ,  pivoted_sales_ly as
    (    SELECT          storeid
    week_date
    ,    MAX(DECODE(week_date, to_date('25-Aug-08', 'dd-Mon-yy'),          net_sales))        as lastyear
    ,    MAX(DECODE(week_date, to_date('25-Aug-08', 'dd-Mon-yy') + 7,      net_sales))        as lastyearnextweek
    ,    MAX(DECODE(week_date, to_date('31-dec-07', 'dd-Mon-yy'),          net_sales))        as lastyeartotal
    from sales_ly
    GROUP BY  storeid, week_date
    ) 
    

    Yes two things:

    1 missing the comma after storeid, which is causing the request to think that storeid is actually the column week_date (confusion!)
    2. When you are rotating on a particular column (in your case, week_date), you don't want to include this column in the selection or group of clauses.

    This should do what you are looking for:

    with   WeeklyFoodSalesLY  as
     (         SELECT  fk_str_main_id AS storeid
                 ,   TRUNC(busi_date, 'iw') week_date
                 ,   sum(conf_numb2)   net_sales
               FROM  my_csh_main csh
               WHERE busi_date BETWEEN   to_date('31-dec-07', 'dd-Mon-yy')  and  to_date('22-Sep-08', 'dd-Mon-yy') + 7
               --and fk_str_main_id = 141
               GROUP BY  fk_str_main_id , TRUNC(busi_date, 'iw')
     )
     ,  sales_ly as
     (    select storeid,
                 week_date,
                 net_sales,
                 sum(net_sales) OVER (partition by storeid order by week_date) net_sales_ytd
          from   WeeklyFoodSalesLY
     )
    ,  pivoted_sales_ly as
    (    SELECT          storeid,
                         MAX(DECODE(week_date, to_date('25-Aug-08', 'dd-Mon-yy'),          net_sales))        as lastyear
                    ,    MAX(DECODE(week_date, to_date('25-Aug-08', 'dd-Mon-yy') + 7,      net_sales))        as lastyearnextweek
                    ,    MAX(DECODE(week_date, to_date('25-Aug-08', 'dd-Mon-yy'),          net_sales_ytd))        as lastyeartotal
          from sales_ly
          GROUP BY  storeid
     )
    Select *
    from pivoted_sales_ly
    order by storeid;  
    
       STOREID   LASTYEAR LASTYEARNEXTWEEK LASTYEARTOTAL
    ---------- ---------- ---------------- -------------
           141   22103.69         22627.74    1698840.82
           221   23515.95         24244.37    1809967.06
    

    I don't know where you get your numbers from 2nd and 3rd, but I couldn't have the query to generate?

  • ORA-00020: maximum number of processes (150) exceeded after 11.2.0.3.0patch

    Hi gurus,

    I'm having this issue of ORA-00020: maximum number of processes (150) exceeded after that I did successfully a 11.2.0.1.0 on Linux 5.4 11.2.0.3.0patch.

    I understand that I must increase the process boundary, but I can not even connect as SYS or even ' / '.

    I ran ' ps - ef | grep oracle' and killed some process but the same problem.

    Any idea?

    BJ

    Try this...

    http://tech.e2sn.com/Oracle/troubleshooting/hang/how-to-log-on-even-when-SYSDBA-can-t-do-so

  • Oracle not available, shared memory realm does not exist

    Hello

    I have problem during the installation of XE on Windows 2003 R2 SP 2 Enterprise edition. I have uninstall oracle xe and still the same result. Finally, I uninstall the windows and start all over again, surprisingly the always the same result. FYI, we have normally no problem during installation because it is part of our system, we sell to our customers who require Oracle xe. It is the first time we have seen this issue.

    ORA-01034: Oracle not available
    ORA-27101: shared memory realm does not exist.

    Oracle XE and Auditor services is started in windows services.

    If we try to start the message occurred.

    SQL > connect sysdba virtue

    Connect to an instance is idle.
    SQL > startup
    ORA-44412: setting memory XE edition invalid or unspecified
    SQL >

    I can send you the journal oracle_xe, ora init and OpsBuildAll.log to create the database.

    When compared with the installation of work, we have seen that the size of the oraclexe folder is less, it's just 233 MB while the work is beyond 1 GB. After investigation, discovered that the .dbf files is not available in the oradata folder, I tried to copy the files from one operation but the problem remains the same, no doubt there are a lot of missing more files.


    Appreciate your help on this.

    Thank you

    Agus

    It's a shame I don't remember that one. The error message (and solution) was a similar here: {: identifier of the thread = 2322695}, with a real solution from here: {message identifier: = 10039007}
    (Just to keep an eye on this kind of mistake and to link the case...)

    I'm glad to hear that you solved the issue now, but I'm still a bit puzzled how this could happen. Possibly management of memory to the point 10.2 XE does not get what he expected on systems with Hyper-Threading or several used CPU sockets, maybe is the fact, it cannot apply/monitor limitations as expected. Still the error message is a bit misleading.
    It would be interesting to know if 11.2 XE gets along on this platform. Maybe you have time to give it a try someday? I would recommend to use 11.2 XE for a new installation anyway... ;)
    It is likely to work because no one reported an error like that with 11.2 XE and there are a few positions, mainly on licensing issues, which indicate 11.2 would also go on HT and dual socket machines, but it is possible that they still had something different on their machines.

    -Udo

    P.S.:
    @Fredrik: If our messages overlap on this reference... ;)
    @Agus: If you think that your problem has been resolved, please mark this thread as answered and all useful/correct answer accordingly, for other users looking for a similar question will be able to easily spot the positions in question.
    Thank you!

    Published by: Udo on 23.03.2012 09:15

  • WAITED TOO LONG FOR A CACHE LINE ENQUEUE LOCK!

    Hi all

    Ora10g

    All of a sudden this afternoon users have complained that they are unable to connect to the database, I tried to log in and was able to confirm that suspended connection.

    I checked the alerts log and I found these:
    Thread 1 advanced to log sequence 11682
      Current log# 3 seq# 11682 mem# 0: D:\ORACLE\ORADATA\TURBDV2\REDO03.LOG
    Mon Jun 13 09:00:15 2011
    WARNING: inbound connection timed out (ORA-3136)
    Mon Jun 13 10:00:27 2011
    Thread 1 advanced to log sequence 11683
      Current log# 1 seq# 11683 mem# 0: D:\ORACLE\ORADATA\TURBDV2\REDO01.LOG
    Mon Jun 13 13:15:50 2011
    WARNING: inbound connection timed out (ORA-3136)
    Mon Jun 13 13:51:28 2011
    
    WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK! pid=27
    System State dumped to trace file c:\oracle\admin\turbdv2\udump\turbdv2_ora_7668.trc Mon Jun 13 14:50:44 2011 WARNING: inbound connection timed out (ORA-3136) Mon Jun 13 15:23:10 2011
    How to solve this error please...

    KinsaKaUy? wrote:
    I checked the alerts log and I found these:

    
    Thread 1 advanced to log sequence 11682
    Current log# 3 seq# 11682 mem# 0: D:\ORACLE\ORADATA\TURBDV2\REDO03.LOG
    Mon Jun 13 09:00:15 2011
    WARNING: inbound connection timed out (ORA-3136)
    Mon Jun 13 10:00:27 2011
    Thread 1 advanced to log sequence 11683
    Current log# 1 seq# 11683 mem# 0: D:\ORACLE\ORADATA\TURBDV2\REDO01.LOG
    Mon Jun 13 13:15:50 2011
    WARNING: inbound connection timed out (ORA-3136)
    Mon Jun 13 13:51:28 2011
    
    
    WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK! pid=27

    System State dumped to trace file c:\oracle\admin\turbdv2\udump\turbdv2_ora_7668.trc
    Mon Jun 13 14:50:44 2011
    WARNING: inbound connection timed out (ORA-3136)
    Mon Jun 13 15:23:10 2011
    

    How do i resolve this error please....

    Well looking at alert.log, you encountered two issue a)ORA-3136 and b) WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK

    For a) ORA-3136 , please follow the below metalink note which explains about the resolution for this. You might need to increase SQLNET.INBOUND_CONNECT_TIMEOUT from 60 to slight higher.
    Following the note from MOS
    Troubleshooting ORA-3136: WARNING Inbound Connection Timed Out [ID 465043.1]

    
    The default value of 60 seconds is good enough in most conditions for the database server to authenticate a client connection. If it is taking longer, then it's worth checking the following items before implementing the workaround: 
    
    1. Check whether local connection on the database server is successful & quick.
    2. If local connections are quick ,then check for underlying network delay with the help of your network administrator.
    3. Check whether your Database performance has degraded in anyway.
    4. Check alert log for any critical errors for eg, ORA-600 or ORA-7445 and get them  resolved first. 
    

    As you said that users could not connect to the database, so above may be the reasons for what you need at the Fund.

    Second, you got the warning message "WHEREAS TOO LONG for A LINE CACHE ENQUEUE LOCK", which is also linked to the shared pool.

    Make a small conclusion on two question above, it seems that your shared pool size is not enough. For this you must check AWR reports during this difficult period and confirmation that there is not any event of related waiting for shared pool.

  • ORA-29868: cannot issue the DOF on a field marked as LOAD index

    When I try to delete a text index I get the message: ORA-29868: cannot issue the DOF on a field marked as LOAD index

    Here are all of the command I use to drop it:

    Start

    ctx_ddl.drop_preference ('"IDX_SO_DST" ');

    end;

    /

    Start

    ctx_ddl.drop_preference ('"IDX_SO_FIL" ');

    end;

    /

    Start

    ctx_ddl.drop_section_group ('"IDX_SO_SGP" ');

    end;

    /

    Start

    ctx_ddl.drop_preference ('"IDX_SO_LEX" ');

    end;

    /

    Start

    -ctx_ddl.unsetset_attribute ('"IDX_SO_WDL" ', 'STEMMER');

    -ctx_ddl.unset_attribute ('"IDX_SO_WDL" ', 'FUZZY_MATCH');

    ctx_ddl.drop_preference ('"IDX_SO_WDL" ');

    end;

    /

    Start

    ctx_ddl.drop_stoplist ('"IDX_SO_SPL" ');

    end;

    /

    Start

    ctx_ddl.unset_attribute ('"IDX_SO_STO" ', 'R_TABLE_CLAUSE');

    ctx_ddl.unset_attribute ('"IDX_SO_STO" ', 'I_INDEX_CLAUSE');

    ctx_ddl.drop_preference ('"IDX_SO_STO" ');

    end;

    /

    Drop index "ACQUISITIONS." "" IDX_SO ".

    When I try to get command of the force

    ALTER INDEX "ACQUISITIONS." "' IDX_SO ' DROP FORCE

    I get the message:

    ORA-14004: lack of keyword SCORE

    I don't know how to get this table partitions

    Can you advise how to find partitions?

    or how to remove the particular index successful? This is a test environment.

    I run 11.2 under windows.

    Thank you

    It looks that it is locally partitioned index, so "alter index" will not work without a partition name. But you can try simply

    DROP INDEX FORCE;

    If this does not work, try to restart the database and repeat the index fall. Do not use FORCE unless you have to.

    If it still does not work, you will need to login as SYS and run

    ctxsys.ctx_adm.mark_failed ("", "")

    that resets any clue to 'FAIL' status and allow to delete the index (even once, do not use FORCE unless you have to).

  • ORA-29279: SMTP permanent error: 530 5.7.0 must issue a STARTTLS command fi

    Hello friend

    I changed my smtp server to send email, but now I get a different as error below

    ORA-29279: SMTP permanent error: 530 5.7.0 must issue a STARTTLS command first. 2sm141783tif.39

    I don't know what is the STARTTLS command.

    Pls help me.

    Thank you
    Uttam SIngh

    Uttam,

    Obviously the STARTTLS is a SMTP command.
    This is a forum on ORACLE.
    Of course, you can google STARTTLS!
    Could you PLEASE, PLEASE, PLEASE be a little more industrious and stop cluttering up this forum with irrelevant questions?

    THANKING YOU IN ADVANCE
    -----
    Sybrand Bakker
    Senior Oracle DBA

  • The 11g R2 RAC installation issue: ORA-00304: requested INSTANCE_NUMBER is busy

    Hi guys...


    There are 4 servers, 2 are next to primary and remaining 2 servers are on the primary side. With the installation of RAC 2 nodes using ASM.
    Here are the names
    LOC1DB1

    LOC1DB2

    LOC2DB1

    LOC2DB2

    After the installation of grid and the database, I made the following changes:

    • State of the cluster enabled using the command
      • crsctl State resource t //and the exit is 'open' for both the database.
    • Switch to the oracle user
    • Connect to sql
      • sqlplus sys / [email protected]:1521 / xxx as sysdba //starts successfully with this message "with the Real Application Clusters and automatic storage management options:
      • immediate stop
    • Connect to sql
      • sqlplus / as sysdba //connected successfully with the message "sqlplus / as sysdba.
      • startup

    He invites an error 'ORA-29760: instance_number parameter not specified not'.»» So I added a line "instance_number = 3"to the file 'initORCL.ora' in a new fast error on LOC1DB2 and LOC2DB2 servers but all servers after I could so that it starts properly on LOC1DB1 and LOC2DB1 it is to say"ORA-00304: requested INSTANCE_NUMBER is busy'." " so please help what to do now. I changed the instance number several times but his does not work.

    > So I added a line "instance_number = 3"to the file 'initORCL.ora' in a new fast error on LOC1DB2 and LOC2DB2 servers but all servers after I could so that it starts properly on LOC1DB1 and LOC2DB1 it is to say"ORA-00304: requested INSTANCE_NUMBER is busy'." " s

    Your database has a name, lets call him ORCL. Oracle RAC, each instance will have a different name that is the concatenated with the INSTANCE_NUMBER DB_NAME. If node 1 will be instance ORCL1 and node 2 will ORCL2 instance. Your instance in the settings file number must also be set for each instance. If the parameters could look like:

    orcl1.instance_number = 1

    orcl1.instance_number = 2

    What you were doing was this:

    * .instance_number = 3

    Who tries to assign the number 3 of the instance to all instances. This is incorrect, as you discovered. First start with this number very well. The second instance tries first number but the number of the instance is already used, where the error ORA-304.

    In addition, you should not use the initORCL.ora. In fact, in 11.2, you use a SPFILE shared for Oracle RAC. A settings file to be used by all instances of the database.

    > sqlplus / as sysdba //connected successfully with the message "sqlplus / as sysdba.

    > start

    You do not use SQL * Plus to start/stop a database Oracle RAC. You use the srvctl utility.

    srvctl start database-d db_name

    srvctl stop database db_name immediate o d

    See you soon,.
    Brian

  • ORA-12514 &amp; listener State Instance status unknown issue

    Dear all,

    Version of database - 10.2.0.5.0
    Operating system - Windows XP

    I'm using the version of Oracle 10 g, who has two services (bit10g and ora10g) is installed.
    Ora10g service was operating prior to upgradation of database at 10.2.0.5.0 and it was fine.
    On upgradation I was unable to start and connect using ora10g so I created another which is bit10g.

    Bit10g service worked fine for quite a long time. The last I have worked and connected was the game and it connected no problem.

    Now, when I'm trying to connect to the database today I am unable to connect because I'm
    ORA12514 - TNS:listener is not currently in service.

    Second, I tried to search the forums which led me to check the status of the listener.
    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    
    C:\Documents and Settings\Admin>lsnrctl status
    
    LSNRCTL for 32-bit Windows: Version 10.2.0.5.0 - Production on 12-JAN-2013 11:42
    :54
    
    Copyright (c) 1991, 2010, Oracle.  All rights reserved.
    
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=toshiba-arif)(PORT=1521)
    ))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for 32-bit Windows: Version 10.2.0.5.0 - Produ
    ction
    Start Date                12-JAN-2013 11:18:12
    Uptime                    0 days 0 hr. 24 min. 43 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   C:\ora10g\product\10.2.0\db_1\network\admin\listener.o
    ra
    Listener Log File         C:\ora10g\product\10.2.0\db_1\network\log\listener.log
    
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=toshiba-arif)(PORT=1521)))
    Services Summary...
    Service "Oracle8" has 1 instance(s).
      Instance "bit10g", status UNKNOWN, has 1 handler(s) for this service...
    The command completed successfully
    Here is my listener.ora file
    # listener.ora Network Configuration File: C:\ora10g\product\10.2.0\db_1\NETWORK\ADMIN\listener.ora
    # Generated by Oracle configuration tools.
    
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (GLOBAL_DBNAME = Oracle8)
          (SID_NAME = bit10g)
        )
      )
    
    LISTENER =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = toshiba-arif)(PORT = 1521))
      )
    Please note that I am a developer without exhibition s/n.
    So please guide me so that I will be able to solve my problem.

    Thanks and greetings

    Arif Khadas

    S/O-error: (OS 1502) the event log file is full.

    That's your problem...

  • Linux compared to Windows XP issue - ORA-07445 10 g 10g: exception encountered

    I did a full database export using exp in a base of Linux 10 g:
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
    PL/SQL Release 10.2.0.2.0 - Production
    "CORE     10.2.0.2.0     Production"
    TNS for Linux: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    Linux version:
    Red Hat Enterprise Linux ES release 4 (Nahant Update 5)
    I have installed Oracle 10 g on Windows XP:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    "CORE     10.2.0.1.0     Production"
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    The version of Windows XP is:
    System:
        Microsoft Windows XP
        Professional
        Version 2002
        Service Pack 3
    Intel(R) Core(TM)2 CPU
     6300 @ 1.86GHz
    1.86 GHz, 3.25 GM or RAM
    I did an import complete database after you create storage space required database 10g on Linux to Windows.
    On the database 10g for Windows, I put maximum SGA size to 1300 MB and the size of the Total SGA to 1000 MB. I put the overall target of PGA at 500 MB.

    This Windows box will be used by more than 2 developers for a change to our application that isn't backward compatible (with respect to the database) with earlier versions of the application that uses the database. Asked me to create this so we could develop this branch without affecting the rest of the development team working on further improvements on the Linux machine.

    I then ran a few packages that update data to a set of tables. It passes through a code that has a lot of data, so I have discovered all of the problems.

    At a specific time in the execution of these packages, I get the following error:
    ORA-07445: exception encountered: core dump [ACCESS_VIOLATION] [_qkkIsOJKey+299] [PC:0x1E58F73] [ADDR:0x80] [UNABLE_TO_READ] []
    I have read the trace file and isolated to a single, somewhat complex query. I tore the request into smaller requests, trying to isolate what was causing the problem. Whenever the memory image occurred, I could get simply by closing the connection and open a new connection. In my tests, I found the specific query that triggers the exception and a less effective version of this query that does not cause the exception. Please note that this exception has never happened on the Linux machine (or if it is produced on the basis of data of production or beta), and the code has been implemented for nearly 2 years.

    The code that causes the problem:
    SELECT UNIQUE 
           oc.ogc_case_id AS oc_ogc_case_id, 
           ogc.ogc_number AS ogc_number
      FROM (SELECT SUBSTR (REPLACE (afd.field_text, '-', '' ), 1, 6 )    AS ogc_number
              FROM ewoc_hw_snap.activity_field_data afd 
             WHERE afd.afdcd_activity_field_data_key = (SELECT afdc.activity_field_data_key 
                                                          FROM ewoc_hw_snap.activity_field_data_codes afdc 
                                                         WHERE afdc.name = 'Case Number' 
                                                       ) 
           ) ogc 
      LEFT OUTER JOIN lct_snap.ogc_cases oc 
            ON oc.ogc_number  = ogc.ogc_number
    The code that returns the same data, only slower and does not raise the exception:
    SELECT UNIQUE 
           (SELECT oc.ogc_case_id FROM lct_snap.ogc_cases oc WHERE oc.ogc_number = ogc.ogc_number ) AS oc_ogc_case_id,
           ogc.ogc_number AS ogc_number
      FROM (SELECT SUBSTR (REPLACE (afd.field_text, '-', '' ), 1, 6 )    AS ogc_number
              FROM ewoc_hw_snap.activity_field_data afd 
             WHERE afd.afdcd_activity_field_data_key = (SELECT afdc.activity_field_data_key 
                                                          FROM ewoc_hw_snap.activity_field_data_codes afdc 
                                                         WHERE afdc.name = 'Case Number' 
                                                       ) 
           ) ogc
    I ran both queries with SQL Developer 3.0.04 version. Developer SQL gives the error message: no more data to read from socket

    Any ideas?

    The above query is simple I could pare to raise and then solve the problem. The patch package is not as simple as the second query above since there is more than one column of data that I must return from the lct_snap.ogc_cases table. In any case, I wouldn't have to give up using the LEFT OUTER JOIN. There must be something wrong with the database of Windows. I didn't patch the Windows database without checking first on this forum to see if anyone had less intensive alternatives.

    I searched and found so many messages with the ORA-07445: exception encountered: core dump [ACCESS_VIOLATION] error, that I realize this is a somewhat generic error message.

    Published by: Starlight Rider on June 2, 2011 10:01

    Check this metalink note: 452951.1

    Concerning

    REDA

  • Issue of DB: error ORA-00333 &amp; ORA-01589: must use RESETLOGS or NORESETLOGS

    Hello

    I have question DB Oracle 9.2.0.6.0 all start-up:

    DB mount OK,

    SQL > alter database open;
    change the database open
    *
    ERROR on line 1:
    ORA-00333: make the mistake of reading newspaper block 106498 County 8192


    then I tried some recovery as below, but always error:
    =================================
    SQL > recover database until cancel;
    ORA-00279: change 9228925192024 September at 2010-12-29 15:20:48 needed to screw 1
    ORA-00289: suggestion: /ora/datafile/archive/1_250.dbf
    ORA-00280: change 9228925192024 thread 1 is in sequence #250


    Specify the log: {< RET > = suggested |} Filename | AUTO | CANCEL}

    ORA-00308: cannot open archived log ' / ora/datafile//archive/1_250.dbf'
    ORA-27037: unable to get file status
    Linux error: 2: no such file or directory
    Additional information: 3


    ORA-01547: WARNING: RECOVER succeeded but OPEN RESETLOGS would get below error
    ORA-01194: file 1 needs a recovery more match
    ORA-01110: data file 1: ' / ora/datafile/system01.dbf'

    ----------------------------------------

    SQL > alter database open resetlogs;
    ALTER database open resetlogs
    *
    ERROR on line 1:
    ORA-01194: file 1 needs a recovery more match
    ORA-01110: data file 1: ' / ora/datafile/system01.dbf'

    ----------------------------------------

    SQL > alter database open;
    change the database open
    *
    ERROR on line 1:
    ORA-01589: must use RESETLOGS or NORESETLOGS option of database open
    ====================================================

    Please guide to do this,

    Thank you and best regards,
    Vishnu

    If the Redo Log file CURRENT (status in V$ LOG or reading the alert.log indicating that the switch in this journal of recovery has been done) is corrupt, the only recourse is to RESTORE the database from a previous backup and then BACK up to the previous to redo log / ArchivedLog.

    See the documentation on the various scenarios:

    http://download.Oracle.com/docs/CD/B19306_01/backup.102/b14191/recoscen.htm#CACFFJFB

    Hemant K Collette

  • bin/dbstart: ORA-27125 start-up service released

    Hello world

    I have an ORA-27125-problem and google seems to only offer general solutions to the problem (for example systemctl-bad settings).

    I am currently upgrading our data base of development of Oracle Database 11.2.0.4 on Oracle Linux 5.11 x64_86 Oracle database 12.1.0.2 on Oracle Lniux 7.1 x64_86

    Everything works fine so far, except for one thing: the database may not start automatically when the operating system starts:

    / opt/oracle/1210/bin/DBSTART: startup of the database 'TB053D0 '.

    Kill Mar 31 13:15:10 CEST 2015

    SQL * more: Production release 12.1.0.2.0 on Tue 31 Mar 13:15:12 2015

    Copyright (c) 1982, 2014, Oracle.  All rights reserved.

    SQL > connect to an idle instance.

    SQL > ORA-27125: failed to create the shared memory segment

    Linux-x86_64 error: 1: operation not permitted

    Additional information: 6067

    Additional information: 2

    SQL > disconnected


    I get the same issue when I get back "systemctl start dbora.service'.


    Here's my .service-file:

    [The unit]

    Description = the Autostart Oracle Service

    After = syslog. Target network.target

    [Service]

    Type = simple

    RemainAfterExit = yes

    User = oracle

    Group = oracle

    ExecStart = / opt/oracle/1210/bin/dbstart/opt/oracle/1210

    ExecStop = / opt/oracle/1210/bin/dbshut/opt/oracle/1210

    [Install]

    Wantedde = multi - user .target

    However, when I manually run "dbstart/opt/oracle/1210/bin/dbstart/opt/oracle/1210" as user oracle, everything works fine:

    1210/bin/dbstart: startup of the database 'TB053D0 '.

    Kill Mar 31 13:27:09 CEST 2015

    SQL * more: Production release 12.1.0.2.0 on Tue 31 Mar 13:27:09 2015

    Copyright (c) 1982, 2014, Oracle.  All rights reserved.

    SQL > connect to an idle instance.

    SQL > ORACLE instance started.

    Total System Global Area 805306368 bytes

    Bytes of size 2929552 fixed

    222301296 variable size bytes

    574619648 of database buffers bytes

    Redo buffers 5455872 bytes

    Mounted database.

    Open database.

    SQL > disconnected from the database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production

    With the options of partitioning, OLAP, advanced analytics and Real Application Testing

    All the world is facing a similar problem?

    The server has "only" 2 GB of RAM and I am using 513 hugepages, however, I don't think that this could be a problem due to the fact that the database starts very well at startup 'normally' - I think maybe it's a question systemd /-bad configuration?

    Here are my sysctl settings:

    FS. AIO-max-nr = 1048576

    FS.file - max = 6815744

    kernel.core_uses_pid = 1

    kernel.msgmax = 65536

    kernel.msgmnb = 65536

    kernel.SEM = 250 32000 100 128

    kernel.shmmax = 2096623616

    kernel.shmall = 511871

    kernel.shmmni = 4096

    kernel. SysRq = 0

    NET. Core.rmem_default = 262144

    NET. Core.rmem_max = 4194304

    NET. Core.wmem_default = 262144

    NET. Core.wmem_max = 1048586

    NET. IPv4.conf.default.accept_source_route = 0

    NET. IPv4.conf.default.rp_filter = 1

    NET. IPv4.ip_forward = 0

    NET. IPv4.ip_local_port_range = 9000 65535

    NET. IPv4.tcp_syncookies = 1

    NET. IPv6.conf.All.disable_ipv6 = 1

    VM.nr_hugepages = 513

    I hope someone can help. Thanks in advance!

    "By (mild) process system memlock = 64K boundary.

    This line is

    "By (soft) limit of memlock = 24G system process.

    When the database is NOT started with SystemD.

    The rest is what you expect:

    Kill Mar 31 18:12:53 2015

    PAGESIZE AVAILABLE_PAGES EXPECTED_PAGES ALLOCATED_PAGES Error (s)

    Kill Mar 31 18:12:53 2015

    2048K 513 386 AND 386 NO

    The recommendation on by process Memlock does not appear when the database is started manually.

    It seems that settings in /etc/security/limits.conf (especially "oracle hard memlock 25165824") are not applied to the environment SystemD uses to run dbstart...

    Did a bit of google liked and found the answer:

    Here's what your service file ("' / usr/lib/systemd/system/dbora.service" ") should look like (limit-stars):

    [The unit]

    Description = the Autostart Oracle Service

    After = syslog. Target network.target

    [Service]

    Type = simple

    RemainAfterExit = yes

    User = oracle

    Group = oracle

    ExecStart = / opt/oracle/1210/bin/dbstart/opt/oracle/1210

    ExecStop = / opt/oracle/1210/bin/dbshut/opt/oracle/1210

    LimitMEMLOCK = infinite

    LimitNOFILE = 65535

    [Install]

    Wantedde = multi - user .target

    The database is now starts through systemd. Thanks @12cdb!

  • Revolution Analytics R - RxExec does not work on multiple cores when Random Forest model run.

    I have a model of analysis of the survival of random forests for learning and trying to run on Multicore Cluster using the revolution analytics company R 7.1.0 version.

    I used the code below

    Library (RevoScaleR)
    rxSetComputeContext (RxLocalParallel ())
    rxOptions (numCoresToUse = 5)

    And then execution of the RxExec to perform the function of random forests by using the randomForestSRC package.

    I could see 10% CPU utilization which is by default kernel 1.

    Am I missing something here? Must the randomForestSRC package be a parallel?

    This issue is beyond the scope of this site (for consumers) and to be sure, you get the best (and fastest) reply, we have to ask either on Technet (for IT Pro) or MSDN (for developers)

    If you give us a link to the new thread we can point to some resources it
  • ORA-01031: insufficient privileges while selectin view belongs to another schema in oracle database 11g

    Hello

    DB version 11.2.0.3.0

    We have a few views resides in the application schema, we cerated user and granted select on the view through the roles.

    but the user becomes ORA-01031: insufficient privileges when accessing the content view

    appreciated inputs

    BR

    Praaksh GR

    > I issued a grant select on Z.table - X with the option grant.

    This isn't what you need - you should

    Grant select on Z.table y with the option grant.

    Grant select on Y.view to X;

Maybe you are looking for

  • El Capitan 10.11.4 entry source cmd + space doesn't work

    Hello! The shortcut does not work, I uncheck the same shortcuts in the spotlight menu, but nothing happens (thanks.

  • To loop through a range of data

    Hi guys I have this set of numbers. 54 55 56 58 59 61 64 66. I want to loop through this set of numbers to give an array of result of 54 55 56 0 58 59 0 61 0 0 64 0 66. Simply, I'm trying to insert a zero in the interval + 1 white in this series of n

  • Windows is disabled and can now update windows

    Updated Windows on 16/04/12.  Now, however, it will not update and I noticed that my system is saying that 'this copy of windows is not activated. " It will not reactivate and gives the error code 0 x 80070426.  Have this Acer laptop since 2008!   In

  • Windows Vista home premium :(activation problem

    I have an acer aspire 6920 and im having a slight problem with activation windows.i installed vista Home premium and used magic jellybean to try to find my code of activation but it keeps saying that it will not be activated. the key on my sticker un

  • desktop icons becomes globes

    I find icons on the desktop that I attributed transformed into icons 'globe' for no apparent reason.  What causes this and I can keep it from happening?