Needs ur help in tuning a sql

Hi,
I have a partioned table.I am spooling output of an sql which joins the partioned table and another referece table of minimal data.
each partion except 3 contains 5 milllion records on average
othere 3 partitions has 6.6 million records (each one).
The sql takes 3 mins if it is triggered against the partions with 5 million but
the same sql is taing 8 hrs if it is triggered against the partion with 6.5 million.
Please help me how can avoid this performace issue
Below are IO statistics for the two cases
(partion with 6.5 million)
BLOCK_GETS=9
CONSISTENT_GETS=89533761
PHYSICAL_READS=15746
(partion with 5.0 million)
BLOCK_GETS=8
CONSISTENT_GETS=1215131
PHYSICAL_READS=28848

Hi,
post the select for the 2 SQL's and the EXPLAIN for each.

Similar Messages

  • Needs help for tuning the sql

    Hi
    I have a query which will read one fact table and 4 dimension table.fact table contains millions of records
    Can u suggest me how can i tune my query which uses the fact table to get the best performance.

    Which version of the database are you using? Have you enabled Star Transformation? What does the explain plan look like? Is this intended for building a materilaized view or as the basis for running an ad hoc report?
    We created bit map indexes on the joining columns.bitmap indexes or bitmap-join indexes?
    Cheers, APC

  • I need some help about Group by sql statement.

    Thank you for reading my post
    I am learning more sql and i have a question which is about HR schem.
    how i can show Departments.department_name in the following sql query?
    I want query to show department names along with department IDs.
    SELECT department_id dept_id, job_id, SUM(salary)
    FROM employees
    GROUP BY department_id, job_id ;thanks

    hi
    like this
    SQL> ed
    Wrote file afiedt.buf
      1  select d.department_id dept_id, d.department_name, e.job_id, sum(e.salary)
      2  from employees e, departments d
      3  where e.department_id = d.department_id
      4* group by d.department_id, d.department_name, e.job_id
    SQL> /
       DEPT_ID DEPARTMENT_NAME                JOB_ID     SUM(E.SALARY)
            10 Administration                 AD_ASST             4400
            20 Marketing                      MK_MAN             13000
            20 Marketing                      MK_REP              6000
            30 Purchasing                     PU_MAN             11000
            30 Purchasing                     PU_CLERK           13900
            40 Human Resources                HR_REP              6500
            50 Shipping                       ST_MAN             36400
            50 Shipping                       SH_CLERK           64300
            50 Shipping                       ST_CLERK           55700
            60 IT                             IT_PROG            28800
            70 Public Relations               PR_REP             10000
       DEPT_ID DEPARTMENT_NAME                JOB_ID     SUM(E.SALARY)
            80 Sales                          SA_MAN             61000
            80 Sales                          SA_REP            243500
            90 Executive                      AD_VP              34000
            90 Executive                      AD_PRES            24000
           100 Finance                        FI_MGR             12000
           100 Finance                        FI_ACCOUNT         39600
           110 Accounting                     AC_MGR             12000
           110 Accounting                     AC_ACCOUNT          8300
    19 rows selected.
    SQL>hope this helps
    Taj

  • Help on tuning SQL

    Hi list ,
    I need your help in tuning this sql.
    Oracle 10g,Windows 2008 64 bit running on virtual machine.
    SELECT t0.RecID, t0.PrtID, t0.RecOrdDt, t0.RecOrdID, t0.RecExtOrdID, t0.RecPocID, t0.PriID, t0.CasID, t0.CasNo, t0.CasClass, t0.CasPocID, t0.CasAdmit, t0.CasNotValid, t0.PatName, t0.PatFName, t0.PatBName, t0.PatBDate, t0.PatSex, t0.PatNotValid, t0.RstID, t0.RstState, t0.RstMeaningI18N, t0.PrtType, t0.PrtSubType, t0.RpxType, t0.RpxPrio, t0.PerID, t0.PerName, t0.PerFName, t0.PerTitle, t0.PerType, t0.AgnExtID
    FROM
              IXSERV.XsvRecPerInfoV t0
    WHERE
                   ((((t0.AgnExtID = '1728454694') AND (t0.PrtID IN (72, 165)))
           AND (t0.RpxType IN (1, 2, 6, 3, 5)))
           AND (t0.RstState IN (202, 208, 210, 203, 206)))
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.04       0.03          0       1999          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        4      5.39      57.42      45408      53080          0          45
    total        6      5.43      57.46      45408      55079          0          45
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: SYS
    Rows     Row Source Operation
         45  NESTED LOOPS  (cr=53080 pr=45408 pw=0 time=2611987 us)
         45   NESTED LOOPS  (cr=52941 pr=45355 pw=0 time=46145568 us)
         45    HASH JOIN  (cr=52802 pr=45314 pw=0 time=45407144 us)
          1     TABLE ACCESS BY INDEX ROWID PERPERSON (cr=3 pr=6 pw=0 time=40510 us)
          1      INDEX RANGE SCAN PERIDXAGNEXTID (cr=2 pr=5 pw=0 time=22311 us)(object id 56817)
      23623     TABLE ACCESS BY INDEX ROWID XSVRECPERXREF (cr=52799 pr=45308 pw=0 time=50046345 us)
      33893      NESTED LOOPS  (cr=47543 pr=42261 pw=0 time=73003406 us)
       5139       HASH JOIN  (cr=37184 pr=40103 pw=0 time=56090695 us)
          5        TABLE ACCESS FULL XMFREPORTSTATE (cr=7 pr=6 pw=0 time=22565 us)
      66900        TABLE ACCESS BY INDEX ROWID XSVPATIENTRECORD (cr=37177 pr=40097 pw=0 time=39887547 us)
      66903         NESTED LOOPS  (cr=146 pr=141 pw=0 time=8095232 us)
          2          INLIST ITERATOR  (cr=4 pr=3 pw=0 time=37200 us)
          2           TABLE ACCESS BY INDEX ROWID XMFPATIENTRECORDTYPE (cr=4 pr=3 pw=0 time=37198 us)
          2            INDEX UNIQUE SCAN PKPRT (cr=2 pr=1 pw=0 time=26746 us)(object id 56143)
      66900          INDEX RANGE SCAN RECIDXPRTID (cr=142 pr=138 pw=0 time=51513 us)(object id 56410)
      28753       INDEX RANGE SCAN RPXIDXRECID (cr=10359 pr=2158 pw=0 time=4518986 us)(object id 56453)
         45    TABLE ACCESS BY INDEX ROWID ADTCASE (cr=139 pr=41 pw=0 time=423483 us)
         45     INDEX UNIQUE SCAN PK_ADTCASE (cr=94 pr=23 pw=0 time=184866 us)(object id 55295)
         45   TABLE ACCESS BY INDEX ROWID ADTPATIENT (cr=139 pr=53 pw=0 time=413067 us)
         45    INDEX UNIQUE SCAN PK_ADTPATIENT (cr=94 pr=21 pw=0 time=195583 us)(object id 55361)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    SQL*Net break/reset to client 2 0.00 0.00
    SQL*Net message to client 5 0.00 0.00
    SQL*Net message from client 5 114.42 128.67
    SQL*Net more data to client 1 0.00 0.00
    db file sequential read 27969 0.13 51.57
    db file scattered read 3271 0.05 4.61
    Some lines from trace fils :
    WAIT #1: nam='db file sequential read' ela= 12778 file#=4 block#=3726132 blocks=1 obj#=56817 tim=249799016372
    WAIT #1: nam='db file scattered read' ela= 9271 file#=4 block#=3726133 blocks=4 obj#=56817 tim=249799025761
    WAIT #1: nam='db file sequential read' ela= 18141 file#=4 block#=587487 blocks=1 obj#=55853 tim=249799043945
    WAIT #1: nam='db file sequential read' ela= 18304 file#=4 block#=752595 blocks=1 obj#=56219 tim=249799062471
    and the view   XsvRecPerInfoV   is  :
    SELECT       d.RecID, d.PrtID, d.RecOrdDt, d.RecOrdID, d.RecExtOrdID, d.PocID, d.PriID, c.CasID, c. CasNo, c.CasClass, c.PocID, c.CasAdmit, c.CasNotValid, p.PatName,            p.PatFName, p.PatBName, p.PatBDate, p.PatSex, p.PatNotValid, r.RstID, r.RstState, r.RstMeaningI18N, prt.PrtType, prt.PrtSubType, x.RpxType, x.RpxPrio, per.PerID,        per.PerName, per.PerFName, per.PerTitle, per.PerType, per.AgnExtID
    FROM    XsvPatientRecord d,
                 AdtCase c,
               AdtPatient p,
               XmfReportState r,
               XmfPatientRecordType prt,
               XsvRecPerXRef  x,
               PerPerson per
       WHERE
               d.RecID =  x.RecID  
    AND  d.RstID  =  r.RstID
    AND  d.PrtID    =  prt.PrtID 
    AND   d.CasID  =  c.CasID
    AND  x.PerID = per.PerID
    AND  c.PatID = p.PatID
    i have two questions :
    -1 The problem in tables XSVPATIENTRECORD and XSVRECPERXREF so how can i speed this query either by rewriting it or indexs?
    -2 is my system i-o is slow ?
    Best wishes
    Edited by: welo on Oct 6, 2010 5:05 AM

    hi ,
    it did not work with dynamic samplying. I am posting here trace 10053 output for the correct plan and wrong plan choosed but the optimizer i need soome one to help me in understanding why the optimizer is choosing wrong join order.
    Sql statement and wrong plan :
    tageCurrent SQL statement for this session:
    SELECT    t0.RecID, t0.PrtID, t0.RecOrdDt, t0.RecOrdID, t0.RecExtOrdID, t0.RecPocID, t0.PriID, t0.CasID, t0.CasNo, t0.CasClass, t0.CasPocID, t0.CasAdmit, t0.CasNotValid, t0.PatName, t0.PatFName, t0.PatBName, t0.PatBDate, t0.PatSex, t0.PatNotValid, t0.RstID, t0.RstState, t0.RstMeaningI18N, t0.PrtType, t0.PrtSubType, t0.RpxType, t0.RpxPrio, t0.PerID, t0.PerName, t0.PerFName, t0.PerTitle, t0.PerType, t0.AgnExtID
    FROM XsvRecPerInfoV t0
    WHERE
    ((((t0.AgnExtID = '1393621382') AND (t0.PrtID IN (72, 165))) AND (t0.RpxType IN (1, 2, 6, 3, 5))) AND (t0.RstState IN (202, 208, 210, 203, 206)))
    --------------------------------------------------------------------+-----------------------------------+
    | Id  | Operation                             | Name                | Rows  | Bytes | Cost  | Time      |
    --------------------------------------------------------------------+-----------------------------------+
    | 0   | SELECT STATEMENT                      |                     |       |       |   842 |           |
    | 1   |  NESTED LOOPS                         |                     |     1 |   204 |   842 |  00:00:11 |
    | 2   |   NESTED LOOPS                        |                     |     1 |   163 |   840 |  00:00:11 |
    | 3   |    HASH JOIN                          |                     |     1 |   129 |   838 |  00:00:11 |
    | 4   |     TABLE ACCESS BY INDEX ROWID       | PERPERSON           |     1 |    29 |     2 |  00:00:01 |
    | 5   |      INDEX RANGE SCAN                 | PERIDXAGNEXTID      |     1 |       |     1 |  00:00:01 |
    | 6   |     TABLE ACCESS BY INDEX ROWID       | XSVRECPERXREF       |     2 |    34 |     3 |  00:00:01 |
    | 7   |      NESTED LOOPS                     |                     |   379 |   37K |   835 |  00:00:11 |
    | 8   |       HASH JOIN                       |                     |   238 |   19K |   342 |  00:00:05 |
    | 9   |        TABLE ACCESS FULL              | XMFREPORTSTATE      |     5 |    65 |     3 |  00:00:01 |
    | 10  |        TABLE ACCESS BY INDEX ROWID    | XSVPATIENTRECORD    |   524 |   30K |   218 |  00:00:03 |
    | 11  |         NESTED LOOPS                  |                     |  1049 |   72K |   338 |  00:00:05 |
    | 12  |          INLIST ITERATOR              |                     |       |       |       |           |
    | 13  |           TABLE ACCESS BY INDEX ROWID | XMFPATIENTRECORDTYPE|     2 |    22 |     2 |  00:00:01 |
    | 14  |            INDEX UNIQUE SCAN          | PKPRT               |     2 |       |     1 |  00:00:01 |
    | 15  |          INDEX RANGE SCAN             | RECIDXPRTID         |   524 |       |   119 |  00:00:02 |
    | 16  |       INDEX RANGE SCAN                | RPXIDXRECID         |     2 |       |     2 |  00:00:01 |
    | 17  |    TABLE ACCESS BY INDEX ROWID        | ADTCASE             |     1 |    34 |     2 |  00:00:01 |
    | 18  |     INDEX UNIQUE SCAN                 | PK_ADTCASE          |     1 |       |     1 |  00:00:01 |
    | 19  |   TABLE ACCESS BY INDEX ROWID         | ADTPATIENT          |     1 |    41 |     2 |  00:00:01 |
    | 20  |    INDEX UNIQUE SCAN                  | PK_ADTPATIENT       |     1 |       |     1 |  00:00:01 |
    --------------------------------------------------------------------+-----------------------------------+
    3 - access("PER"."PERID"="X"."PERID")
    5 - access("PER"."AGNEXTID"='1393621382')
    6 - filter(("X"."RPXTYPE"=1 OR "X"."RPXTYPE"=2 OR "X"."RPXTYPE"=3 OR "X"."RPXTYPE"=5 OR "X"."RPXTYPE"=6))
    8 - access("D"."RSTID"="R"."RSTID")
    9 - filter(("R"."RSTSTATE"=202 OR "R"."RSTSTATE"=203 OR "R"."RSTSTATE"=206 OR "R"."RSTSTATE"=208 OR "R"."RSTSTATE"=210))
    14 - access(("PRT"."PRTID"=72 OR "PRT"."PRTID"=165))
    15 - access("D"."PRTID"="PRT"."PRTID")
    15 - filter(("D"."PRTID"=72 OR "D"."PRTID"=165))
    16 - access("X"."RECID"="D"."RECID")
    18 - access("D"."CASID"="C"."CASID")
    20 - access("C"."PATID"="P"."PATID")
    Join order[7]:  XMFPATIENTRECORDTYPE[PRT]#1  XSVPATIENTRECORD[D]#3  XMFREPORTSTATE[R]#2  XSVRECPERXREF[X]#5  PERPERSON[PER]#0  ADTCASE[C]#6  ADTPATIENT[P]#4
    Now joining: XSVPATIENTRECORD[D]#3
    NL Join
      Outer table: Card: 2.00  Cost: 2.00  Resp: 2.00  Degree: 1  Bytes: 11
      Inner table: XSVPATIENTRECORD  Alias: D
      Access Path: TableScan
        NL Join:  Cost: 53601.79  Resp: 53601.79  Degree: 1
          Cost_io: 53336.00  Cost_cpu: 7967475433
          Resp_io: 53336.00  Resp_cpu: 7967475433
    kkofmx: index filter:
    ("D"."PRTID"=72 OR "D"."PRTID"=165) AND ("X"."RPXTYPE"=1 OR "X"."RPXTYPE"=2 OR "X"."RPXTYPE"=3 OR "X"."RPXTYPE"=5 OR "X"."RPXTYPE"=6) AND ("R"."RSTSTATE"=202 OR "R"."RSTSTATE"=203 OR "R"."RSTSTATE"=206 OR "R"."RSTSTATE"=208 OR "R"."RSTSTATE"=210) AND "PER"."PERID"="X"."PERID" AND "X"."RECID"="D"."RECID" AND "D"."RSTID"="R"."RSTID" AND "D"."PRTID"="PRT"."PRTID" AND "D"."CASID"="C"."CASID" AND "C"."PATID"="P"."PATID" AND ("PRT"."PRTID"=72 OR "PRT"."PRTID"=165)
    kkofmx: index filter:"D"."PRTID"="PRT"."PRTID" AND "D"."CASID"="C"."CASID" AND "C"."PATID"="P"."PATID" AND ("PRT"."PRTID"=72 OR "PRT"."PRTID"=165)
    kkofmx: index filter:
    ("D"."PRTID"=72 OR "D"."PRTID"=165) AND ("X"."RPXTYPE"=1 OR "X"."RPXTYPE"=2 OR "X"."RPXTYPE"=3 OR "X"."RPXTYPE"=5 OR "X"."RPXTYPE"=6) AND ("R"."RSTSTATE"=202 OR "R"."RSTSTATE"=203 OR "R"."RSTSTATE"=206 OR "R"."RSTSTATE"=208 OR "R"."RSTSTATE"=210) AND "PER"."PERID"="X"."PERID" AND "X"."RECID"="D"."RECID" AND "D"."RSTID"="R"."RSTID" AND "D"."PRTID"="PRT"."PRTID" AND "D"."CASID"="C"."CASID" AND "C"."PATID"="P"."PATID" AND ("PRT"."PRTID"=72 OR "PRT"."PRTID"=165)
      Access Path: index (FullScan)
        Index: IRECRECORDIDPRTID
        resc_io: 43172.00  resc_cpu: 2118737558
        ix_sel: 1  ix_sel_with_filters: 6.2392e-005
        NL Join: Cost: 86121.14  Resp: 86121.14  Degree: 1
          Cost_io: 85924.00  Cost_cpu: 5909611610
          Resp_io: 85924.00  Resp_cpu: 5909611610
      Access Path: index (AllEqJoinGuess)
        Index: RECIDXPRTID
        resc_io: 217.00  resc_cpu: 13774732
        ix_sel: 0.0074074  ix_sel_with_filters: 6.2392e-005
        NL Join (ordered): Cost: 338.30  Resp: 338.30  Degree: 1
          Cost_io: 337.00  Cost_cpu: 39079056
          Resp_io: 337.00  Resp_cpu: 39079056
      ****** trying bitmap/domain indexes ******
      ****** finished trying bitmap/domain indexes ******
      Best NL cost: 338.30
              resc: 338.30 resc_io: 337.00 resc_cpu: 39079056
              resp: 338.30 resp_io: 337.00 resp_cpu: 39079056
    Join Card:  1048.85 = outer (2.00) * inner (70797.49) * sel (0.0074074)
    Join Card - Rounded: 1049 Computed: 1048.85
    SM Join
      Outer table:
        resc: 2.00  card 2.00  bytes: 11  deg: 1  resp: 2.00
      Inner table: XSVPATIENTRECORD  Alias: D
        resc: 13387.34  card: 70797.49  bytes: 59  deg: 1  resp: 13387.34
        using dmeth: 2  #groups: 1
        SORT resource      Sort statistics
          Sort width:         445 Area size:      390144 Max Area size:    78223360
          Degree:               1
          Blocks to Sort:     651 Row size:           75 Total Rows:          70797
          Initial runs:         2 Merge passes:        1 IO Cost / pass:        354
          Total IO sort cost: 1005      Total CPU sort cost: 97398867
          Total Temp space used: 11969000
      SM join: Resc: 14397.59  Resp: 14397.59  [multiMatchCost=0.00]
      SM cost: 14397.59
         resc: 14397.59 resc_io: 14389.81 resc_cpu: 233098276
         resp: 14397.59 resp_io: 14389.81 resp_cpu: 233098276
    HA Join
      Outer table:
        resc: 2.00  card 2.00  bytes: 11  deg: 1  resp: 2.00
      Inner table: XSVPATIENTRECORD  Alias: D
        resc: 13387.34  card: 70797.49  bytes: 59  deg: 1  resp: 13387.34
        using dmeth: 2  #groups: 1
        Cost per ptn: 0.74  #ptns: 1
        hash_area: 124 (max=19098) buildfrag: 1  probefrag: 614  ppasses: 1
      Hash join: Resc: 13390.08  Resp: 13390.08  [multiMatchCost=0.00]
      HA cost: 13390.08
         resc: 13390.08 resc_io: 13384.81 resc_cpu: 157767585
         resp: 13390.08 resp_io: 13384.81 resp_cpu: 157767585
    Best:: JoinMethod: NestedLoop
           Cost: 338.30  Degree: 1  Resp: 338.30  Card: 1048.85  Bytes: 70
    Now joining: XMFREPORTSTATE[R]#2
    NL Join
      Outer table: Card: 1048.85  Cost: 338.30  Resp: 338.30  Degree: 1  Bytes: 70
      Inner table: XMFREPORTSTATE  Alias: R
      Access Path: TableScan
        NL Join:  Cost: 1489.04  Resp: 1489.04  Degree: 1
          Cost_io: 1486.00  Cost_cpu: 91090703
          Resp_io: 1486.00  Resp_cpu: 91090703
      Access Path: index (UniqueScan)
        Index: PK_XMFREPORTSTATE
        resc_io: 1.00  resc_cpu: 8697
        ix_sel: 0.030303  ix_sel_with_filters: 0.030303
        NL Join: Cost: 1387.61  Resp: 1387.61  Degree: 1
          Cost_io: 1386.00  Cost_cpu: 48201937
          Resp_io: 1386.00  Resp_cpu: 48201937
      Access Path: index (AllEqUnique)
        Index: PK_XMFREPORTSTATE
        resc_io: 1.00  resc_cpu: 8697
        ix_sel: 0.030303  ix_sel_with_filters: 0.030303
        NL Join: Cost: 1387.61  Resp: 1387.61  Degree: 1
          Cost_io: 1386.00  Cost_cpu: 48201937
          Resp_io: 1386.00  Resp_cpu: 48201937
      ****** trying bitmap/domain indexes ******
      ****** finished trying bitmap/domain indexes ******
      Best NL cost: 1387.61
              resc: 1387.61 resc_io: 1386.00 resc_cpu: 48201937
              resp: 1387.61 resp_io: 1386.00 resp_cpu: 48201937
    Join Card:  238.38 = outer (1048.85) * inner (5.00) * sel (0.045455)
    Join Card - Rounded: 238 Computed: 238.38
    SM Join
      Outer table:
        resc: 338.30  card 1048.85  bytes: 70  deg: 1  resp: 338.30
      Inner table: XMFREPORTSTATE  Alias: R
        resc: 3.00  card: 5.00  bytes: 13  deg: 1  resp: 3.00
        using dmeth: 2  #groups: 1
        SORT resource      Sort statistics
          Sort width:         445 Area size:      390144 Max Area size:    78223360
          Degree:               1
          Blocks to Sort:      12 Row size:           87 Total Rows:           1049
          Initial runs:         1 Merge passes:        0 IO Cost / pass:          0
          Total IO sort cost: 0      Total CPU sort cost: 30450620
          Total Temp space used: 0
        SORT resource      Sort statistics
          Sort width:         445 Area size:      390144 Max Area size:    78223360
          Degree:               1
          Blocks to Sort:       1 Row size:           25 Total Rows:              5
          Initial runs:         1 Merge passes:        0 IO Cost / pass:          0
          Total IO sort cost: 0      Total CPU sort cost: 29976876
          Total Temp space used: 0
      SM join: Resc: 343.32  Resp: 343.32  [multiMatchCost=0.00]
      SM cost: 343.32
         resc: 343.32 resc_io: 340.00 resc_cpu: 99556133
         resp: 343.32 resp_io: 340.00 resp_cpu: 99556133
    HA Join
      Outer table:
        resc: 338.30  card 1048.85  bytes: 70  deg: 1  resp: 338.30
      Inner table: XMFREPORTSTATE  Alias: R
        resc: 3.00  card: 5.00  bytes: 13  deg: 1  resp: 3.00
        using dmeth: 2  #groups: 1
        Cost per ptn: 0.51  #ptns: 1
        hash_area: 124 (max=19098) buildfrag: 11  probefrag: 1  ppasses: 1
      Hash join: Resc: 341.81  Resp: 341.81  [multiMatchCost=0.00]
    HA Join (swap)
      Outer table:
        resc: 3.00  card 5.00  bytes: 13  deg: 1  resp: 3.00
      Inner table: XSVPATIENTRECORD  Alias: D
        resc: 338.30  card: 1048.85  bytes: 70  deg: 1  resp: 338.30
        using dmeth: 2  #groups: 1
        Cost per ptn: 0.50  #ptns: 1
        hash_area: 124 (max=19098) buildfrag: 1  probefrag: 11  ppasses: 1
      Hash join: Resc: 341.81  Resp: 341.81  [multiMatchCost=0.00]
      HA cost: 341.81
         resc: 341.81 resc_io: 340.00 resc_cpu: 54222464
         resp: 341.81 resp_io: 340.00 resp_cpu: 54222464
    Best:: JoinMethod: Hash
           Cost: 341.81  Degree: 1  Resp: 341.81  Card: 238.38  Bytes: 83
    Now joining: XSVRECPERXREF[X]#5
    NL Join
      Outer table: Card: 238.38  Cost: 341.81  Resp: 341.81  Degree: 1  Bytes: 83
      Inner table: XSVRECPERXREF  Alias: X
      Access Path: TableScan
        NL Join:  Cost: 280914.52  Resp: 280914.52  Degree: 1
          Cost_io: 275752.00  Cost_cpu: 154753663635
          Resp_io: 275752.00  Resp_cpu: 154753663635
    kkofmx: index filter:
    ("X"."RPXTYPE"=1 OR "X"."RPXTYPE"=2 OR "X"."RPXTYPE"=3 OR "X"."RPXTYPE"=5 OR "X"."RPXTYPE"=6) AND ("R"."RSTSTATE"=202 OR "R"."RSTSTATE"=203 OR "R"."RSTSTATE"=206 OR "R"."RSTSTATE"=208 OR "R"."RSTSTATE"=210) AND "PER"."PERID"="X"."PERID" AND "X"."RECID"="D"."RECID" AND "D"."RSTID"="R"."RSTID" AND "D"."PRTID"="PRT"."PRTID" AND "D"."CASID"="C"."CASID" AND "C"."PATID"="P"."PATID" AND ("PRT"."PRTID"=72 OR "PRT"."PRTID"=165)
      Access Path: index (AllEqJoinGuess)
        Index: RPXIDXRECID
        resc_io: 3.00  resc_cpu: 23984
        ix_sel: 1.6577e-006  ix_sel_with_filters: 1.6577e-006
        NL Join: Cost: 835.02  Resp: 835.02  Degree: 1
          Cost_io: 833.08  Cost_cpu: 58098995
          Resp_io: 833.08  Resp_cpu: 58098995
      Access Path: index (RangeScan)
        Index: URPXRECPERTYPE
        resc_io: 3.00  resc_cpu: 23274
        ix_sel: 1.6577e-006  ix_sel_with_filters: 9.4822e-007
        NL Join: Cost: 835.02  Resp: 835.02  Degree: 1
          Cost_io: 833.08  Cost_cpu: 58181005
          Resp_io: 833.08  Resp_cpu: 58181005
      ****** trying bitmap/domain indexes ******
      ****** finished trying bitmap/domain indexes ******
      Best NL cost: 835.02
              resc: 835.02 resc_io: 833.08 resc_cpu: 58098995
              resp: 835.02 resp_io: 833.08 resp_cpu: 58098995
    Join Card:  378.67 = outer (238.38) * inner (835508.80) * sel (1.9013e-006)
    Join Card - Rounded: 379 Computed: 378.67
    SM Join
      Outer table:
        resc: 341.81  card 238.38  bytes: 83  deg: 1  resp: 341.81
      Inner table: XSVRECPERXREF  Alias: X
        resc: 1180.68  card: 835508.80  bytes: 17  deg: 1  resp: 1180.68
        using dmeth: 2  #groups: 1
        SORT resource      Sort statistics
          Sort width:         445 Area size:      390144 Max Area size:    78223360
          Degree:               1
          Blocks to Sort:       3 Row size:          102 Total Rows:            238
          Initial runs:         1 Merge passes:        0 IO Cost / pass:          0
          Total IO sort cost: 0      Total CPU sort cost: 30061009
          Total Temp space used: 0
        SORT resource      Sort statistics
          Sort width:         445 Area size:      390144 Max Area size:    78223360
          Degree:               1
          Blocks to Sort:    2967 Row size:           29 Total Rows:         835509
          Initial runs:         2 Merge passes:        1 IO Cost / pass:       1608
          Total IO sort cost: 4575      Total CPU sort cost: 843575684
          Total Temp space used: 53699000
      SM join: Resc: 6126.64  Resp: 6126.64  [multiMatchCost=0.00]
      SM cost: 6126.64
         resc: 6126.64 resc_io: 6074.00 resc_cpu: 1577856809
         resp: 6126.64 resp_io: 6074.00 resp_cpu: 1577856809
    HA Join
      Outer table:
        resc: 341.81  card 238.38  bytes: 83  deg: 1  resp: 341.81
      Inner table: XSVRECPERXREF  Alias: X
        resc: 1180.68  card: 835508.80  bytes: 17  deg: 1  resp: 1180.68
        using dmeth: 2  #groups: 1
        Cost per ptn: 3.29  #ptns: 1
        hash_area: 124 (max=19098) buildfrag: 3  probefrag: 2958  ppasses: 1
      Hash join: Resc: 1525.78  Resp: 1525.78  [multiMatchCost=0.00]
      HA cost: 1525.78
         resc: 1525.78 resc_io: 1499.00 resc_cpu: 802794893
         resp: 1525.78 resp_io: 1499.00 resp_cpu: 802794893
    Best:: JoinMethod: NestedLoop
           Cost: 835.02  Degree: 1  Resp: 835.02  Card: 378.67  Bytes: 100
    Now joining: PERPERSON[PER]#0
    NL Join
      Outer table: Card: 378.67  Cost: 835.02  Resp: 835.02  Degree: 1  Bytes: 100
      Inner table: PERPERSON  Alias: PER
      Access Path: TableScan
        NL Join:  Cost: 409701.78  Resp: 409701.78  Degree: 1
          Cost_io: 408070.08  Cost_cpu: 48912477468
          Resp_io: 408070.08  Resp_cpu: 48912477468
      Access Path: index (UniqueScan)
        Index: PKPER
        resc_io: 2.00  resc_cpu: 16603
        ix_sel: 2.7682e-006  ix_sel_with_filters: 2.7682e-006
        NL Join: Cost: 1593.23  Resp: 1593.23  Degree: 1
          Cost_io: 1591.08  Cost_cpu: 64391486
          Resp_io: 1591.08  Resp_cpu: 64391486
      Access Path: index (AllEqJoin)
        Index: PERIDXAGNEXTID
        resc_io: 2.00  resc_cpu: 15703
        ix_sel: 0.001065  ix_sel_with_filters: 0.001065
        NL Join: Cost: 1593.22  Resp: 1593.22  Degree: 1
          Cost_io: 1591.08  Cost_cpu: 64050386
          Resp_io: 1591.08  Resp_cpu: 64050386
      Access Path: index (AllEqUnique)
        Index: PKPER
        resc_io: 2.00  resc_cpu: 16603
        ix_sel: 2.7682e-006  ix_sel_with_filters: 2.7682e-006
        NL Join: Cost: 1593.23  Resp: 1593.23  Degree: 1
          Cost_io: 1591.08  Cost_cpu: 64391486
          Resp_io: 1591.08  Resp_cpu: 64391486
      ****** trying bitmap/domain indexes ******
      Access Path: index (AllEqJoin)
        Index: PERIDXAGNEXTID
        resc_io: 1.00  resc_cpu: 8171
        ix_sel: 0.001065  ix_sel_with_filters: 0.001065
        NL Join: Cost: 1214.12  Resp: 1214.12  Degree: 1
          Cost_io: 1212.08  Cost_cpu: 61195971
          Resp_io: 1212.08  Resp_cpu: 61195971
      Access Path: index (AllEqUnique)
        Index: PKPER
        resc_io: 1.00  resc_cpu: 9021
        ix_sel: 2.7682e-006  ix_sel_with_filters: 2.7682e-006
        NL Join: Cost: 1214.13  Resp: 1214.13  Degree: 1
          Cost_io: 1212.08  Cost_cpu: 61518121
          Resp_io: 1212.08  Resp_cpu: 61518121
      Access path: Bitmap index - rejected
        Cost: 3293.30 Cost_io: 3287.25 Cost_cpu: 181295210 Sel: 9.5086e-007
        Not believed to be index-only
      ****** finished trying bitmap/domain indexes ******
      Best NL cost: 1593.22
              resc: 1593.22 resc_io: 1591.08 resc_cpu: 64050386
              resp: 1593.22 resp_io: 1591.08 resp_cpu: 64050386
    Join Card:  0.34 = outer (378.67) * inner (1.00) * sel (8.9286e-004)
    Join Card - Rounded: 1 Computed: 0.34
    SM Join
      Outer table:
        resc: 835.02  card 378.67  bytes: 100  deg: 1  resp: 835.02
      Inner table: PERPERSON  Alias: PER
        resc: 2.00  card: 1.00  bytes: 29  deg: 1  resp: 2.00
        using dmeth: 2  #groups: 1
        SORT resource      Sort statistics
          Sort width:         445 Area size:      390144 Max Area size:    78223360
          Degree:               1
          Blocks to Sort:       6 Row size:          120 Total Rows:            379
          Initial runs:         1 Merge passes:        0 IO Cost / pass:          0
          Total IO sort cost: 0      Total CPU sort cost: 30122624
          Total Temp space used: 0
        SORT resource      Sort statistics
          Sort width:         445 Area size:      390144 Max Area size:    78223360
          Degree:               1
          Blocks to Sort:       1 Row size:           42 Total Rows:              1
          Initial runs:         1 Merge passes:        0 IO Cost / pass:          0
          Total IO sort cost: 0      Total CPU sort cost: 29976353
          Total Temp space used: 0
      SM join: Resc: 839.02  Resp: 839.02  [multiMatchCost=0.00]
      SM cost: 839.02
         resc: 839.02 resc_io: 835.08 resc_cpu: 118213674
         resp: 839.02 resp_io: 835.08 resp_cpu: 118213674
    HA Join
      Outer table:
        resc: 835.02  card 378.67  bytes: 100  deg: 1  resp: 835.02
      Inner table: PERPERSON  Alias: PER
        resc: 2.00  card: 1.00  bytes: 29  deg: 1  resp: 2.00
        using dmeth: 2  #groups: 1
        Cost per ptn: 0.50  #ptns: 1
        hash_area: 124 (max=19098) buildfrag: 6  probefrag: 1  ppasses: 1
      Hash join: Resc: 837.52  Resp: 837.52  [multiMatchCost=0.00]
    HA Join (swap)
      Outer table:
        resc: 2.00  card 1.00  bytes: 29  deg: 1  resp: 2.00
      Inner table: XSVRECPERXREF  Alias: X
        resc: 835.02  card: 378.67  bytes: 100  deg: 1  resp: 835.02
        using dmeth: 2  #groups: 1
        Cost per ptn: 0.50  #ptns: 1
        hash_area: 124 (max=19098) buildfrag: 1  probefrag: 6  ppasses: 1
      Hash join: Resc: 837.52  Resp: 837.52  [multiMatchCost=0.00]
      HA cost: 837.52
         resc: 837.52 resc_io: 835.08 resc_cpu: 73140924
         resp: 837.52 resp_io: 835.08 resp_cpu: 73140924
    Best:: JoinMethod: Hash
           Cost: 837.52  Degree: 1  Resp: 837.52  Card: 0.34  Bytes: 129
    Now joining: ADTCASE[C]#6
    NL Join
      Outer table: Card: 0.34  Cost: 837.52  Resp: 837.52  Degree: 1  Bytes: 129
      Inner table: ADTCASE  Alias: C
      Access Path: TableScan
        NL Join:  Cost: 6458.89  Resp: 6458.89  Degree: 1
          Cost_io: 6414.08  Cost_cpu: 1343349671
          Resp_io: 6414.08  Resp_cpu: 1343349671
      Access Path: index (UniqueScan)
        Index: PK_ADTCASE
        resc_io: 2.00  resc_cpu: 16573
        ix_sel: 3.9499e-007  ix_sel_with_filters: 3.9499e-007
        NL Join: Cost: 839.52  Resp: 839.52  Degree: 1
          Cost_io: 837.08  Cost_cpu: 73157497
          Resp_io: 837.08  Resp_cpu: 73157497
      Access Path: index (AllEqUnique)
        Index: PK_ADTCASE
        resc_io: 2.00  resc_cpu: 16573
        ix_sel: 3.9478e-007  ix_sel_with_filters: 3.9478e-007
        NL Join: Cost: 839.52  Resp: 839.52  Degree: 1
          Cost_io: 837.08  Cost_cpu: 73157497
          Resp_io: 837.08  Resp_cpu: 73157497
      ****** trying bitmap/domain indexes ******
      ****** finished trying bitmap/domain indexes ******
      Best NL cost: 839.52
              resc: 839.52 resc_io: 837.08 resc_cpu: 73157497
              resp: 839.52 resp_io: 837.08 resp_cpu: 73157497
    Join Card:  0.34 = outer (0.34) * inner (2531689.00) * sel (3.9478e-007)
    Join Card - Rounded: 1 Computed: 0.34
    SM Join
      Outer table:
        resc: 837.52  card 0.34  bytes: 129  deg: 1  resp: 837.52
      Inner table: ADTCASE  Alias: C
        resc: 5621.37  card: 2531689.00  bytes: 34  deg: 1  resp: 5621.37
        using dmeth: 2  #groups: 1
        SORT resource      Sort statistics
          Sort width:         445 Area size:      390144 Max Area size:    78223360
          Degree:               1
          Blocks to Sort:       1 Row size:          152 Total Rows:              1
          Initial runs:         1 Merge passes:        0 IO Cost / pass:          0
          Total IO sort cost: 0      Total CPU sort cost: 29976353
          Total Temp space used: 0
        SORT resource      Sort statistics
          Sort width:         445 Area size:      390144 Max Area size:    78223360
          Degree:               1
          Blocks to Sort:   14878 Row size:           48 Total Rows:        2531689
          Initial runs:         2 Merge passes:        1 IO Cost / pass:       8060
          Total IO sort cost: 22938      Total CPU sort cost: 2822696818
          Total Temp space used: 264217000
      SM join: Resc: 29492.06  Resp: 29492.06  [multiMatchCost=0.00]
      SM cost: 29492.06
         resc: 29492.06 resc_io: 29352.08 resc_cpu: 4196022842
         resp: 29492.06 resp_io: 29352.08 resp_cpu: 4196022842
    HA Join
      Outer table:
        resc: 837.52  card 0.34  bytes: 129  deg: 1  resp: 837.52
      Inner table: ADTCASE  Alias: C
        resc: 5621.37  card: 2531689.00  bytes: 34  deg: 1  resp: 5621.37
        using dmeth: 2  #groups: 1
        Cost per ptn: 8.95  #ptns: 1
        hash_area: 124 (max=19098) buildfrag: 1  probefrag: 14217  ppasses: 1
      Hash join: Resc: 6467.84  Resp: 6467.84  [multiMatchCost=0.00]
      HA cost: 6467.84
         resc: 6467.84 resc_io: 6414.08 resc_cpu: 1611506897
         resp: 6467.84 resp_io: 6414.08 resp_cpu: 1611506897
    Best:: JoinMethod: NestedLoop
           Cost: 839.52  Degree: 1  Resp: 839.52  Card: 0.34  Bytes: 163
    Now joining: ADTPATIENT[P]#4
    NL Join
      Outer table: Card: 0.34  Cost: 839.52  Resp: 839.52  Degree: 1  Bytes: 163
      Inner table: ADTPATIENT  Alias: P
      Access Path: TableScan
        NL Join:  Cost: 2172.07  Resp: 2172.07  Degree: 1
          Cost_io: 2161.08  Cost_cpu: 329395913
          Resp_io: 2161.08  Resp_cpu: 329395913
      Access Path: index (UniqueScan)
        Index: PK_ADTPATIENT
        resc_io: 2.00  resc_cpu: 16533
        ix_sel: 1.8294e-006  ix_sel_with_filters: 1.8294e-006
        NL Join: Cost: 841.52  Resp: 841.52  Degree: 1
          Cost_io: 839.08  Cost_cpu: 73174030
          Resp_io: 839.08  Resp_cpu: 73174030
      Access Path: index (AllEqUnique)
        Index: PK_ADTPATIENT
        resc_io: 2.00  resc_cpu: 16533
        ix_sel: 1.8294e-006  ix_sel_with_filters: 1.8294e-006
        NL Join: Cost: 841.52  Resp: 841.52  Degree: 1
          Cost_io: 839.08  Cost_cpu: 73174030
          Resp_io: 839.08  Resp_cpu: 73174030
      ****** trying bitmap/domain indexes ******
      ****** finished trying bitmap/domain indexes ******
      Best NL cost: 841.52
              resc: 841.52 resc_io: 839.08 resc_cpu: 73174030
              resp: 841.52 resp_io: 839.08 resp_cpu: 73174030
    Join Card:  0.34 = outer (0.34) * inner (546621.00) * sel (1.8294e-006)
    Join Card - Rounded: 1 Computed: 0.34
    SM Join
      Outer table:
        resc: 839.52  card 0.34  bytes: 163  deg: 1  resp: 839.52
      Inner table: ADTPATIENT  Alias: P
        resc: 1332.55  card: 546621.00  bytes: 41  deg: 1  resp: 1332.55
        using dmeth: 2  #groups: 1
        SORT resource      Sort statistics
          Sort width:         445 Area size:      390144 Max Area size:    78223360
          Degree:               1
          Blocks to Sort:       1 Row size:          190 Total Rows:              1
          Initial runs:         1 Merge passes:        0 IO Cost / pass:          0
          Total IO sort cost: 0      Total CPU sort cost: 29976353
          Total Temp space used: 0
        SORT resource      Sort statistics
          Sort width:         445 Area size:      390144 Max Area size:    78223360
          Degree:               1
          Blocks to Sort:    3748 Row size:           56 Total Rows:         546621
          Initial runs:         2 Merge passes:        1 IO Cost / pass:       2032
          Total IO sort cost: 5780      Total CPU sort cost: 591684408
          Total Temp space used: 65872000
      SM join: Resc: 7972.81  Resp: 7972.81  [multiMatchCost=0.00]
      SM cost: 7972.81
         resc: 7972.81 resc_io: 7941.08 resc_cpu: 951056673
         resp: 7972.81 resp_io: 7941.08 resp_cpu: 951056673
    HA Join
      Outer table:
        resc: 839.52  card 0.34  bytes: 163  deg: 1  resp: 839.52
      Inner table: ADTPATIENT  Alias: P
        resc: 1332.55  card: 546621.00  bytes: 41  deg: 1  resp: 1332.55
        using dmeth: 2  #groups: 1
        Cost per ptn: 2.32  #ptns: 1
        hash_area: 124 (max=19098) buildfrag: 1  probefrag: 3537  ppasses: 1
      Hash join: Resc: 2174.39  Resp: 2174.39  [multiMatchCost=0.00]
      HA cost: 2174.39
         resc: 2174.39 resc_io: 2161.08 resc_cpu: 399046339
         resp: 2174.39 resp_io: 2161.08 resp_cpu: 399046339
    Plan cardinality mismatch: best card= 0.33796097408   curr card= 0.33791727990
    Best:: JoinMethod: NestedLoop
           Cost: 841.52  Degree: 1  Resp: 841.52  Card: 0.34  Bytes: 204
    Best so far: Table#: 1  cost: 2.0007  card: 2.0000  bytes: 22
                 Table#: 3  cost: 338.3037  card: 1048.8517  bytes: 73430
                 Table#: 2  cost: 341.8088  card: 238.3754  bytes: 19754
                 Table#: 5  cost: 835.0191  card: 378.6697  bytes: 37900
                 Table#: 0  cost: 837.5209  card: 0.3381  bytes: 129
                 Table#: 6  cost: 839.5214  card: 0.3379  bytes: 163
                 Table#: 4  cost: 841.5220  card: 0.3379  bytes: 204
    tage

  • Need a help in SQL query

    Hi,
    I need a help in writing an SQL query . I am actually confused how to write a query. Below is the scenario.
    CREATE TABLE demand_tmp
    ( item_id  NUMBER,
      org_id   NUMBER,
      order_line_id NUMBER,
      quantity NUMBER,
      order_type NUMBER
    CREATE TABLE order_tmp
    ( item_id  NUMBER,
       org_id   NUMBER,
       order_line_id NUMBER,
       open_flag  VARCHAR2(10)
    INSERT INTO demand_tmp
    SELECT 12438,82,821,100,30 FROM dual;
    INSERT INTO demand_tmp
    SELECT 12438,82,849,350,30 FROM dual;
    INSERT INTO demand_tmp
    SELECT 12438,82,NULL,150,29 FROM dual;
    INSERT INTO demand_tmp
    SELECT 12438,82,0,50,-1 FROM dual;
    INSERT INTO order_tmp
    SELECT 12438,82,821,'Y' FROM dual;
    INSERT INTO order_tmp
    SELECT 12438,82,849,'N' FROM dual;
    Demand_tmp:
    Item_id        org_id   order_line_id       quantity       order_type     
    12438     82                 821                 100       30     
    12438     82                 849                 350       30     
    12438     82              NULL                 150       29     
    12438     82                    0                  50       -1     
    Order_tmp :
    Item_id        org_id        order_line_id      open_flag     
    12438     82                  821                Y     
    12438     82                  849                N     I need to fetch the records from demand_tmp table whose order_line_id is present in order_tmp and having open_flag as 'Y' or if order_type in demand_tmp table is 29.
    The below query will give the records whose order line id is present in order_tmp. But, If i need records which are having order_type=29 the below query wont return any records as order_line_id is NULL. If I place outer join I will get other records also (In this example order_type -1 records) . Please help me how can we write a query for this. Expected o/p is below.
    Query :
    Select item_id,org_id,order_line_id,quantity,order_type,open_flag
    from demand_tmp dt , order_tmp ot
    where dt.order_line_id = ot.order_line_id
    AND dt.item_id=ot.item_id
    AND dt.org_id = ot.org_id
    AND ot.open_flag = 'Y';
    Expected Output :                         
    item_id     org_id     order_line_id     quantity     order_type   open_flag
    12438     82                 821               100                    30             Y
    12438     82              NULL               150                29         NULL Thanks in advance,
    Rakesh
    Edited by: Venkat Rakesh on Oct 7, 2012 6:32 PM
    Edited by: Venkat Rakesh on Oct 7, 2012 8:39 PM

    Hi Rakesh,
    the query is not working as you would like ( but IS working as expected ) since your trying to compare null to another value.
    Comparing null always results in FALSE, also if you compare null to null. This is because null means undefined.
    select 1 from dual where null=null results in no data found.
    I would suggest using a non natural key to join the tables.
    For example include a column ID in the master table which is filled with a sequence and include that field as a foreign key in the detail table.
    This way you can easily join master and detail on ID = ID, and you don't have to worry about null values in this column since it's always filled with data.
    Regards,
    Bas
    btw, using the INNER JOIN and OUTER JOIN syntax in your SQL makes it better readable, since you're separating join conditions from the where clause, just a tip ;)

  • Plz help me to understand sql trace

    Hi,
    i need your help to understand the sql trace and where exactly i should concentrate,
    i am also going through docs,
    your help is appreciated,
    select count(rep)
    from
    (select /*+ leading(v1 v2) use_nl_with_index(v2) */ count(v1.val) rep from
      (select rn, val from (select rownum rn, val from (select /*+ no_merge
      no_parallel(t) no_parallel_index(t) dbms_stats cursor_sharing_exact
      use_weak_name_resl dynamic_sampling(0) no_monitoring */"FFPR_FFAMS_ID" val
      from sys.ora_temp_1_ds_108308 t where "FFPR_FFAMS_ID" is not null group by
      "FFPR_FFAMS_ID" having count("FFPR_FFAMS_ID") = 1)) where ora_hash(rn) <=
      273538662) v1, (select /*+ index(t2) */ "FFPR_FFAMS_ID" val from
      "DM_FM_REPORTING_OWNER"."FM_FP_PLAN_RESULTS" t2) v2 where v2.val = v1.val
      group by v1.val having count(v1.val) <= 2)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.00       0.29          0       8131          0           1
    total        3      0.00       0.30          0       8131          0           1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 213     (recursive depth: 1)
    select /*+ no_parallel_index(t,"FFPR_FFAMS_FK_I") dbms_stats
      cursor_sharing_exact use_weak_name_resl dynamic_sampling(0) no_monitoring
      no_expand index(t,"FFPR_FFAMS_FK_I") */ count(*) as nrw,count(distinct
      sys_op_lbid(692895,'L',t.rowid)) as nlb,count(distinct "FFPR_FFAMS_ID") as
      ndk,sys_op_countchg(substrb(t.rowid,1,15),1) as clf
    from
    "DM_FM_REPORTING_OWNER"."FM_FP_PLAN_RESULTS" t where ("FFPR_FFAMS_ID" is not
      null) and (TBL$OR$IDX$PART$NUM("DM_FM_REPORTING_OWNER"."FM_FP_PLAN_RESULTS",
      0,4,0,"ROWID") = :objn)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.00       2.56          0        425          0           1
    total        3      0.00       2.56          0        425          0           1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 213     (recursive depth: 1)
    select /*+ no_parallel_index(t,"FFPR_FFAMS_FK_I") dbms_stats
      cursor_sharing_exact use_weak_name_resl dynamic_sampling(0) no_monitoring
      no_expand index(t,"FFPR_FFAMS_FK_I") */ count(*) as nrw,count(distinct
      sys_op_lbid(692895,'L',t.rowid)) as nlb,count(distinct "FFPR_FFAMS_ID") as
      ndk,sys_op_countchg(substrb(t.rowid,1,15),1) as clf
    from
    "DM_FM_REPORTING_OWNER"."FM_FP_PLAN_RESULTS" t where "FFPR_FFAMS_ID" is not
      null
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.00       2.56          0        427          0           1
    total        3      0.00       2.56          0        427          0           1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 213     (recursive depth: 1)
    select /*+ no_parallel_index(t,"FFPR_PK_I") dbms_stats cursor_sharing_exact
      use_weak_name_resl dynamic_sampling(0) no_monitoring no_expand index(t,
      "FFPR_PK_I") */ count(*) as nrw,count(distinct sys_op_lbid(692907,'L',
      t.rowid)) as nlb,null as ndk,sys_op_countchg(substrb(t.rowid,1,15),1) as
      clf
    from
    "DM_FM_REPORTING_OWNER"."FM_FP_PLAN_RESULTS" t where ("FFPR_ID" is not null
      or "FFPR_PLAN_NAME" is not null) and
      (TBL$OR$IDX$PART$NUM("DM_FM_REPORTING_OWNER"."FM_FP_PLAN_RESULTS",0,4,0,
      "ROWID") = :objn)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.00       1.51        847        857          0           1
    total        3      0.00       1.52        847        857          0           1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 213     (recursive depth: 1)
    select /*+ no_parallel_index(t,"FFPR_PK_I") dbms_stats cursor_sharing_exact
      use_weak_name_resl dynamic_sampling(0) no_monitoring no_expand index(t,
      "FFPR_PK_I") */ count(*) as nrw,count(distinct sys_op_lbid(692907,'L',
      t.rowid)) as nlb,null as ndk,sys_op_countchg(substrb(t.rowid,1,15),1) as
      clf
    from
    "DM_FM_REPORTING_OWNER"."FM_FP_PLAN_RESULTS" t where "FFPR_ID" is not null
      or "FFPR_PLAN_NAME" is not null
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.00       1.26          0        850          0           1
    total        3      0.00       1.27          0        850          0           1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 213     (recursive depth: 1)
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse       13      0.00       0.03          0          0          0           0
    Execute     13      0.00       1.32         43        242         29           9
    Fetch        4      0.00       0.00          0          0          0           4
    total       30      0.00       1.36         43        242         29          13
    Misses in library cache during parse: 4
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse     2945      0.00       1.04          0          0          0           0
    Execute   3741      0.00       5.49       3137      12995       7050      203362
    Fetch     3088      0.00      38.42       3344      39486         27        9811
    total     9774      0.00      44.96       6481      52481       7077      213173
    Misses in library cache during parse: 284
    Misses in library cache during execute: 160
      144  user  SQL statements in session.
    2814  internal SQL statements in session.
    2958  SQL statements in session.Regards
    nic

    Hi,
    i did the homework, but some how i dont seem to understand what oracle is doing behind
    esp with hints like
    select /*+ leading(v1 v2) use_nl_with_index(v2) */ count(v1.val)
    /*+ no_parallel(t) no_parallel_index(t) dbms_stats
      cursor_sharing_exact use_weak_name_resl dynamic_sampling(0) no_monitoring
    substrb(dump(min("XXX"),16,0,32),1,120),
      substrb(dump(max("XXX"),16,0,32),1,120),i havent used this things any where in my program, but still they are used,
    so i got confused, can you throw some light on this issue,
    regards
    nic

  • Need help in rewriting a sql query

    Can any one please tell me if there is any utility that can help me correcting the sql I have I need to tune the query as its taking lot of time. I want to use some tool that will help me re-formating the query.
    Any help in this regard will be highly appreciated.

    If you think that Oracle SQL Tuning Tools like SQL Tuning Advisor and SQL Access Advisor are not helping.
    You might look into thrid party tools like Quest- SQL Navigator and TOAD.
    But I don't advise this based on the following:
    Re: Oracle Third Party Tools and Oracle Database
    Oracle have enough tools of its own to satisfy the various needs.
    Adith

  • Need help in tuning a procedure

    DECLARE
    CURSOR Cur_sub_rp IS
    SELECT A.SUB_ACCOUNT, B.PH_basic_srv,B.PH_Salesman,A.SUB_SSN
    FROM STG_SUB_MASTER_MONTH_HISTORY A, STG_PHN_MASTER_MONTH_HISTORY
    B
    WHERE A.SUB_ACCOUNT = B.PH_ACCOUNT (+)
    AND A.MONTH_ID = B.MONTH_ID ;
    TYPE t_values_tab IS TABLE OF cur_sub_rp%rowtype ;
    values_tab t_values_tab := t_values_tab() ;
    BEGIN
    OPEN Cur_sub_rp ;
    LOOP
    FETCH Cur_sub_rp BULK COLLECT INTO Values_tab
    LIMIT 1000;
    EXIT WHEN Cur_sub_rp%NOTFOUND ;
    END LOOP ;
    CLOSE Cur_sub_rp;
    FORALL i IN VALUES_TAB.first..values_tab.last
    INSERT INTO SUB_PHN_1 VALUES VALUES_TAB(i);
    commit;
    END;
    The tables used here has 9 million records each.
    The total process takes around 19 minutes.
    Need your help in optimizing the process.

    i have tried using
    Create table as SELECT A.SUB_ACCOUNT,  B.PH_basic_srv,B.PH_Salesman,A.SUB_SSN
                        FROM STG_SUB_MASTER_MONTH_HISTORY A, STG_PHN_MASTER_MONTH_HISTORY
    B
                        WHERE A.SUB_ACCOUNT = B.PH_ACCOUNT (+)
                        AND A.MONTH_ID = B.MONTH_ID (+);But still taking long time(apprx 15 min).
    so used this...
    help me in tuning the query in either of this.
    DECLARE
    CURSOR Cur_sub_rp IS
                    SELECT A.SUB_ACCOUNT,  B.PH_basic_srv,B.PH_Salesman,A.SUB_SSN
                        FROM STG_SUB_MASTER_MONTH_HISTORY A, STG_PHN_MASTER_MONTH_HISTORY
    B
                        WHERE A.SUB_ACCOUNT = B.PH_ACCOUNT (+)
                        AND A.MONTH_ID = B.MONTH_ID (+);
    TYPE t_values_tab IS TABLE OF cur_sub_rp%rowtype ;
    values_tab t_values_tab := t_values_tab()  ;
    BEGIN
        OPEN Cur_sub_rp ;
        LOOP
            FETCH Cur_sub_rp BULK COLLECT INTO Values_tab
                                                LIMIT 1000;
            EXIT WHEN Cur_sub_rp%NOTFOUND ;
        END LOOP ;
        CLOSE Cur_sub_rp;
    FORALL i IN VALUES_TAB.first..values_tab.last
    INSERT INTO SUB_PHN_1 VALUES VALUES_TAB(i);
    commit;
    END;Message was edited by:
    Vakeel
    Message was edited by:
    Vakeel

  • Need help in Report From SQL Query

    Hi All,
    I am facing a problem with a report. I need your help.
    I am creating a Report From SQL Query (Portal) with some arguments passed at runtime. I am able to view the output, if the query returns few rows ( arount 1000 rows). But for some inputs it needs to generate >15000 records, at this point the page is getting time out (i think!) and showing error page. I am able to execute query from the SQL Plus console ot using TOAD editor. Here the query is not taking more that 2 mins time to show the result.
    If i am executing from Portal i observed that, once i give the appropriate input and hit submit button a new oracle process is getting created for the query on UNIX (I am usign "TOP" command to check processes). The browser page will be shown error page after 5 minutes (i am assuming session time out!) , but on the backend the process will be executed for more than 30 mins.
    I tried also increase the page time out in httpd.conf, but no use.
    The data returned as a result of the query is sized more than 10 MB. Is caching this much data is possible by the browser page? is the returned data is creating any problem here.
    Please help me to find appropriate reasone for the failure?

    user602513 wrote:
    Hi All,
    I am facing a problem with a report. I need your help.
    I am creating a Report From SQL Query (Portal) with some arguments passed at runtime. I am able to view the output, if the query returns few rows ( arount 1000 rows). But for some inputs it needs to generate >15000 records, at this point the page is getting time out (i think!) and showing error page. I am able to execute query from the SQL Plus console ot using TOAD editor. Here the query is not taking more that 2 mins time to show the result.
    If i am executing from Portal i observed that, once i give the appropriate input and hit submit button a new oracle process is getting created for the query on UNIX (I am usign "TOP" command to check processes). The browser page will be shown error page after 5 minutes (i am assuming session time out!) , but on the backend the process will be executed for more than 30 mins.
    I tried also increase the page time out in httpd.conf, but no use.
    The data returned as a result of the query is sized more than 10 MB. Is caching this much data is possible by the browser page? is the returned data is creating any problem here.
    Please help me to find appropriate reasone for the failure?Do you get any errors or warnings or it is just the slow speed which is the issue?
    There could be a variety of reasons for the delayed processing of this report. That includes parameter settings for that page, cache settings, network configurations, etc.
    - explore best optimization for your query;
    - evaluate portal for best performance configuration; you may follow this note (Doc ID: *438794.1* ) for ideas;
    - third: for that particular page carrying that report, you can use caching wisely. browser cache is neither decent for large files, nor practical. instead, explore the page cache settings that portal provides.
    - also look for various log files (application.log and apache logs) if you are getting any warnings reflecting on some kind of processing halt.
    - and last but not the least: if you happen to bring up a portal report with more than 10000 rows for display then think about the usage of the report. Evaluate whether that report is good/useful for anything?
    HTH
    AMN

  • Need help in installation of SQL Developer in Win7

    Dear Frens,
    I got a task to validate the SQL developer(64 bit version) in Win7 environment. I followed the advice in this form and installed the 64 bit JDK first.
    It can be verified:
    C:\>java -version
    java version "1.6.0_26"
    Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
    Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
    Then SQL developer asked for the path of java.exe for the first time, and after configuring it to the correct path, I found it had problems creating the connection to the database when I tried to click database connection button. Please be noted, I do not have the win admin right for the PC.
    The error messages are listed below. Need some help from you guys.
    java.lang.NoClassDefFoundError: oracle/javatools/db/DBLog
         at oracle.jdeveloper.db.DatabaseConnectionStores.registerStoreProvider(DatabaseConnectionStores.java:388)
         at oracle.jdeveloper.db.DatabaseConnectionStores.<init>(DatabaseConnectionStores.java:74)
         at oracle.jdeveloper.db.DatabaseConnectionStores.getInstance(DatabaseConnectionStores.java:63)
         at oracle.jdeveloper.db.DatabaseActions.<init>(DatabaseActions.java:53)
         at oracle.jdeveloper.db.DatabaseActions.getConnectionEditorAction(DatabaseActions.java:79)
         at oracle.jdevimpl.db.DBConnWizard.invoke(DBConnWizard.java:38)
         at oracle.ide.wizard.WizardManager.invokeWizard(WizardManager.java:372)
         at oracle.ide.wizard.WizardManager$1.run(WizardManager.java:420)
         at oracle.ide.util.IdeUtil$3.run(IdeUtil.java:1079)
         at oracle.javatools.util.SwingUtils.invokeAfterRepaint(SwingUtils.java:520)
         at oracle.ide.util.IdeUtil.invokeAfterRepaint(IdeUtil.java:1092)
         at oracle.ide.wizard.WizardManager$2.run(WizardManager.java:428)
         at oracle.ide.util.IdeUtil$3.run(IdeUtil.java:1079)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641)
         at java.awt.EventQueue.access$000(EventQueue.java:84)
         at java.awt.EventQueue$1.run(EventQueue.java:602)
         at java.awt.EventQueue$1.run(EventQueue.java:600)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:611)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Caused by: oracle.classloader.util.AnnotatedClassNotFoundException:
         Missing class: oracle.javatools.db.DBLog
         Dependent class: oracle.jdeveloper.db.DatabaseConnectionStores
         Loader: ide-global:11.1.1.0.0
         Code-Source: //DBG.ADS.DB.COM/SNG-USERS-U/VF05_USERS08/liustea/config/Desktop/sqldeveloper64-2.1.1.64.45-no-jre/sqldeveloper/jdev/extensions/oracle.jdeveloper.db.connection.jar
         Configuration: extension jar in \\DBG.ADS.DB.COM\SNG-USERS-U\VF05_USERS08\liustea\config\Desktop\sqldeveloper64-2.1.1.64.45-no-jre\sqldeveloper\jdev\extensions
    This load was initiated at ide-global:11.1.1.0.0 using the loadClass() method.
    The missing class is not available from any code-source or loader in the system.
         at oracle.classloader.PolicyClassLoader.handleClassNotFound(PolicyClassLoader.java:2190)
         at oracle.classloader.PolicyClassLoader.internalLoadClass(PolicyClassLoader.java:1733)
         at oracle.classloader.PolicyClassLoader.access$000(PolicyClassLoader.java:143)
         at oracle.classloader.PolicyClassLoader$LoadClassAction.run(PolicyClassLoader.java:331)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.classloader.PolicyClassLoader.loadClass(PolicyClassLoader.java:1692)
         at oracle.classloader.PolicyClassLoader.loadClass(PolicyClassLoader.java:1674)
         ... 27 more
    Steven Liu

    ateeqrahman wrote:
    Hi,
    I am planning to install Oracle 10g on RHEL. Can anyone plss tell me if the kernel parameters are set as default or according to hardware/software specifications. What other parameters should i be careful of. I have a database of around 40GB which i have to export from Oracle 8.0.6 running on Win 2000 server.
    Which linux version you are using .
    For RHEL & SUSE , please refer to :
    http://www.oracle.com/technology/pub/articles/smiley_10gdb_install.html#rhel4
    Also check :
    http://www.akadia.com/services/ora_linux_install_10g.html
    On OEL ,
    http://kamranagayev.wordpress.com/2010/04/25/video-tutorial-installing-oel-and-oracle-10gr2/
    Regards
    Rajesh

  • Need clear steps for doing performance tuning on SQL Server 2008 R2 (DB Engine, Reporting Services and Integration Services)

    We have to inverstigate about a reporting solution where things are getting slow (may be material, database design, network matters).
    I have red a lot in MSDN and some books about performance tuning on SQL Server 2008 R2 (or other) but frankly, I feel a little lost in all that stuff
    I'am looking for practical steps in order to do the tuning. Someone had like a recipe for that : a success story...
    My (brain storm) Methodology should follow these steps:
     Resource bottlenecks: CPU, memory, and I/O bottlenecks
     tempdb bottlenecks
     A slow-running user query : Missing indexes, statistics,...
     Use performance counters : there are many, can one give us the list of the most important
    how to do fine tuning about SQL Server configuration
    SSRS, SSIS configuration ? 
    And do the recommandations.
    Thanks
    "there is no Royal Road to Mathematics, in other words, that I have only a very small head and must live with it..."
    Edsger W. Dijkstra

    Hello,
    There is no clear defined step which can be categorized as step by step to performance tuning.Your first goal is to find out cause or drill down to factor causing slowness of SQL server it can be poorly written query ,missing indexes,outdated stats.RAM crunch
    CPU crunch so on and so forth.
    I generally refer to below doc for SQL server tuning
    http://technet.microsoft.com/en-us/library/dd672789(v=sql.100).aspx
    For SSIS tuning i refer below doc.
    http://technet.microsoft.com/library/Cc966529#ECAA
    http://msdn.microsoft.com/en-us/library/ms137622(v=sql.105).aspx
    When I face issue i generally look at wait stats ,wait stats give you idea about on what resource query was waiting.
    --By Jonathan KehayiasSELECT TOP 10
    wait_type ,
    max_wait_time_ms wait_time_ms ,
    signal_wait_time_ms ,
    wait_time_ms - signal_wait_time_ms AS resource_wait_time_ms ,
    100.0 * wait_time_ms / SUM(wait_time_ms) OVER ( )
    AS percent_total_waits ,
    100.0 * signal_wait_time_ms / SUM(signal_wait_time_ms) OVER ( )
    AS percent_total_signal_waits ,
    100.0 * ( wait_time_ms - signal_wait_time_ms )
    / SUM(wait_time_ms) OVER ( ) AS percent_total_resource_waits
    FROM sys.dm_os_wait_stats
    WHERE wait_time_ms > 0 -- remove zero wait_time
    AND wait_type NOT IN -- filter out additional irrelevant waits
    ( 'SLEEP_TASK', 'BROKER_TASK_STOP', 'BROKER_TO_FLUSH',
    'SQLTRACE_BUFFER_FLUSH','CLR_AUTO_EVENT', 'CLR_MANUAL_EVENT',
    'LAZYWRITER_SLEEP', 'SLEEP_SYSTEMTASK', 'SLEEP_BPOOL_FLUSH',
    'BROKER_EVENTHANDLER', 'XE_DISPATCHER_WAIT', 'FT_IFTSHC_MUTEX',
    'CHECKPOINT_QUEUE', 'FT_IFTS_SCHEDULER_IDLE_WAIT',
    'BROKER_TRANSMITTER', 'FT_IFTSHC_MUTEX', 'KSOURCE_WAKEUP',
    'LAZYWRITER_SLEEP', 'LOGMGR_QUEUE', 'ONDEMAND_TASK_QUEUE',
    'REQUEST_FOR_DEADLOCK_SEARCH', 'XE_TIMER_EVENT', 'BAD_PAGE_PROCESS',
    'DBMIRROR_EVENTS_QUEUE', 'BROKER_RECEIVE_WAITFOR',
    'PREEMPTIVE_OS_GETPROCADDRESS', 'PREEMPTIVE_OS_AUTHENTICATIONOPS',
    'WAITFOR', 'DISPATCHER_QUEUE_SEMAPHORE', 'XE_DISPATCHER_JOIN',
    'RESOURCE_QUEUE' )
    ORDER BY wait_time_ms DESC
    use below link to analyze wait stats
    http://www.sqlskills.com/blogs/paul/wait-statistics-or-please-tell-me-where-it-hurts/
    HTH
    PS: for reporting services you can post in SSRS forum
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • Need Help in correcting the sql statement

    H Experts,
    I am not if I can post this query in this section, but as I am executing this statement on repository DB , I assumed to post here.
    I have a requirement to calculate the database sizes from the tables in repository.
    table 1 : MGMT$DB_TABLESPACES_ALL : has the information on all the tablespace information from each database. and it has information of all the databases.
    table 2: MGMT$DB_REDOLOGS_ALL : has the information on all the redolog files information from each database. and it has information of all the databases.
    Now to calculate the size of each database , we need to collect the sizes from both tables and then need to add.
    below is the sql i prepared and sql didn't return and systax error , but the final output is completely wrong. Seems like its multiplying the data somewhere and getting the wrong information.
    please help me in doing the required modifications.
    =================================================================================================
    select a.TARGET_NAME "DATABASE_NAME" ,sum(a.TABLESPACE_SIZE/1024/1024/1024)+sum(b.LOGSIZE/1024/1024/1024/1024) "DATABASE ALLOCATED SPACE(GB)",
    sum(a.TABLESPACE_USED_SIZE/1024/1024/1024)+sum(b.LOGSIZE/1024/1024/1024/1024) "DATABASE USED SPACE(GB)",
    sum(a.TABLESPACE_SIZE/1024/1024/1024)-sum(a.TABLESPACE_USED_SIZE/1024/1024/1024) "DATABASE FREE SPACE(GB)"
    from MGMT$DB_TABLESPACES_ALL a ,MGMT$DB_REDOLOGS_ALL b
    where a.TARGET_NAME=b.TARGET_NAME and a.TARGET_Name like '%d2oem%'
    group by a.target_name;
    ====================================================================================================
    Note: There are multiple records having the same TARGET_NAME value in both the tables.
    please Help me in correcting the sql statement

    H Experts,
    I am not if I can post this query in this section, but as I am executing this statement on repository DB , I assumed to post here.
    I have a requirement to calculate the database sizes from the tables in repository.
    table 1 : MGMT$DB_TABLESPACES_ALL : has the information on all the tablespace information from each database. and it has information of all the databases.
    table 2: MGMT$DB_REDOLOGS_ALL : has the information on all the redolog files information from each database. and it has information of all the databases.
    Now to calculate the size of each database , we need to collect the sizes from both tables and then need to add.
    below is the sql i prepared and sql didn't return and systax error , but the final output is completely wrong. Seems like its multiplying the data somewhere and getting the wrong information.
    please help me in doing the required modifications.
    =================================================================================================
    select a.TARGET_NAME "DATABASE_NAME" ,sum(a.TABLESPACE_SIZE/1024/1024/1024)+sum(b.LOGSIZE/1024/1024/1024/1024) "DATABASE ALLOCATED SPACE(GB)",
    sum(a.TABLESPACE_USED_SIZE/1024/1024/1024)+sum(b.LOGSIZE/1024/1024/1024/1024) "DATABASE USED SPACE(GB)",
    sum(a.TABLESPACE_SIZE/1024/1024/1024)-sum(a.TABLESPACE_USED_SIZE/1024/1024/1024) "DATABASE FREE SPACE(GB)"
    from MGMT$DB_TABLESPACES_ALL a ,MGMT$DB_REDOLOGS_ALL b
    where a.TARGET_NAME=b.TARGET_NAME and a.TARGET_Name like '%d2oem%'
    group by a.target_name;
    ====================================================================================================
    Note: There are multiple records having the same TARGET_NAME value in both the tables.
    please Help me in correcting the sql statement

  • Permissions needed for Applying SQL Tuning Sets/SQL Plans 11g?

    What permission are needed for a user to apply/activate sql tuning sets (sql plans) in 11g? The user can capture and move the the sql tuning sets from a 10g database to an 11g database but is getting "ORA-01031: insufficient privileges" when trying to activate/apply the sqlplans in 11g.
    The user has:
    ADMINISTER SQL MANAGEMENT OBJECT and ADMINISTER SQL TUNING SET and EXECUTE on SYS.DBMS_SPM
    The user is an administrator for our Data Warehouse team but they do not have sysdba priviliges.
    Do you also know of a good white paper that covers the step by step instructions and permissions needed for aquiring and applying/activating sqlplans?
    If more information is needed in order to respond please advise.
    Thank you

    What permission are needed for a user to apply/activate sql tuning sets (sql plans) in 11g? The user can capture and move the the sql tuning sets from a 10g database to an 11g database but is getting "ORA-01031: insufficient privileges" when trying to activate/apply the sqlplans in 11g.
    The user has:
    ADMINISTER SQL MANAGEMENT OBJECT and ADMINISTER SQL TUNING SET and EXECUTE on SYS.DBMS_SPM
    The user is an administrator for our Data Warehouse team but they do not have sysdba priviliges.
    Do you also know of a good white paper that covers the step by step instructions and permissions needed for aquiring and applying/activating sqlplans?
    If more information is needed in order to respond please advise.
    Thank you

  • Urgently need help pls- error in sql

    hi everyone i need some help please. the error is :
    ("select title from book where resource_ID= (select resource_ID from
    resources where mem_ID='"+id+"')");     
    thanking u in advance
    here is the full program.
    <html>
    <head>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*"%>
    <%@ page import="java.util.*"%>
    </head>
    <body background="CLOTH003.GIF">
    <font face="comic sans ms" size="5">
    <br><br>
    <center>
    <center>
    <img border="0" src="search.JPG" width="107" height="30">
    <img border="0" src="edit.JPG" width="106" height="30">
    <img border="0" src="logout.JPG" width="95" height="30">
    <img border="0" src="help.GIF" width="105" height="30">
    <br>
    <br>
    <%
    // define database parameters
    String host="localhost:8080";
    String db="lsib";
    String optionSelected="";
    String conn;
    Statement createStatement = null;
    ResultSet rs = null;
    String user = "kushal";
    String pass = "";
    Class.forName("com.mysql.jdbc.Driver");
    // create connection string
    conn = "jdbc:mysql:" + host + "/" + db + "?user=" + user + "&password=" + pass;
    conn = "jdbc:mysql://localhost/LSIB";
    // pass database parameters to JDBC driver
    Connection Conn = DriverManager.getConnection(conn);
    // query statement
    Statement SQLStatement = Conn.createStatement();
    String id =request.getParameter("mem_ID");
    // generate query
    String sql="select name, fines,from member where mem_ID="+id;
    // get result
    rs= SQLStatement.executeQuery(sql);
    if (rs != null && rs.next() )
         String lname = rs.getString("name");
         int lfines = rs.getInt("fines");
         String ltitle = rs.getString("title");
    %>
         <form method="post" action="renew.jsp">
         <table border = "0" width="400">
         <tr>
         <td><b>hello</b></td><td><input name="logname" type="text" width="30" value="<%= lname           
    %>"></td>
         </tr>
         <tr>
         <td><b>you have a fine of �</b></td><td><input name="logfines" value="<%= lfines
    %>"></td>      
         </tr>
    <tr>
    <td><b>your resources on loan</b></td><td><select name="logtitle">
    <%
    rs= SQLStatement.executeQuery("select title from book where resource_ID= (select resource_ID from
    resources where mem_ID='"+id+"')");     
    if (rs != null)
         while (rs.next()) {
         String title = rs.getString("title");
         if(ltitle==title)
              optionSelected =" selected";
         else
              optionSelected="";
    %>
         <option value='<%= title %>' <%=optionSelected %>>
    <%
         }//end of while
    }//end of if
    %>
    </select></td>
    </tr>
    <tr>
         <td colspan = "2">
              <center>
                   <input type="submit" value=" renew ">
              </center>
         </td>
         </tr>
    </form>
    <%
    else
    out.println("No records found");               
    // close connection
    rs.close();
    SQLStatement.close();
    Conn.close();
    %>
    </table>
    </body>
    </html>

    hi here is the error:
    Error: 500
    Location: /LSIB/login.jsp
    Internal Servlet Error:
    javax.servlet.ServletException: Syntax error or access violation: You have an error in your SQL syntax near 'from member where mem_ID=830099' at line 1
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(Unknown Source)
         at login_2._jspService(login_2.java:188)
         at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java)
         at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
         at org.apache.tomcat.core.Handler.invoke(Unknown Source)
         at org.apache.tomcat.core.Handler.service(Unknown Source)
         at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
         at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(Unknown Source)
         at org.apache.tomcat.facade.RequestDispatcherImpl.forward(Unknown Source)
         at org.apache.jasper.runtime.PageContextImpl.forward(Unknown Source)
         at validate_7._jspService(validate_7.java:121)
         at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java)
         at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
         at org.apache.tomcat.core.Handler.invoke(Unknown Source)
         at org.apache.tomcat.core.Handler.service(Unknown Source)
         at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
         at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
         at org.apache.tomcat.core.ContextManager.service(Unknown Source)
         at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
         at java.lang.Thread.run(Thread.java:484)
    Root cause:
    java.sql.SQLException: Syntax error or access violation: You have an error in your SQL syntax near 'from member where mem_ID=830099' at line 1
         at com.mysql.jdbc.MysqlIO.sendCommand(Unknown Source)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(Unknown Source)
         at com.mysql.jdbc.MysqlIO.sqlQuery(Unknown Source)
         at com.mysql.jdbc.Connection.execSQL(Unknown Source)
         at com.mysql.jdbc.Connection.execSQL(Unknown Source)
         at com.mysql.jdbc.Statement.executeQuery(Unknown Source)
         at com.mysql.jdbc.jdbc2.Statement.executeQuery(Unknown Source)
         at login_2._jspService(login_2.java:100)
         at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java)
         at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
         at org.apache.tomcat.core.Handler.invoke(Unknown Source)
         at org.apache.tomcat.core.Handler.service(Unknown Source)
         at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
         at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(Unknown Source)
         at org.apache.tomcat.facade.RequestDispatcherImpl.forward(Unknown Source)
         at org.apache.jasper.runtime.PageContextImpl.forward(Unknown Source)
         at validate_7._jspService(validate_7.java:121)
         at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java)
         at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
         at org.apache.tomcat.core.Handler.invoke(Unknown Source)
         at org.apache.tomcat.core.Handler.service(Unknown Source)
         at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
         at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
         at org.apache.tomcat.core.ContextManager.service(Unknown Source)
         at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
         at java.lang.Thread.run(Thread.java:484)

  • Need to convert DTS packages to SQL Server 2012 environment.

    Hi Friends,
    As Part of the Project Requirement,we need to convert DTS packages to SQL Server 2012 environment.
    Please sugest me best approach.
    Thanks

    Best approach is to re-design the packages in SSIS 2012 directy if it is feasible. Because most of the DTS feaures are discontinued and also you will have to clean up all errors that you are going to get after migration.
    Discontinued Integration Services Functionality in SQL Server 2012
    Otherwise you need to migrate it first to 2008R2 and then 2012 version.
    Below ones would be helpful for you:
    Migrate DTS packages to SSIS (SSIS2008R2)
    Support of DTS packages in 2008 R2
    Known DTS Package Migration Issues
    Cheers,
    Vaibhav Chaudhari

Maybe you are looking for