Oracle 10g sql tuning

I am on Oracle 10.2.0.3 on Windows 2003.
I have a third party package whose code cannot be modified. There are several queries written using NOT clauses, as a result Oracle does full table scan and hash joins.
select * from svp_view_s where NOT a_webc_url like '%dm_sig_source%.pdf' and
r_object_id in (Select parent_id from svp_view_l where child_id='098c4230800d7dd7' and NOT
a_webc_url like '%dm_sig_source%.pdf');
Is there a way to force it in a generic fashion to use indexes instead of explicitly adding hints to use specific indexes. Oracle many times ignores the hints. Also I do not have access to code, so somehow has to figure out how to use stored outlines.
There are many queries. I was looking at some generic solution.
Prem

Look into whether you can use the DBMS_ADVANCED_REWRITE built-in package.
http://www.psoug.org/reference/dbms_adv_rewrite.html

Similar Messages

  • Oracle 10g SQL Tuning Advisor

    I am working as a junior DBA. I tried to tune a query using SQL Tuning Advisor that is with DBMS_SQLTUNE.I have created the tuning task successfully with DBMS_SQLTUNE.create_tuning_task.But when i execute the tuning task with EXEC DBMS_SQLTUNE.execute_tuning_task() i got an error like
    SQL> EXEC DBMS_SQLTUNE.execute_tuning_task(task_name => 'rep_three');
    BEGIN DBMS_SQLTUNE.execute_tuning_task(task_name => 'rep_three'); END;
    ERROR at line 1:
    ORA-00081: address range [0x60000000000A7D70, 0x60000000000A7D74) is not
    readable
    ORA-00600: internal error code, arguments: [kesatmGetSqlStats:optCost], [], [],
    ORA-06512: at "SYS.PRVT_ADVISOR", line 1624
    ORA-06512: at "SYS.DBMS_ADVISOR", line 186
    ORA-06512: at "SYS.DBMS_SQLTUNE", line 1008
    ORA-06512: at line 1The oracle version is Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi. The OS is HP-UX. The version is HP-UX B.11.23 U ia64.
    I tried to execute DBMS_SQLTUNE as DWH user.I have granted the advisor,DROP ANY SQL PROFILE,ALTER ANY SQL PROFILE,CREATE ANY SQL PROFILE privileges and DBA roles to the DWH user. The way i ran DBMS_SQLTUNE is, first i logged in as DWH user and i tried to execute the query for getting the SQL_ID for the query. For getting the SQL_ID i selected the SQL_ID column value for the DWH user session from v$session.I kept that query executing and meanwhile i opened another session as DWH user and created the tuning task as follows
    DECLARE
      l_sql_tune_task_id  VARCHAR2(100);
    BEGIN
      l_sql_tune_task_id := DBMS_SQLTUNE.create_tuning_task (
                              sql_id      => 'b65fj39dkkb9v',
                              scope       => DBMS_SQLTUNE.scope_limited,
                              time_limit  => 3600,
                              task_name   => 'rep_three',
                              description => 'Report Tuning');
      DBMS_OUTPUT.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id);
    END;
    /The creation of tuning task was successful.And i executed the tuning task as follows
    EXEC DBMS_SQLTUNE.execute_tuning_task(task_name => 'rep_three');The above mentioned errors came when i executed the tuning task.
    I am also adding the query which i have tried to tune
    select * from dwh.beneficiary_dim BEN_DIM,
                     (Select adr_dp_id,
                   adr_account_no,
                   ADR_ADDRESS_LINE_1 || ' ' ||
                   ADR_ADDRESS_LINE_2 || ' ' ||
                   ADR_ADDRESS_LINE_3 || ' ' ||
                   ADR_ADDRESS_LINE_4 as ADDRESS,
                   adr_pin_code,adr_phone_no,adr_fax_no
              from dwh.beneficiary_address_dim where adr_type_id = 1) PERMANENT_ADD_DIM,
           (Select adr_dp_id,
                   adr_account_no,
                   ADR_ADDRESS_LINE_1 || ' ' ||
                   ADR_ADDRESS_LINE_2 || ' ' ||
                   ADR_ADDRESS_LINE_3 || ' ' ||
                   ADR_ADDRESS_LINE_4 as ADDRESS,
                   adr_pin_code,adr_phone_no,adr_fax_no
              from dwh.beneficiary_address_dim where adr_type_id = 2) BANK_ADD_DIM,
           (Select adr_dp_id,
                   adr_account_no,
                   ADR_ADDRESS_LINE_1 || ' ' ||
                   ADR_ADDRESS_LINE_2 || ' ' ||
                   ADR_ADDRESS_LINE_3 || ' ' ||
                   ADR_ADDRESS_LINE_4 as ADDRESS,
                   adr_pin_code,adr_phone_no,adr_fax_no
              from dwh.beneficiary_address_dim where adr_type_id = 3) NOM_GUARDIAN_ADD_DIM,
           (Select adr_dp_id,
                   adr_account_no,
                   ADR_ADDRESS_LINE_1 || ' ' ||
                   ADR_ADDRESS_LINE_2 || ' ' ||
                   ADR_ADDRESS_LINE_3 || ' ' ||
                   ADR_ADDRESS_LINE_4 as ADDRESS,
                   adr_pin_code,adr_phone_no,adr_fax_no
              from dwh.beneficiary_address_dim where adr_type_id = 4) CORR_ADD_DIM,
           (Select adr_dp_id,
                   adr_account_no,
                   ADR_ADDRESS_LINE_1 || ' ' ||
                   ADR_ADDRESS_LINE_2 || ' ' ||
                   ADR_ADDRESS_LINE_3 || ' ' ||
                   ADR_ADDRESS_LINE_4 as ADDRESS,
                   adr_pin_code,adr_phone_no,adr_fax_no
              from dwh.beneficiary_address_dim where adr_type_id = 6) MINOR_ADDRESS,
                     (Select rp.requestid as requestid,
    decode(rp.value,'ALL','ALL','','ALL',decode(substr(rp.value,1,instr(rp.value,'|',1,1)-1),'','ALL',substr(rp.value,1,instr(rp.value,'|',1,1)-1))) as Name,
    decode(rp.value,'ALL','ALL','','ALL',decode(substr(rp.value,(instr(rp.value,'|',1,1)+1),((instr(rp.value,'|',1,2))-(instr(rp.value,'|',1,1)+1))),'','ALL',substr(rp.value,(instr(rp.value,'|',1,1)+1),((instr(rp.value,'|',1,2))-(instr(rp.value,'|',1,1)+1))))) as Address,
    decode(rp.value,'ALL','ALL','','ALL',decode(substr(rp.value,(instr(rp.value,'|',1,2)+1)),'','ALL',substr(rp.value,(instr(rp.value,'|',1,2)+1)))) as PAN
                      from disadmin.requestparameters rp, disadmin.requestparameters rps, disadmin.reportrequests rr
                     where rp.parameterid = 'CNAS_PARAM_VALUE'   
                       and rr.status = 'A'
                       and rp.requestid = rr.id
                       and rp.id = rps.id) P_PARAM_VALUE,
                     (Select rp.requestid as requestid, rp.value as Type
                        from disadmin.requestparameters rp, disadmin.reportrequests rr
                       where rp.parameterid = 'CNAS_NAME_TYPE'
                         and rr.status = 'A'
                         and rp.requestid = rr.id)  P_NAME_TYPE,
                     (Select rp.requestid as requestid, rp.value as Addtype
                        from disadmin.requestparameters rp, disadmin.reportrequests rr
                       where rp.parameterid = 'CNAS_ADDRESS_TYPE'
                         and rr.status = 'A'
                         and rp.requestid = rr.id) P_ADDRESS_TYPE    
       where ( 1= case when P_NAME_TYPE.Type = 'F' then
                   case when BEN_DIM.BDM_FIRST_HOLDER_NAME like DECODE(P_PARAM_VALUE.Name,'ALL','%'||BEN_DIM.BDM_FIRST_HOLDER_NAME||'%','%'||P_PARAM_VALUE.Name||'%')
                             or BEN_DIM.BDM_FIRST_HOLDER_SURNAME like DECODE(P_PARAM_VALUE.Name,'ALL','%'||BEN_DIM.BDM_FIRST_HOLDER_SURNAME||'%','%'||P_PARAM_VALUE.Name||'%')
                        then 1
                   else null end
                 else            
                   case when P_NAME_TYPE.Type = 'ALL' then
                     case when (BEN_DIM.BDM_FIRST_HOLDER_NAME like DECODE(P_PARAM_VALUE.Name,'ALL','%'||BEN_DIM.BDM_FIRST_HOLDER_NAME||'%','%'||P_PARAM_VALUE.Name||'%')
                                or BEN_DIM.BDM_FIRST_HOLDER_SURNAME like DECODE(P_PARAM_VALUE.Name,'ALL','%'||BEN_DIM.BDM_FIRST_HOLDER_SURNAME||'%','%'||P_PARAM_VALUE.Name||'%'))
                                and BEN_DIM.BDM_SECOND_HOLDER_NAME like DECODE(P_PARAM_VALUE.Name,'ALL','%'||BEN_DIM.BDM_SECOND_HOLDER_NAME||'%','%'||P_PARAM_VALUE.Name||'%')
                                and BEN_DIM.BDM_THIRD_HOLDER_NAME like DECODE(P_PARAM_VALUE.Name,'ALL','%'||BEN_DIM.BDM_THIRD_HOLDER_NAME||'%','%'||P_PARAM_VALUE.Name||'%')
                          then 1
                     else null end
                   else null end 
                 end )                    
         and BEN_DIM.BDM_IT_PAN like DECODE(P_PARAM_VALUE.PAN,'ALL','%'||BEN_DIM.BDM_IT_PAN||'%','%'||P_PARAM_VALUE.PAN||'%')
         and (1 = case when P_ADDRESS_TYPE.ADDTYPE = 1 then
                         case when instr(PERMANENT_ADD_DIM.ADDRESS, DECODE(P_PARAM_VALUE.ADDRESS,'ALL',PERMANENT_ADD_DIM.ADDRESS, P_PARAM_VALUE.ADDRESS)) <> 0
                              then 1
                         else null end
                       when P_ADDRESS_TYPE.ADDTYPE = 3 then
                         case when instr(NOM_GUARDIAN_ADD_DIM.ADDRESS, DECODE(P_PARAM_VALUE.ADDRESS,'ALL',NOM_GUARDIAN_ADD_DIM.ADDRESS, P_PARAM_VALUE.ADDRESS)) <> 0 
                           then 1
                         else null end 
                       when P_ADDRESS_TYPE.ADDTYPE = 4 then
                         case when instr(CORR_ADD_DIM.ADDRESS, DECODE(P_PARAM_VALUE.ADDRESS,'ALL',CORR_ADD_DIM.ADDRESS, P_PARAM_VALUE.ADDRESS)) <> 0 
                           then 1
                         else null end
                       when P_ADDRESS_TYPE.ADDTYPE = 6 then
                         case when instr(MINOR_ADDRESS.ADDRESS, DECODE(P_PARAM_VALUE.ADDRESS,'ALL',MINOR_ADDRESS.ADDRESS, P_PARAM_VALUE.ADDRESS)) <> 0 
                           then 1
                         else null end 
                  else null end );The above query also tries to access some tables from another user DISADMIN. Could you please help me in solving this problem while using SQL Tuning Advisor ? I am the only DBA here.

    will the rows really be updated just by using the package?Considering DMLs
    SQL> select * from test
      2  /
            NO
             1
             2
    SQL> ed
    Wrote file afiedt.buf
      1  DECLARE
      2   my_task_name VARCHAR2(30);
      3  my_sqltext   CLOB;
      4  BEGIN
      5  my_sqltext := 'insert into test values (3)';
      6  my_task_name := DBMS_SQLTUNE.CREATE_TUNING_TASK(
      7   sql_text    => my_sqltext,
      8  task_name   => 'my_sql_tuning_task');
      9* end;
    SQL> /
    PL/SQL procedure successfully completed.
    SQL> BEGIN
      2  DBMS_SQLTUNE.EXECUTE_TUNING_TASK( task_name => 'my_sql_tuning_task' );
      3  END;
      4  /
    PL/SQL procedure successfully completed.
    SQL> select * from test
      2  /
            NO
             1
             2
    SQL> SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK( 'my_sql_tuning_task')
      2    FROM DUAL;
    DBMS_SQLTUNE.REPORT_TUNING_TASK('MY_SQL_TUNING_TASK')
    GENERAL INFORMATION SECTION
    Tuning Task Name   : my_sql_tuning_task
    Tuning Task Owner  : TEST
    Scope              : COMPREHENSIVE
    Time Limit(seconds): 1800
    Completion Status  : COMPLETED
    Started at         : 03/27/2008 05:16:14
    Completed at       : 03/27/2008 05:16:16
    DBMS_SQLTUNE.REPORT_TUNING_TASK('MY_SQL_TUNING_TASK')
    Schema Name: TEST
    SQL ID     : gwkmgmyj9824t
    SQL Text   : insert into test values (3)
    There are no recommendations to improve the statement.
    -------------------------------------------------------------------------------Adith

  • Oracle 10G Performance Tuning Documents

    Hi all
    Can any one tell where can I get the oracle 10G Performance Tuning materials(PDF),Documents.
    Thanks in advance

    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14211.pdf

  • Is there any difference in Oracle 9i SQL Loader and Oracle 10g SQL Loader

    Hi
    Can anyone tell me whether is there any difference in Oracle 9i SQL Loader and Oracle 10g SQL Loader?
    I am upgrading the 9i db to 10g and wanted to run the 9i SQL Loader control files on upgraded 10g db. So please let me know is there any difference which I need to consider any modifications in the control files..
    Thank you in advance
    Adi

    answered

  • How to use Oracle 10G SQL features in OWB?

    We are using OWB repository 10.2.0.1.0 and OWB client 10.2.0.1.31. The Oracle version is 10 G (10.2.0.3.0). OWB is installed on Linux.
    Oracle 10G SQL offers
    1) Inserting Into a Table with Error Logging
    2) conditional_insert_clause, Specify the conditional_insert_clause to perform a conditional multitable insert.
    Did anyone use above features in OWB10G mapping?
    How do we use them?
    Thanks in advance.
    RI

    Hi,
    Just a thought on the multi-table insert. OWB generates multitable insert when one source is mapped to multiple targets only on the condition that after the splitter there should not be any OWB operator that can change the cardinality of the row-set coming out of the splitter (like joiners, filters, aggregators etc.)..
    Regarding the link, I was wondering where I could find a decent documentation of the shadow table and the DML Error Logging through OWB .. Thanks for the link.
    OWB error messages are basically Oracle Error Messages when you consider the code that gets deployed. Other than that VLD errors are sometimes mysterious and hard to debug.. Hope someone can give us more details on how to handle such VLD errors :)
    HTH
    -AP

  • Oracle 10g SQL

    Hi ,
    I want some information regarding Oracle 10g SQL Exam.Please provide any dumps,links,books or any other related information.
    Thanks in Advance
    Laxman

    login to otn.oracle.com to find more information on exams
    underline Steps to Become Oracle Certified_underline_
    http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=50#1
    If you are from India, below is the contact info
    Bangalore 080 41084657
    Chennai 044-66346114
    Delhi 011-46509015
    Hyderabad 040-66397157
    Kolkata 033-66162000
    Mumbai 022-67711214
    Ahemdabad 079-40024246
    Pune 020-66321002
    Thank You

  • Oracle 10g SQL Profiler Equivalent?

    As per the subject, I can monitor sessions via the web gui, but I need to see actual SQL statements that are hitting the 10g server. Is there an Oracle 10g SQL Profiler equivalent?

    XE?
    You might want to hunker down with some of the docco available at http://www.oracle.com/pls/db102/portal.portal_db?selected=1
    In particular, you could look at the 'Reference' manual (not SQL Reference, or any other ... Reference) and browse through the DBA_ and V$ views listed. The Concepts and Administration manuals are interesting as well.
    The specific views of interest include, but are not limited to, V$SQLAREA and V$SQLTEXT

  • Doc oracle 10g SQL in french

    Hi all.
    I don't know if i am allowed to make this request.
    I am lookink for a document 5pdf for example)
    about Oracle 10g SQL.
    I have some in english but i am looking for a french document.
    Any help is good.
    Thanks

    Your problem is most likely in decode - the return type in your expression will be character based on first search value ('null'), so it will be implicitly converted to character and then again implicitly converted to date by loading into date column. At some of this conversions you probably are loosing your time part. You can try instead use cast:
    SQL> desc t
    Name                                      Null?    Type
    LASTWRITTEN                                        DATE
    CREATEDON                                          DATE
    LASTUPDATEDON                                      DATE
    SQL> select * from t;
    no rows selected
    SQL> !cat t.ctl
    LOAD DATA
    INFILE *
    INTO TABLE T
    TRUNCATE
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
    LASTWRITTEN
    "decode(:LASTWRITTEN,'null',cast(Null as date),
      to_date(:LASTWRITTEN,'YYYY-MM-DD HH24:MI:SS'))",
    CREATEDON
    "decode(:CREATEDON,'null',cast(Null as date),
      to_date(:CREATEDON,'YYYY-MM-DD HH24:MI:SS'))",
    LASTUPDATEDON
    "decode(:LASTUPDATEDON,'null',cast(Null as date),
      to_date(:LASTUPDATEDON,'DD/MM/YYYY HH24:MI:SS'))"
    BEGINDATA
    2007-02-15 15:10:20,null,null
    null,2007-02-15 15:10:20,null
    null,null,15/02/2007 15:10:20
    SQL> !sqlldr userid=scott/tiger control=t.ctl log=t.log
    SQL*Loader: Release 10.2.0.3.0 - Production on Fri Feb 29 00:20:07 2008
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Commit point reached - logical record count 3
    SQL> select * from t;
    LASTWRITTEN         CREATEDON           LASTUPDATEDON
    15.02.2007 15:10:20
                        15.02.2007 15:10:20
                                            15.02.2007 15:10:20Best regards
    Maxim

  • Oracle 10g performance tuning tools

    hi,
    can anyone please suggest me any oracle database tuning tool to use for improving the performance of the database?(oracle 10g)

    Hi,
    Do you want a tuning tool that does not require the user to have in-depth Oracle knowledge? If so, try here:
    http://images.google.com/images?&q=ouija+board&um=1&ie=UTF-8&sa=N&tab=wi
    Seriously, I like to use AWR and STATSPACK reports, and there are some freeware tools to help analyze them, one that I sponsor:
    http://www.statspackanalyzer.com
    For online tools, Oracle SQL Developer is a great way to get started, as-is the Oracle performance pack:
    http://www.oracle.com/technology/products/database/sql_developer/index.html
    For third-party tuning tools, look at Confio, quite good:
    http://www.confio.com/
    Hope this helps. . .
    Don Burleson
    Oracle Press author
    Author of “Oracle Tuning: The Definitive Reference”
    http://www.dba-oracle.com/bp/s_oracle_tuning_book.htm

  • How to login in Oracle 10g SQL Plus

    I just installed Oracle 10g. I tried to login to SQL Plus by using scott and tiger to be user name and password, but it did not work. What can I do about it?
    Please help and thanks in advance!!!

    You have to configure a Net service name, and connect as
    sqlplus scott/tiger@<service_name>
    You can use the Net Configuration Assistant to do that. This is in the Oracle menu on Windows systems. On Unix/Linux you can use the netca utility.
    If you are working locally (on the server), you can also set the ORACLE_SID environment variable :
    Windows : set ORACLE_SID=<your_sid>
    Unix/Linux : ORACLE_SID=<your_sid>; export ORACLE_SID
    then connect as
    sqlplus scott/tiger

  • Oracle 10g sql error

    insert into s_t_dv_entegrasyon
    (office_code, dept_code, dv_tipi, hareket_tipi)
    select a.office_code, a.code dv_code, b.code dv_tipi ,
    c.code hareket_tipi
    from s_t_departments_alt a, s_t_dv_type b , s_t_dv_hareket_tipi c
    where c.sira &gt;= 20
    minus
    select office_Code , dept_code, dv_tipi, hareket_tipi
    from s_t_dv_entegrasyon;
    This sql code is not running to oracle 10g but ,
    running to oracle8,oracle9.
    I don't now , How I solvage this problem.

    what is the exact error?

  • Oracle 10g SQL plus username, password + Host string unkown

    Hi Friends
    I have just installed Oracle 10g in my computer. I could not use SQL plus because I dont know the exact username, password and host string to connect. Is there anybody to help me out. I am bit stressed for this.. Thanks by Hossain

    Do not reply to 5 year old posts. If you have a problem, start a post of your own, referencing the old one if necessary.
    Describe your problem explicitly, giving all relevant information.
    Please see Re: 2. How do I ask a question on the forums?

  • Login problem with Oracle 10g SQL Plus

    Hi, I just down load Oracle 10g from web site. I tried use scott and tiger for user name and password, I can't login. I tried use SYSMAN and the password I used when I installed the software, I can't login in too. Please help!!!

    This forum is for OBE specific questions only. Please post a message to one of the database forums located here:
    http://forums.oracle.com/forums/index.jsp?cat=18
    You can also check metalink or call support.

  • Oracle 10G Performance Tuning

    A colleague of mine supplied me with a tuning script to help in my performance analysis of a 10.2.0.1 Oracle database. The script is called:
    responsetimebreakdown.sql
    Apparently this was designed for 8i as it cannot find the sys.x_$ksles (session events) view or table in my Oracle 10.2.0.1 database. I receive:
    ORA-00942: table or view does not exist
    Any one know the equivalent of this object in 10G or has access to this script designed for use against a 10.2.0.1 Oracle database?
    Thanks.

    I don't know what your script does, but here's the table you're looking for. <br>
    SQL> select name from v$fixed_table where name like '%KSLES%';
    <br>
    <br>
    NAME<br>
    ------------------------------<br>
    X$KSLES<br><br>
    If you really want to tune, you should also try<br>
    SQL> @$ORACLE_HOME/rdbms/admin/awrrpt
    <br><br>
    Dave <br>
    Lehr.servehttp.com
    Message was edited by:
    DaveLehr

  • Any tool or shortcut to get SQL tuning suggestion???????

    Hi I have to tune an application and need to go throught alot many SQL their PLAN and ti tune them.
    I want to know ether is there any tool online or may be from oracle to get the tuning suggestions straighytway.my oracle version is 9206
    Can i use 10g SQL tuning advisor with 9i database????
    Thanks
    Gagan

    Hi Gagan,
    Can i use 10g SQL tuning advisor with 9i databaseNo, but you can do the same thing manually, and often do a better job:
    Tune SQL with optimizer parms:
    http://www.dba-oracle.com/t_sql_optimizer_parameters.htm
    Find missing indexes:
    1 - Search for unnecessary large-table, full-table scans
    2 - Compare consistent gets to rows returned
    http://www.dba-oracle.com/art_sql_tune.htm
    Hope this helps. . . .
    Donald K. Burleson
    Oracle Press author

Maybe you are looking for