List Sql Tuning Sets

I am hoping for a quick easy answer on this. grin
We have been generating a number of Sql Tuning Sets via Grid Control and now we want to export them. Of course, they all have these awful, non-descriptive names. How do we list them? I was unable to find any help in the "automatic SQL tuning" guide (Chapter 12) of the Performance Guide, and browsing the DBA_* and other fixed views has not revealed anything, yet.

Does this help?
BANPROD_SQL > select id,name,owner,description,created from WRI$_SQLSET_DEFINITIONS order by 1 desc;
ID NAME OWNER DESCRIPTION CREATED
10 TUNING_SET_1141930799317 ORACLE Automatically generated by ADDM 09-MAR-06
9 TUNING_SET_1141921159123 ORACLE Automatically generated by ADDM 09-MAR-06
8 TUNING_SET_1141831053351 ORACLE Automatically generated by ADDM 08-MAR-06
7 TUNING_SET_1141826801391 ORACLE Automatically generated by ADDM 08-MAR-06
6 TOP_SQL_1141752418284 ORACLE Automatically generated by Top SQL 07-MAR-06
5 TOP_SQL_1141749589578 ORACLE Automatically generated by Top SQL 07-MAR-06
4 TOP_SQL_1141747575814 ORACLE Automatically generated by Top SQL 07-MAR-06
2 TOP_SQL_1141746930242 ORACLE Automatically generated by Top SQL 07-MAR-06
1 TUNING_SET_1141660362671 ORACLE Automatically generated by ADDM 06-MAR-06
9 rows selected.

Similar Messages

  • 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

  • Loading SQL Tuning Sets

    On a 10.2.0.4 database, is it possible to load SQL Tuning sets with SQL from a text file? I can't find anything in the documentation mentioning this but I could have simply missed it and this facility would be very useful to us.
    Our reporting tool is MicroStrategy which operates by building lots of temporary tables: extracting the SQL via Top Activity EM page will put the CTAS statement into the tuning set which (I believe) is ignored by SQL Access Advisor - extracting the sql to a text file, editting to remove the "create table as" and executing in order to load the tuning set is very long winded for a set of queries - at least being able to load the tuning set directly with a set of SQL select statements directly from a text file would help significantly.
    Many thanks for any advice
    Pete

    I did not see a direct way to create the STS from a text file. From the docs:
    "The standard sources for populating an STS are the workload repository, another STS, or the cursor cache"
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sql_tune.htm#i34915
    But you could try a couple of things:
    1) create one tuning task per statement, using DBMS_SQLTUNE.CREATE_TUNING_TASK, which can use plain text as input: http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sql_tune.htm#CHDJDHGE
    2) create the STS with queries from cursor cache: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sqltun.htm#i1010615
    Both approaches needs some PL/SQL programming, but it can be useful if you can identify your SQL statements some way.
    Regards.

  • ORA-13754: "SQL Tuning Set" "" does not exist for user "SYS"

    While calling dbms_stats.seed_col_usage I got the following error. Can someone help me on how to resolve it
    sqlplus
    SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 14 14:37:38 2011
    Copyright (c) 1982, 2009, Oracle. All rights reserved.
    Enter user-name: / as sysdba
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE 11.2.0.1.0 Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL> show user
    USER is "SYS"
    SQL> begin
    2 dbms_stats.seed_col_usage(null,null,400);
    3 end;
    4 /
    begin
    ERROR at line 1:
    ORA-13754: "SQL Tuning Set" "" does not exist for user "SYS".
    ORA-06512: at "SYS.DBMS_SQLTUNE_INTERNAL", line 17379
    ORA-06512: at "SYS.DBMS_STATS", line 28451
    ORA-06512: at line 2
    Thank You
    Sarayu

    According to the documentation:
    SEED_COL_USAGE ProcedureThis procedure iterates over the SQL statements in the specified SQL tuning set, compiles them and seeds column usage information for the columns that appear in these statements.
    Syntax
    DBMS_STATS.SEED_COL_USAGE (
    sqlset_name IN VARCHAR2,
    owner_name IN VARCHAR2,
    time_limit IN POSITIVE DEFAULT NULL);>
    It looks like you need to provide a SQLSET_NAME and OWNER_NAME to use this procedure correctly, to which you've provided NULLs. I don't see any exceptions in the documentation that indicate special processing when NULLs are provided.

  • Modify sql tuning set

    Hi Experts
    I have created a sql tuning set with all sqls from cursor cache referring table1. Now I have transported this sqlset to nonprod environment, now what I want to do is  make table1 partitioned and test the impact. Instead of altering table1 I want create copy of table1 as partitioned table2. Is there a way I cancl change the sqls in my sqlset to refer to table2 in place of table1. So I basically want to update the sqls with table2 instead of table1. Is this possible and if yes how? If no any other way of doing it, sqlset has ~200 sqls

    Why ever not!
    1. You create a new user with the appropriate privileges
    2. Logon as the new user and create private synonmys (if public ones do not exist) for the objects you need to use
    3. Either import a sql set or create a sqlset.
    4. Create and execute an analysis task - this will be your baseline
    5. Build test1 table as a partitioned table in the new schema - this will override the public synonym
    6. Execute an analysis task - this will be your post change run
    7. Compare results.

  • SQL tuning set for specific SQLID

    Hi,
    Is it possible to create SQL tuning set for specific SQLID's?
    Advance thanks!

    do you have any code or some package to do this?As long as those statements are in AWR or the cursor cache then you can use
    DBMS_SQLTUNE.SELECT_CURSOR_CACHE or
    DBMS_SQLTUNE.SELECT_WORKLOAD_REPOSITORY For example something like this:
    begin
      DBMS_SQLTUNE.CREATE_SQLSET(
        sqlset_name => 'my_tuning_set',
        description  => 'my tuning set');
    end;
    DECLARE
    baseline_cursor DBMS_SQLTUNE.SQLSET_CURSOR;
    BEGIN
    OPEN baseline_cursor FOR
          SELECT VALUE(p)
          FROM   TABLE(DBMS_SQLTUNE.SELECT_CURSOR_CACHE
                 (basic_filter      => 'sql_id in (''1'',''2'',''3'')',
                  attribute_list    => 'ALL'
                  )) p;
        DBMS_SQLTUNE.LOAD_SQLSET(
                 sqlset_name     => 'my_tuning_set',
                 populate_cursor => baseline_cursor);
    END;
    /

  • RAT - SQL Tuning Set from 9i trace in wrong order

    Hi together
    I want to test the impact of some staments on 9.2.0.8 in 11g with Real Application Testing, but the order in the tuning set seems to b wrong (not in the traced order). So i made a small Test Script who is creating a Table, insert Data with a loop and select all.
    Steps :
    * 9i enable trace level 4
    * 9i run the script
    * 9i stop the trace
    * transfer to 11g
    * make an sql tunnig set
    * running in the Performance Analyzer Workflow
    The first run Oracle makes performance datas from the trace files. In the second run I want to execute the statements from the tuning set in the 11g database. The traced Schema from 9i exists.
    In the report after the second run I see the failure that the insert and select statement is not allowed. When i take a look in the SQL Tuning Set i see that the select and insert will be played before the create table ! Also on the view DBA_SQLSET_STATEMENTS.
    Is there a way to get the correct order in the SQL Tuning Set like the statement order (create before insert,select) ? Or can Oracle not handle DDL-Statements in the trace ?
    Regards Martin

    Hi together
    I want to test the impact of some staments on 9.2.0.8 in 11g with Real Application Testing, but the order in the tuning set seems to b wrong (not in the traced order). So i made a small Test Script who is creating a Table, insert Data with a loop and select all.
    Steps :
    * 9i enable trace level 4
    * 9i run the script
    * 9i stop the trace
    * transfer to 11g
    * make an sql tunnig set
    * running in the Performance Analyzer Workflow
    The first run Oracle makes performance datas from the trace files. In the second run I want to execute the statements from the tuning set in the 11g database. The traced Schema from 9i exists.
    In the report after the second run I see the failure that the insert and select statement is not allowed. When i take a look in the SQL Tuning Set i see that the select and insert will be played before the create table ! Also on the view DBA_SQLSET_STATEMENTS.
    Is there a way to get the correct order in the SQL Tuning Set like the statement order (create before insert,select) ? Or can Oracle not handle DDL-Statements in the trace ?
    Regards Martin

  • Sql tuning set explain plan

    A hypothetical question came up between dbas in the office.   We regularly take tuning sets before making significant changes on the DB.  Populate from cache.  Great little way of checking to see if anything changed.  Someone asked if a table T1 was accessed during a given day where we had a tuning set being populated from the cache (no reason for auditing to be on at the time).  Well first thing to do is search the sql_statements
    select * from DBA_SQLSET_STATEMENTS
    where sqlset_name = 'my_sts'
    and sql_text like '%select * from t1%'
    but no rows returned, so next idea is to query the plan in case a synonym was used
    select * from DBA_SQLSET_PLANS
    where sqlset_name = 'my_sts'
    and object_name = 'T1'
    And yes, its there we had a select against the table, the main sql_text in the dba_sqlset_statments view was using a synonym.  great, so now we might be able to use this as a alternative audit method (mmv depending on whether you have the diag pack). 
    Heres the question, can we always be guaranteed an object will be in a plan?

    Dom Brooks wrote:
    Also, the presence of a SQL statement in the shared pool does not indicate it was run today - you'd need to check the relevant column, something like last_active_time.
    More importantly, the absence of a SQL statement from the shared pool does not indicate that it was not run today.
    Just that it's no longer in the shared pool.
    I'm concious of that when running the populate,  even in a busy period our pools last over an hour,  with that in mind when Im populating my tuning set, I set the frequency to 10 minutes to poll the cache where distinct IDs and HASHes are overloaded in the tuning set if theyre already there. 
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_sqltun.htm#CACJHDDC
    Note that in production systems the time limit and repeat interval would be set much higher. You should tune the time_limit and repeat_interval parameters based on the workload time and cursor cache turnover properties of your system.

  • Additional licenses reuired for using Sql Tuning Advisor In SQL Developer 4.0.3

    Hi,
    We have Oracle Database 11g Enterprise Edition Release 11.2.0.3.0. Do we need to purchase an additional oracle license for using SQL Tuning Advisor Option in SQL Developer 4.0.3 

    We have Oracle Database 11g Enterprise Edition Release 11.2.0.3.0. Do we need to purchase an additional oracle license for using SQL Tuning Advisor Option in SQL Developer 4.0.3 
    The Oracle Tuning Pack is DATABASE functionality - it is part of the database. Sql Developer just uses it.
    Yes - to use ANY of the features of the tuning pack requires an extra cost license.
    http://docs.oracle.com/cd/B28359_01/license.111/b28287/options.htm#CIHFIHFG
    Oracle Tuning Pack
    The Oracle Tuning Pack provides database administrators with expert performance management for the Oracle environment, including SQL tuning and storage optimizations. The Oracle Diagnostic Pack is a prerequisite product to the Oracle Tuning Pack. Therefore, to use the Tuning Pack, you must also have a Diagnostic Pack.
    The Tuning Pack includes the following features:
      SQL Access Advisor
      SQL Tuning Advisor
      Automatic SQL Tuning
      SQL Tuning Sets
      SQL Monitoring
      Reorganize objects
    In order to use the features listed above, you must purchase licenses for the Tuning Pack, with one exception: SQL Tuning Sets can be used if you have licensed either the Tuning Pack or Oracle Real Application Testing. A new initialization parameter, CONTROL_MANAGEMENT_PACK_ACCESS, is introduced to control access to the Diagnostic Pack and Tuning Pack in the database server. This parameter can be set to one of three values:
      DIAGNOSTIC+TUNING: Diagnostic Pack and Tuning Pack functionally is enabled in the database server.
      DIAGNOSTIC: Only Diagnostic Pack functionality is enabled in the server.
      NONE: Diagnostic Pack and Tuning pack functionally is disabled in the database server.
    The Tuning Pack functionality can be accessed by the Enterprise Manager links as well as through the database server command-line APIs. The use of either interface requires licensing of the Tuning Pack

  • SQL Tuning Advisor on a specific SQL statement

    Hi all,
    How can I used SQL Tuning Advisor in Oracle EM Database Control to tune a specific SQL statement; i.e. the statement is not any of: Top SQL, SQL Tuning Sets, Snapshots Preserved Snapshot Sets.
    Thanks in advance,
    Ahmed B.

    Hi,
    You can use either the automatic SQL tuning features that are accessible from Enterprise Manager Database Console on the "Advisor Central" page or trough SQL*PLUS using the DBMS_SQLTUNE pakage:
    -- creating the tuning task
    set serveroutput on
    declare
      l_sql_tune_task_id  varchar2(100);
    begin
      l_sql_tune_task_id := dbms_sqltune.create_tuning_task (
                              sql_id      => '<your_sql_id>',
                              scope       => dbms_sqltune.scope_comprehensive,
                              time_limit  => 60,
                              task_name   => '<your_tuning_task_name>',
                              description => 'tuning task for statement your_sql_id.');
      dbms_output.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id);
    end;
    -- executing the tuning task
    exec dbms_sqltune.execute_tuning_task(task_name => '<your_tuning_task_name>');
    -- displaying the recommendations
    set long 100000;
    set longchunksize 1000
    set pagesize 10000
    set linesize 100
    select dbms_sqltune.report_tuning_task('<your_tuning_task_name>') as recommendations from dual;For more information, take a look at link provided by Jaffy.
    Cheers
    Legatti

  • I could not set Automatic SQL Tuning enabled

    Hi experts,
    I execute below command by sys user.
    BEGIN
    dbms_auto_task_admin.enable(client_name => 'sql tuning advisor', operation => NULL, window_name => NULL);
    END;
    It occur error:
    ORA-15604: Initialization parameters prevent client from being enabled.
    ORA-06512: at "SYS.DBMS_AUTO_TASK_ADMIN", line 23
    ORA-06512: at "SYS.DBMS_AUTO_TASK_ADMIN", line 122
    Thanks!
    Joseph.

    Hi P. Forstmann ,
    Yes , I have the license.
    SQL> show parameter control_m
    NAME TYPE VALUE
    control_management_pack_access string DIAGNOSTIC+TUNING
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE 11.2.0.2.0 Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    Rds,Joseph.

  • What should be take action against following sql tuning report.

    Hi
    what should be take action against following sql tuning report.
    SQL ID : fn3mt5dvm7fba
    SQL Text : SELECT * FROM (select
         to_number(ow.waybl_no) waybl_no,ow.id wb_id,
         To_Number(ogp.gp_no) gp_no,
         To_Number(ots.trip_sht_no) trip_sht_no,
         otr.nm,
         ots.gty_br_mast_id,
         DECODE(otr.sign_recd,'1','YES','NO') Sign_Recd,
         DECODE(otr.stamped,'1','YES','NO') Stamped,
         otr.dlvry_dt dlvry_dt,
         otr.tel_no,
         --otr.remarks,                                                   
         Decode(otr.comments, NULL,'','Yes') remarks,
         otr.id ID,ops_safex_utl.get_br_nm(to_number(ow.bkg_br_mast_id))
    book_br,
         ow.pick_dt book_date
    from
         ops_ts_reconsile otr,
         ops_pultd_wb_dtls opuwd,
         ops_trip_sht ots,
         ops_waybl ow,
         ops_ultd_wb_dtls ouwd,
         ops_gate_pass ogp
    where
         otr.trip_sht_id=ots.id and
         otr.pultd_wb_dtls_id=opuwd.id and
         opuwd.ultd_wb_dtls_id=ouwd.id and
         ouwd.gate_pass_id=ogp.id and
         opuwd.waybl_id=ow.id and
         otr.status_lid=157 and
         ots.gty_br_mast_id = (:br_Id) and
         (otr.dlvry_dt = :searchDate OR :searchDate IS NULL) and
         otr.note_prpd = 'N' and otr.pod_recd = '1' and
         not exists (select TS_RECONSILE_ID from OPS_POD_FRWD_NOTE_DTLS
    where TS_RECONSILE_ID = otr.id)
    union
    select
         to_number(ow.waybl_no) waybl_no, ow.id wb_id,
         To_Number(ogp.gp_no) gp_no,
         null trip_sht_no,
         ogr.nm,
         ogp.dlvry_br_mast_id,
         DECODE(ogr.sign_recd,'Y','YES','NO') Sign_Recd,
         DECODE(ogr.stamped,'Y','YES','NO') Stamped,
         ogr.dlvry_dt dlvry_dt,
         ogr.tel_no,
         --ogr.remarks,                                                   
         Decode(ogr.comments, NULL,'', 'Yes') remarks,
         ogr.id ID,ops_safex_utl.get_br_nm(to_number(ow.bkg_br_mast_id))
    book_br,
         ow.pick_dt book_date
    from
         ops_gp_reconcile ogr,
         ops_gate_pass ogp,
         ops_waybl ow
    where
         ogr.gp_id=ogp.id and
         ogp.waybl_id=ow.id and
         ogp.dlvry_br_mast_id = (:br_Id) and
         (ogr.dlvry_dt = :searchDate) and
         ogr.note_prpd = 'N' and ogr.pod_recd = 'Y' and
         not exists (select GP_RECONSILE_ID from OPS_POD_FRWD_NOTE_DTLS
    where GP_RECONSILE_ID = ogr.id)) QRSLT ORDER BY trip_sht_no desc
    Bind Variables :
    1 - (VARCHAR2(32)):37069
    2 - (DATE):07/11/2011 00:00:00
    3 - (DATE):07/11/2011 00:00:00
    4 - (VARCHAR2(32)):37069
    5 - (DATE):07/11/2011 00:00:00
    FINDINGS SECTION (3 findings)
    1- SQL Profile Finding (see explain plans section below)
    2 potentially better execution plans were found for this statement. Choose
    one of the following SQL profiles to implement.
    Recommendation (estimated benefit<=10%)
    - Consider accepting the recommended SQL profile.
    execute dbms_sqltune.accept_sql_profile(task_name => 'TASK_58643',
    task_owner => 'SYS', replace => TRUE);
    Recommendation (estimated benefit: 99.15%)
    - Consider accepting the recommended SQL profile to use parallel execution
    for this statement.
    execute dbms_sqltune.accept_sql_profile(task_name => 'TASK_58643',
    task_owner => 'SYS', replace => TRUE, profile_type =>DBMS_SQLTUNE.PX_PROFILE);
    Executing this query parallel with DOP 128 will improve its response time
    99.11% over the SQL profile plan. However, there is some cost in enabling
    parallel execution. It will increase the statement's resource consumption by
    an estimated 14.56% which may result in a reduction of system throughput.
    Also, because these resources are consumed over a much smaller duration, the
    response time of concurrent statements might be negatively impacted if
    sufficient hardware capacity is not available.
    The following data shows some sampled statistics for this SQL from the past
    week and projected weekly values when parallel execution is enabled.
    Past week sampled statistics for this SQL
    Number of executions 17494
    Percent of total activity 7.2
    Percent of samples with #Active Sessions > 2*CPU .63
    Weekly DB time (in sec) 614696.04
    Projected statistics with Parallel Execution
    Weekly DB time (in sec) 704166.9
    2- Restructure SQL finding (see plan 1 in explain plans section)
    An expensive "UNION" operation was found at line ID 4 of the execution plan.
    Recommendation
    - Consider using "UNION ALL" instead of "UNION", if duplicates are allowed
    or uniqueness is guaranteed.
    3- Alternative Plan Finding
    Some alternative execution plans for this statement were found by searching
    the system's real-time and historical performance data.
    The following table lists these plans ranked by their average elapsed time.
    See section "ALTERNATIVE PLANS SECTION" for detailed information on each
    plan.
    id plan hash last seen elapsed (s) origin note
    1 209247904 2011-07-12/10:09:08 7.564 Cursor Cache
    2 4029269565 2011-07-12/10:20:21 15.374 Cursor Cache original plan
    3 4128886984 2011-07-08/11:30:25 42.426 AWR
    4 3695555639 2011-07-12/08:30:30 101.459 AWR
    Recommendation
    - Consider creating a SQL plan baseline for the plan with the best average
    elapsed time.
    execute dbms_sqltune.create_sql_plan_baseline(task_name => 'TASK_58643',
    owner_name => 'SYS', plan_hash_value => 209247904);
    ADDITIONAL INFORMATION SECTION
    - The optimizer could not merge the view at line ID 3 of the execution plan.
    The optimizer cannot merge a view that contains a set operator.
    - SQL Profile "SYS_SQLPROF_01306b26f6aa0000" exists for this statement and
    was ignored during the tuning process.

    afzal wrote:
    Hi
    what should be take action against following sql tuning report.
    <snip>Perhaps no action at all.
    You can ALWAYS produce a report that will show "top 5" issues. The question is NOT "do I have an issue reported by a tuning report". Yes you do. Everyone does. Always. Even if you slowest batch job runs in 1.3 seconds and your slowest OLTP transaction completes in 0.0001 second.
    The question is "do I have a problem that is serious enough to spend time solving?"
    If your average OLTP transaction completes in 3 seconds, how much effort is justified to get a 50% improvement?
    How much effort is justified to get that same 50% improvement on transactions that complete in 1.5 seconds? 0.2 seconds?
    Beware of Compulsive Tuning Disorder.

  • Need help to debug SQL Tuning Advisor Error Message

    Hi,
    I am getting an error message while try to get recommendations from the SQL Tuning Advisor.
    Environment:
    Oracle Version:  11.2.0.3.0
    O/S: AIX
    Following is my code:
    declare
    my_task_name  varchar2 (30);
    my_sqltext    clob;
    begin
    my_sqltext := 'SELECT DISTINCT MRKT_AREA AS DIVISION, PROMO_ID,
                    PROMO_CODE,
                    RBR_DTL_TYPE.PERF_DETL_TYP, 
                    RBR_DTL_TYPE.PERF_DETL_DESC,
                    RBR_DTL_TYPE.PERF_DETL_SUB_TYP,
                    RBR_DTL_TYPE.PERF_DETL_SUB_DESC,
                    BU_SYS_ITM_NUM,
                    RBR_CPN_LOC_ITEM_ARCHIVE.CLI_SYS_ITM_DESC,
                    PROMO_START_DATE,
                    PROMO_END_DATE,
                    PROMO_VALUE2,
                    PROMO_VALUE1,
                    EXEC_COMMENTS,
                    PAGE_NUM,
                    BLOCK_NUM,
                    AD_PLACEMENT,
                    BUYER_CODE,
                    RBR_CPN_LOC_ITEM_ARCHIVE.CLI_STAT_TYP,
                    RBR_MASTER_CAL_ARCHIVE.STATUS_FLAG
    FROM  (PROMO_REPT_OWNER.RBR_CPN_LOC_ITEM_ARCHIVE
    INNER JOIN PROMO_REPT_OWNER.RBR_MASTER_CAL_ARCHIVE
    ON (RBR_CPN_LOC_ITEM_ARCHIVE.CLI_PROMO_ID = PROMO_ID)
    AND (RBR_CPN_LOC_ITEM_ARCHIVE.CLI_PERF_DTL_ID = PERF_DETAIL_ID)
    AND (RBR_CPN_LOC_ITEM_ARCHIVE.CLI_STR_NBR = STORE_ZONE)
    AND (RBR_CPN_LOC_ITEM_ARCHIVE.CLI_ITM_ID = ITM_ID))
    INNER JOIN PROMO_REPT_OWNER.RBR_DTL_TYPE
    ON (RBR_MASTER_CAL_ARCHIVE.PERF_DETL_TYP = RBR_DTL_TYPE.PERF_DETL_TYP)
    AND (RBR_MASTER_CAL_ARCHIVE.PERF_DETL_SUB_TYP = RBR_DTL_TYPE.PERF_DETL_SUB_TYP)
    WHERE ( ((MRKT_AREA)=40)
    AND ((RBR_DTL_TYPE.PERF_DETL_TYP)=1)
    AND ((RBR_DTL_TYPE.PERF_DETL_SUB_TYP)=1) )
    AND ((CLI_STAT_TYP)=1 Or (CLI_STAT_TYP)=6)
    AND ((RBR_MASTER_CAL_ARCHIVE.STATUS_FLAG)=''A'')
    AND ( ((PROMO_START_DATE) >= to_date(''2011-10-20'', ''YYYY-MM-DD'')
    And (PROMO_END_DATE) <= to_date(''2011-10-26'', ''YYYY-MM-DD'')) )
    ORDER BY MRKT_AREA';
    my_task_name := dbms_sqltune.create_tuning_task
                                 (sql_text => my_sqltext,
                                  user_name => 'PROMO_REPT_OWNER',
                                  scope     => 'COMPREHENSIVE',
                                  time_limit => 3600,
                                  task_name  => 'Test_Query',
                                  description  => 'Test Query');
    end;
    begin
      dbms_sqltune.execute_tuning_task(task_name => 'Test_Query');
    end;
    set serveroutput on size unlimited;
    set pagesize 5000
    set linesize 130
    set long 50000
    set longchunksize 500000
    SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK('Test_Query') FROM DUAL;
    Output:
    snippet .....
    FINDINGS SECTION (1 finding)
    1- Index Finding (see explain plans section below)
    The execution plan of this statement can be improved by creating one or more
    indices.
    Recommendation (estimated benefit: 71.48%)
    - Consider running the Access Advisor to improve the physical schema design
    or creating the recommended index.
    Error: Cannot fetch actions for recommendation: INDEX
    Error: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    Rationale
    Creating the recommended indices significantly improves the execution plan
    of this statement. However, it might be preferable to run "Access Advisor"
    using a representative SQL workload as opposed to a single statement. This
    will allow to get comprehensive index recommendations which takes into
    account index maintenance overhead and additional space consumption.
    snippet
    Any ideas why I am getting ORA-06502 error?
    Thanks in advance
    Rogers

    Bug 14407401 - ORA-6502 from index recommendation section of DBMS_SQLTUNE output (Doc ID 14407401.8)
    Fixed:
    The fix for 14407401 is first included in
    12.1.0.1 (Base Release)

  • OraOLEDB not appearing as an option in the 'Providers' list SQL Server 2008

    Hi there,
    I'm trying to create a linked server to an Oracle 10g database from SQL Server 2008 R2, but the required OraOLEDB.oracle driver is not appearing in the list of providers. We are trying to recreate our prod environment where we use the 11g client to connect to the 10g db, so I downloaded the installed the 11gClient ODADC (11.1.0.7). I have the Oracle folder in my 'Start' menu (Windows 2008 O/S), and it looks like the Oracle install was successful but in the registry (regedit) I don't see Oracle listed as 'software' in the local_machine/software listing.
    I set my Oracle home to C:\Oracle and the path under there is
    product\11.1.0\client_1
    I've also read in some other posts that I should have both a 32 bit and 64 bit Oracle driver installed - I'm assuming that 11g is 64-bit and 9i is 32 bit?
    Should I be able to install just the client or do I need to install the Server as well?
    Any suggestions?
    Thanks in advance for...

    I figured this out - we didn't have the 64-bit version of the driver.

  • SQL tuning for a query

    Hello Gurus,
    I have 2 tables. One with a million records and the other with 50,000 records.
    Both have an account id column. The first table contains all the customer accounts and the second table has all the bad debt accounts.
    My problem is I need to update the status column in the first table for all the bad debt records from the second table.
    As I’m still a beginner in SQL tuning, can someone please help me write this query effi ciently considering the table sizes.
    tables description:
    SQL> desc customer
    Name Null? Type
    ACNTNO NUMBER(8)
    STATUS VARCHAR2(6)
    SQL> desc badcustomer
    Name Null? Type
    ACNTNO NUMBER(8)
    The sql I could come up with is:
    update customer outer
    set status='closed'
    where acntno exists (select 'X'
    from badcustomer
    where acntno=outer.acntno);
    Thanks for taking time to read this post.

    To post formatted code, put the {noformat} {noformat}- tag before and after your examples.
    When you post:
    {noformat} select *
    from dual;
    {noformat}
    it will appear as: select *
    from dual;
    on the forum.
    The FAQ will tell you more: http://forums.oracle.com/forums/help.jspa                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • Can I find out who is connected to my Personal Hotspot?

    I have turned my Personal Hotspot on. It says that there are 5 connections, yet only 4 people are actually using it. Just interested to see if someone hacked in, or if I'm just a tool

  • Missing messages: Selection completed

    Hi We are extracting data from R/3 to BW using custom extractor which is used function module.  Data is coming to BW and we could see same number of records as R/3 in PSA .The problem is in the detail tab of RSMO under extraction missing messages “Mi

  • My SRW2048 needs to be exercised.

    I manage a network that consists of three buildings with fiber running between each building. In the main building, I have a hub with 3 Linksys SRW2048 48-port switches and a secondary hub with 2 SRW2048's. The other two buildings each have one SRW20

  • Exceeded session limit on CPU usage

    Hi All, We are getting message while generating some reports. Pl. see the Error Text below for message. For time being we have  bumped the session limit to unlimited to take care of this problem for now. But the question is u201CIs there a way availa

  • Creative Cloud PsCC and Lr5

    I upgraded from PCS6 to IllustratorCC, InDesignCC, Adobe Photoshop CC, and Lightroom 5 today. Then I uninstalled the previous versions of them. Everything is fine with Ai and Id however Lr is requiring a serial number for access and Ps has no shortcu