SQL stmt fine tunning

Hi DBA,
i am new to this field.
i can see from EM some sql are taking 8%- 95% of Db . i get the SQL_ID from the Em how to fine tune this?
also can you please help me out with some standard recommendations to run the DB in best manner.
Thanks in advance.

As a generic recommendation for slow sql queries, read the following thread ,
When your query takes too long ...
HTH
Aman....

Similar Messages

  • File: e:\pt849-905-R1-retail\peopletools\SRC\PSRED\psred.cppSQL error. Stmt #: 1849  Error Position: 24  Return: 3106 - ORA-03106: fatal two-task communication protocol error   Failed SQL stmt:SELECT PROJECTNAME FROM PSPROJECTDEFN ORDER

    File:
    e:\pt849-905-R1-retail\peopletools\SRC\PSRED\psred.cppSQL error. Stmt #:
    1849  Error Position: 24  Return: 3106 - ORA-03106: fatal two-task
    communication protocol error
    Failed SQL stmt:SELECT PROJECTNAME FROM PSPROJECTDEFN ORDER
    BY PROJECTNAME
    Got this error when opening the peopletools application designer 8.49. The same is working fine within the server, but not working from the client's machine.
    We can still able to connect to the database & URL
    Please help by throwing some lights.
    Thanks,
    Sarathy K

    Looks like a SQL error. ARe you able to connect to the database with SQL*Plus ? Probably the Oracle client is badly configured.
    Nicolas.

  • 12571 - ORA-12571: TNS:packet writer failure Failed SQL stmt

    hi, sir,
       My script work successfully and when i am try to script mover software every thing done fine but at the end i face this(12571 - ORA-12571: TNS:packet writer failure Failed SQL stmt) error. so I read few article they told about this is antivirus issue, so please tell me, can i re-run the script mover or not.
    Samiullah

    Hi Neeraj,
    This is My Listerner file
    # listener.ora Network Configuration File: D:\oracle\product\10.2.0\db_1\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    HRCS9 =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.2.204)(PORT = 1521))
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    SID_LIST_HRCS9 =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = PLSExtProc)
          (ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
          (PROGRAM = extproc)
    This is my tns file
    # tnsnames.ora Network Configuration File: D:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora
    # Generated by Oracle configuration tools.
    HRCS9 =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.2.204)(PORT = 1521))
        (CONNECT_DATA =
          (SERVICE_NAME = HRCS9)
    both file working good and ping
    Samiullah

  • Fine Tune Procedure

    Hi, Everyone,
    My oracle database version is oracle 11.2.0.1.
    I am running this procedure in a pl/sql package.  When i the process comes to running this process it does not come back.  Could you please help me to fine tune this procedure
    PROCEDURE ICM_MIN_PR_DIFF        
    (V_LOW IN NUMBER,
    V_UP IN NUMBER)
    AS
    L_INS_TABLE VARCHAR2(4000);
    L_QRY_1_PART VARCHAR2(4000);
    L_QRY_2_PART VARCHAR2(4000);
    L_QRY_3_PART VARCHAR2(4000);
    L_QRY_POPULATE VARCHAR2(4000);
    BEGIN
    EXECUTE IMMEDIATE 'TRUNCATE TABLE ICM_MIN_PRDIFF_0';
    L_QRY_1_PART := '    select  a.customer_no,a.pr_code_bbl,a.score,min(b.price_diff) price_diff, a.flag
    from ICM_MAX_SCORE_0 a, icm b
    where 
    a.customer_no = b.customer_no
    and a.pr_code_bb=b.pr_code_bb
    and a.score = b.score
    and a.flag = b.flag
    and b.price_diff > 0
    and b.score >=0.5
    and b.flag = 0
    and b.price_diff > ';
    L_QRY_2_PART := ' AND  b.price_diff <= ';
    L_QRY_3_PART := ' GROUP BY a.customer_no,a.pr_code_bb,a.score,a.flag ';
    L_QRY_POPULATE := L_QRY_1_PART || V_LOW ||L_QRY_2_PART || V_UP || L_QRY_3_PART;
    --Construct Insertion Statment by appending the Query Statement
    L_INS_TABLE := 'INSERT /*APPEND */ INTO ICM_MIN_PRDIFF_0 ' ||
    L_QRY_POPULATE;
    --DBMS_OUTPUT.PUT_LINE(L_INS_TABLE);
    DBMS_OUTPUT.PUT_LINE('POPULATED ICM_MIN_PRDIFF_0');
    EXECUTE IMMEDIATE L_INS_TABLE;
    COMMIT;
    END ICM_MIN_PR_DIFF;
    The following is the explain plan for the query
    plan FOR succeeded.
    PLAN_TABLE_OUTPUT                                                                                                                                                                                                                                                                                         
    Plan hash value: 636749222                                                                                                                                                                                                                                                                                  
    | Id  | Operation                | Name                           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |                                                                                                                                                                                         
    |   0 | INSERT STATEMENT         |                                |  1390K|   132M|       |  1796K  (1)| 05:59:13 |                                                                                                                                                                                         
    |   1 |  LOAD TABLE CONVENTIONAL | ICM_MIN_PRDIFF_0 |       |       |       |            |          |                                                                                                                                                                                         
    |   2 |   HASH GROUP BY          |                                |  1390K|   132M|   155M|  1796K  (1)| 05:59:13 |                                                                                                                                                                                         
    |*  3 |    HASH JOIN             |                                |  1390K|   132M|    68M|  1764K  (1)| 05:52:54 |                                                                                                                                                                                         
    |*  4 |     TABLE ACCESS FULL    | ICM_MAX_SCORE_0 |  1390K|    53M|       |  2478   (1)| 00:00:30 |                                                                                                                                                                                         
    |*  5 |     TABLE ACCESS FULL    | ICM                |    10M|   611M|       |  1722K  (1)| 05:44:26 |                                                                                                                                                                                         
    Predicate Information (identified by operation id):                                                                                                                                                                                                                                                         
       3 - access("A"."CUSTOMER_NO"="B"."CUSTOMER_NO" AND "A"."PR_CODE_BB"="B"."PR_CODE_BB" AND                                                                                                                                                                                                               
                  "A"."SCORE"="B"."SCORE" AND "A"."FLAG"="B"."FLAG")                                                                                                                                                                                                                                            
       4 - filter("A"."FLAG"=0 AND "A"."SCORE">=0.5)                                                                                                                                                                                                                                                            
       5 - filter("B"."PRICE_DIFF"<=10 AND "B"."SCORE">=0.5 AND "B"."PRICE_DIFF">0 AND "B"."FLAG"=0)                                                                                                                                                                                                            
    20 rows selected
    select count(1) from ICM_MAX_SCORE_0 = 1390409
    select count(1) from ICM = 586260240

    please look at the explain plan for the sql after implementing your advice
    explain plan for
    insert /*+ append */ into ICM_MIN_PRDIFF_0 (customer_no,pr_code_bb,score,price_diff,flag)
    select  a.customer_no,a.pr_code_bb,a.score,min(b.price_diff) price_diff, a.flag
    from ICM_MAX_SCORE_0 a, icm b
    where   a.customer_no = b.customer_no
    and a.pr_code_bb=b.pr_code_bb
    and a.score = b.score
    and a.flag = b.flag
    and b.price_diff > 0
    and b.score >=0.5
    and b.flag = 0
    and b.price_diff > 0
    AND  b.price_diff <= 10
    GROUP BY a.customer_no,a.pr_code_bb,a.score,a.flag ;
    SELECT * FROM TABLE(dbms_xplan.display);
    plan FOR succeeded.
    PLAN_TABLE_OUTPUT                                                                                                                                                                                                                                                                                         
    Plan hash value: 4089758326                                                                                                                                                                                                                                                                                 
    | Id  | Operation            | Name                           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |                                                                                                                                                                                             
    |   0 | INSERT STATEMENT     |                                |  1390K|   132M|       |  1796K  (1)| 05:59:13 |                                                                                                                                                                                             
    |   1 |  LOAD AS SELECT      | ICM_MIN_PRDIFF_0 |       |       |       |            |          |                                                                                                                                                                                             
    |   2 |   HASH GROUP BY      |                                |  1390K|   132M|   155M|  1796K  (1)| 05:59:13 |                                                                                                                                                                                             
    |*  3 |    HASH JOIN         |                                |  1390K|   132M|    68M|  1764K  (1)| 05:52:54 |                                                                                                                                                                                             
    |*  4 |     TABLE ACCESS FULL| ICM_MAX_SCORE_0 |  1390K|    53M|       |  2478   (1)| 00:00:30 |                                                                                                                                                                                             
    |*  5 |     TABLE ACCESS FULL| ICM                |    10M|   611M|       |  1722K  (1)| 05:44:26 |                                                                                                                                                                                             
    Predicate Information (identified by operation id):                                                                                                                                                                                                                                                         
       3 - access("A"."CUSTOMER_NO"="B"."CUSTOMER_NO" AND "A"."PR_CODE_BB"="B"."PR_CODE_BB" AND                                                                                                                                                                                                               
                  "A"."SCORE"="B"."SCORE" AND "A"."FLAG"="B"."FLAG")                                                                                                                                                                                                                                            
       4 - filter("A"."FLAG"=0 AND "A"."SCORE">=0.5)                                                                                                                                                                                                                                                            
       5 - filter("B"."PRICE_DIFF"<=10 AND "B"."SCORE">=0.5 AND "B"."PRICE_DIFF">0 AND "B"."FLAG"=0)                                                                                                                                                                                                            
    20 rows selected

  • Want to fine tune database

    Hi all,
    I noticed some slowness for my oracle database during few time not as before. i want to fine tune that database could you help please what is the way i have to follow to fine tune my database in general.
    The database is on unix system and 10g version.
    I herad statspack or tkproof but i've never used them and i don't know how to interpret output, please help.
    Thanks
    Raitsarevo

    If you want help you need to ask a specific question.
    Oracle provides a Performance and Tuning manual which contains a great deal of information including coverage for the statistics reported by the AWR / Statspack and use of the SQL trace facility.
    For more help with statspack see Oracle support document
    STATSPACK COMPLETE REFERENCE #94224.1
    HTH -- Mark D Powell --

  • Failed SQL stmt:DELETE FROM PSPTTSTDEFNDEL

    Hi,
    This is shiva,
    hope your doing well,
    Recently i did the people tools upgrade from 8.50 to 8.52.04 .
    i am able to login in data mover using access id and my application server and process scheduler also working fine
    but while i am trying to login application designer i am geeting below error
    File: E:\pt852-903-R1-retail\peopletools\src\psmgr\mgrvers.cppSQL error. Stmt #: 824 Error Position: 12 Return: 942 - ORA-00942: table or view does not exist
    Failed SQL stmt:DELETE FROM PSPTTSTDEFNDEL
    can you please helpme on this ASAP
    Regards
    Shiva
    Edited by: 866234 on Jan 23, 2012 12:31 AM
    Edited by: 866234 on Jan 23, 2012 2:38 AM
    Edited by: 866234 on Jan 23, 2012 3:48 AM

    Hi,
    I am able to login datamover in bootstrap mode
    I did the peopletools upgrade from 8.50 to 8.52.04 that time i am unable to login app designer.
    my application server and process scheduler are working fine
    but while i was trying to ligin application designer im geeting that error
    can you help me on this ASAP

  • ORacle sales analyzer doesn't display sql's using show sq.sql.stmts

    Hi,
    I cannot view the sql statements generated by Oracle Sales analyzer cube using show sq.sql.stmts.
    Moreover when I check on db I don't see any sql's being issued by web OSA session.
    What could be the possible reason for this?

    Lang wrote:
    Hi
    Can anyone help please, I am using SQL developer 3.0, and I have come across a lot of cases that after compiling a package , the compiler doesn't show me any errors, and It shows me the package is compiled , but it 's not valid after I close down the sql developer and log back in again.
    I am using 11g instantclient with it.Really?
    & here I thought SQL Developer used JDBC Thin to connect to the DB.

  • What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it

    hi,
    What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it?
    regards.

    sorry, question resolved.

  • Using flex pitch is there a way to fine tune the start point .i'm using it as a audio to  midi function

    using flex pitch is there a way to fine tune the start point .i'm using it as a audio to  midi function

    Thank you for your reply Karsten but unfortunately this didn't help me so far. Or maybe I'm missing something?
    First the link is a tutorial for iMovie on a Mac. I'm using iMovie on iPad so the steps are inapplicable.
    Second it is only possible for me to manipulate the end part of the sound clip to whichever duration I want. But I can't do the same with the 'beginning' of the sound clip.
    I simply want to place some photos in the beginning of my video with no sound in the background then after like 2 secs I want to start the music clip. For some reason that is not possible! Cause every time I drop the music clip unto my project timeline it automatically place it self along with the first frame in the project! And consequently the photos and music are forced to start together.
    Hope I'm making sense...

  • SQL runs fine on DB11.2.0.1.0 but fails on DB9.2.0.8.0 with errors.

    The below SQL runs fine on DB11.2.0.1.0 but fails on DB9.2.0.8.0 with error:
    WITH users_with_dba_privs AS
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-00904: "from$_subquery$_005"."PARENT": invalid identifier
    SQL
    WITH users_with_dba_privs AS
    (select distinct child user_name
    from (select null parent, 'DBA' child from dual
    union all
    select granted_role parent, grantee child
    from dba_role_privs)
    where child in (select username from dba_users)
    start with parent is null connect by parent = prior child )
    select 'select_any_table',
    substr(SYS_CONNECT_BY_PATH(c, '->'),3,512) path, c
    from (select null p, name c
    from system_privilege_map
    where name = 'SELECT ANY TABLE'
    union all
    select -- users/roles and roles granted
    granted_role p,
    grantee c
    from dba_role_privs
    where granted_role != 'DBA'
    union all
    select -- users/roles with select any table
    privilege p, grantee c
    from dba_sys_privs
    where privilege = 'SELECT ANY TABLE')
    where (c = 'PUBLIC' OR c in (select username from dba_users))
    AND c NOT IN('MDSYS','DMSYS','CTXSYS','WMSYS','ORDSYS','OLAPSYS','DBSNMP')
    and c NOT IN (select user_name from users_with_dba_privs)
    start with p is null connect by p = prior c
    union all
    select 'select_privilege',
    substr(SYS_CONNECT_BY_PATH(c, '->'),3,512) path, c
    from (select null p, view_name c
    from dba_views
    where view_name like 'DBA_%'
    union all
    select -- users/roles and roles granted
    granted_role p,
    grantee c
    from dba_role_privs
    where granted_role != 'DBA'
    union all
    select -- users/roles with select on DBA views
    table_name p, grantee c
    from dba_tab_privs
    where privilege = 'SELECT'
    and table_name like 'DBA_%')
    where (c = 'PUBLIC' OR c in (select username from dba_users))
    AND c NOT IN('MDSYS','DMSYS','CTXSYS','WMSYS','ORDSYS','OLAPSYS','DBSNMP')
    and c NOT IN (select user_name from users_with_dba_privs)
    start with p is null connect by p = prior c
    Thanks in advance.
    ~Hozy

    hoek,
    Why do you think this WITH clause is special?
    I've taken the liberty of formatting the code, and can't see what's wrong. (Maybe I'm just too tired)
    I believe 9i did have subquery factoring.
    with users_with_dba_privs
           as (    select distinct child user_name
                     from (    select null parent, 'DBA' child from dual
                           union all
                           select granted_role parent, grantee child
                             from dba_role_privs)
                    where child in (    select username from dba_users)
               start with parent is null
               connect by parent = prior child)
        select 'select_any_table', substr(sys_connect_by_path(c, '->'), 3, 512) path, c
          from (select null p, name c
                  from system_privilege_map
                 where name = 'SELECT ANY TABLE'
                union all
                select -- users/roles and roles granted
                      granted_role p, grantee c
                  from dba_role_privs
                 where granted_role != 'DBA'
                union all
                select -- users/roles with select any table
                      privilege p, grantee c
                  from dba_sys_privs
                 where privilege = 'SELECT ANY TABLE')
         where (c = 'PUBLIC'
             or c in (    select username from dba_users))
           and c not in
                     ('MDSYS'
                     ,'DMSYS'
                     ,'CTXSYS'
                     ,'WMSYS'
                     ,'ORDSYS'
                     ,'OLAPSYS'
                     ,'DBSNMP')
           and c not in (    select user_name from users_with_dba_privs)
    start with p is null
    connect by p = prior c
    union all
        select 'select_privilege', substr(sys_connect_by_path(c, '->'), 3, 512) path, c
          from (select null p, view_name c
                  from dba_views
                 where view_name like 'DBA_%'
                union all
                select -- users/roles and roles granted
                      granted_role p, grantee c
                  from dba_role_privs
                 where granted_role != 'DBA'
                union all
                select -- users/roles with select on DBA views
                      table_name p, grantee c
                  from dba_tab_privs
                 where privilege = 'SELECT'
                   and table_name like 'DBA_%')
         where (c = 'PUBLIC'
             or c in (    select username from dba_users))
           and c not in
                     ('MDSYS'
                     ,'DMSYS'
                     ,'CTXSYS'
                     ,'WMSYS'
                     ,'ORDSYS'
                     ,'OLAPSYS'
                     ,'DBSNMP')
           and c not in (    select user_name from users_with_dba_privs)
    start with p is null
    connect by p = prior cRegards
    Peter

  • Count (*)  for select stmt take more time than  execute a that sql stmt

    HI
    count (*) for select stmt take more time than execute a that sql stmt
    executing particular select stmt take 2.47 mins but select stmt is using the /*+parallel*/ (sql optimer) in that sql  command for faster execute .
    but if i tried to find out total number of rows in that query it takes more time ..
    almost 2.30 hrs still running to find count(col)
    please help me to get count of row faster.
    thanks in advance...

    797525 wrote:
    HI
    count (*) for select stmt take more time than execute a that sql stmt
    executing particular select stmt take 2.47 mins but select stmt is using the /*+parallel*/ (sql optimer) in that sql  command for faster execute .
    but if i tried to find out total number of rows in that query it takes more time ..
    almost 2.30 hrs still running to find count(col)
    please help me to get count of row faster.
    thanks in advance...That may be because your client is displaying only the first few records when you are running the "SELECT *". But when you run "COUNT(*)", the whole records has to be counted.
    As already mentined please read teh FAQ to post tuning questions.

  • HOW TO FINE TUNE QUERY

    Hi,
    I am having below two queries. 2nd query is taking more time & it gives time out error. Can anybody tell how to fine tune below query. Thanks.
    1st Query.
    SELECT EKETEBELN EKETEBELP EKETETENR EKETEINDT
             EKETMENGE EKETWEMNG
             INTO TABLE I_EKET
             FROM EKET
             WHERE EKETMENGE <> EKETWEMNG
                                             AND
                    EKET~EINDT IN  S_EINDT.
      DESCRIBE TABLE I_EKET LINES V_ZLINES.
      IF V_ZLINES > 0.
    2nd Query.
        SELECT EKKOEBELN EKKOAEDAT EKKOLIFNR EKPOEBELP EKPO~MATNR
               EKPO~WERKS
               EKPOLOEKZ EKPOELIKZ EKPOTXZ01 EKPONETPR LFA1~NAME1
               INTO TABLE I_PODEL
               FROM EKKO
               INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
               INNER JOIN LFA1 ON EKKOLIFNR = LFA1LIFNR
               FOR ALL ENTRIES IN I_EKET
               WHERE EKKO~EBELN = I_EKET-EBELN AND
                     EKPO~EBELP = I_EKET-EBELP AND
                     EKPO~MATNR IN  S_MATNR AND
                     EKPO~WERKS IN  S_WERKS AND
                     EKPO~WERKS NE 'W001'   AND
                     EKKO~EKORG = P_EKORG   AND
                     EKKO~LIFNR IN S_LIFNR  AND
                     EKKO~LOEKZ NE 'X'      AND
                     EKPO~LOEKZ NE 'S'      AND
                     EKPO~ELIKZ NE 'X'      AND
                     EKPO~LOEKZ NE 'L'      AND
                     EKKO~AEDAT IN  S_AEDAT.
      ELSE.
        WRITE 'No POs found for the selection criteria!'.
      ENDIF.

    Not the right forum to ask this question.
    VJ

  • How do you fine tune an effect in Captivate 6

    I'm trying to scale and move a video using the effects timeline and I want it to wind up in an exact location on the stage. Is there any way to fine tune it by entering in exact coordinates rather than by bouncing back & forth between Live Preview and Edit View? I'm used to being able to entering in exact numbers when tweening an object in Flash and this seems like a pretty bad way of moving things around on the screen. Am I missing something here?
    Thanks

    As a temporary workaround, this is my work flow:
    I create a 'crosshair' in the exact location, using two line shapes that can be positioned exactly using the Transform accordion.
    The motion path end points have a circle that you'll have to drag over the crosshair. Motion paths use the center point of an object, contrary to resizing, moving that is from the upper left corner of the bounding box. I used the described work flow in the first movie here: http://blog.lilybiri.com/reset-effects
    Lilybiri

  • Will pay Spry Expert to fine tune vertical menu bar

    Hi,
    I have created a menu bar with DW CS4 for one of my web design clients, and I am running out of time to fine tune it.
    So I will pay an expert who can:
    1. Reduce the font size to small (maybe 8pt) on all items because the client has way too many items.
    2. Reduce the line height size to 4pt for the same reason.
    3. Stop submenu items from appearing on the left side of the window outside the menu bar.
    I am happy with the bg color and arial font.
    You can see the bar at: http://faithandfamilynutrition.com/
    Please let me know if you can do this job and how much you would charge.
    Thanks

    Hi,
    Never mind. Trial and error, figured it out using the CSS menu that came up when I clicked different sections of the widget.
    Thanks anyway

  • Why can't we call procedure in sql stmt

    Hi,
    Why can't we call procedure in sql stmt?

    Assuming (as Billy mentioned) that the question refers to SELECT statements (also assuming that "stmt" is short for "statement", nice time-saving abbreviation, thanks for that), you cannot use procedures because there is no concept of a procedure in an SQL query, and possibly in declarative languages in general (computer scientists may correct me here).
    How would it work? Everything in a SELECT list has to return something - it's the whole point of a SELECT list. Procedures by definition do not have a RETURN clause (yes you can RETURN to end processing, yes there are OUT parameters, but that is not the same thing). Perhaps you could post an example of the syntax you have in mind.

Maybe you are looking for

  • I have lost my Dreamweaver MX Studio disks and serial numbers

    I have lost my Dreamweaver MX Studio disks and serial numbers and the PC on which the suite was installed was destroyed. Can I download this suite and run it on my new PC?

  • My breaking dawn album won't play. How do I fix it!?

    Everytime I try and play my breaking dawn album it skips through and won't play it !!!! Help !!!

  • Keeps asking for keychain password when i open programs

    i open safari, it asks for a password. I open almost anything and it asks for a keychain password, and i put the password i use to login to my username and it says it is wrong. I want this off, i dont want this coming up, so how do i go along doing t

  • Problem in reading mails!!

    Hi, I am using mail adapter to access my mails...i am successful in sending mails and moving folders too...but the problem is when there is a message..then i could not able to read it...if i click on that message subject..it is giving "Cannot open in

  • XML decoder on multiple objects in one file

    I am reading multiple (unknown amount) of objects from an XML file. This is my (working) code: FileInputStream fileIn = null;           try {                fileIn = new FileInputStream(fileName);           } catch (FileNotFoundException e) {