How to set hint with SQL profile

Hi,
I need to put a leading hint into a sub-query
How can I do that ?
I tried:
dbms_sqltune.import_sql_profile
sql_text => 'select ...'
profile => sqlprof_attr(XXXXX) => I don't know what to set for XXXXX
name => my_sql_profile
force_match => true)10.2.0.4
Thanks for your help

I need to put a leading hint into a sub-query It doesn't sound like a good idea.
If you're going to hint - especially using plan stability features - then you need to hint fully otherwise you're asking for trouble.
See http://jonathanlewis.wordpress.com/2011/06/08/how-to-hint-1/
The "best" approach to this sort of generic question is to run the sql statement with the single leading hint (if that really is desirable) then extract the full set of hints from that execution (which will have a different sql id) and apply it to your original statement.
If you have a look at COE_XFR_SQL_PROFILE.SQL in Oracle Support doc id 215187.1 then that will give you a good idea of how to do it.
That script is not exactly what you want because it uses a sql profile to apply a previously generated plan for that specific sql taken out of AWR or the cursor cache, but the principle is the same.
This is using SQL Profiles as they were not originally designed - which was vehicles for statistical adjustements - but using them like stored outlines (the latter deprecated in 11.1 onwards).
SQL Profiles require the tuning pack.
You have not mentioned version but depending on that, it might be that SQL Plan Baselines are the appropriate mechanism and you can achieve something similar to that mentioned above using dbms_spm.load_plans_from_cursor_cache:
load_plans_from_cursor_cache 
(sql_id           IN VARCHAR2,   <---------- the sql id of the manually hinted sql from which to copy the plan
plan_hash_value  IN NUMBER := NULL,  <-------------- the plan in memory to copy
sql_text         IN CLOB,  <-------------------- the sql text of the sql to apply the plan above to (get via a direct look up from v$sql or dba_hist_sqltext as necesary)
fixed            IN VARCHAR2 := 'NO', 
enabled          IN VARCHAR2 := 'YES') Whichever method you use, avoid any sort of solution involving a single hint directed at a subquery.
Edited by: Dom Brooks on Nov 26, 2012 9:48 PM
reworded

Similar Messages

  • How to set registry for sql client on win...

    Hi.
    how to set registry for sql client on win fro work with Ukranine
    charset.
    I got such problem
    nls_language set to American_Ukranine.clmswin1251 on client
    this give me ukraniane char.
    but it override all my settings in initsid.ora this mean
    nls_date_format=DD-MON-YYYY
    nls_date_languages
    twhen I type select sysdate vrom dual answer is 11-jun-99, but
    not 11-(ukr month)-1999;
    What should I correct in regestry? ( i don't like to do alter
    session set..... each time I start sqlplus )
    Thank You in advice
    null

    you can create method on Application Module and to Client listener
    like
        public  Object[] getData(Number n,Date d)
    Object val[]= new Object[2];
    String sp = "{? = call get_data(?,?,?)}";
                Connection conn = null;
                CallableStatement proc = null;
                try {
                 //   conn = isConnSupplied ? userConn : ResourceManager.getConnection();
                    proc = getDBTransaction().createCallableStatement(sp,0);
                proc.registerOutParameter(1, OracleTypes.Number);
                proc.setObject(2,12);
               proc.setObject(3,dateobj);
              proc.registerOutParameter(2, OracleTypes.VARCHAR);
                proc.executeQuery();
                 int amttext= proc.getInt(1); //for return value
    String msg=proc.getString(2);//for out param
    val[0]=amttext;
    val[1]=msg;
                catch(Exception e)
                    System.out.println(e);
    return val;
    }and access this method from backing bean using following code-
                BindingContext bindingctx=BindingContext.getCurrent();
                   BindingContainer binding=bindingctx.getCurrentBindingsEntry();
                OperationBinding operationBinding1 = binding.getOperationBinding("getData");
                operationBinding1.getParamsMap().put("n",anyno);
                operationBinding1.getParamsMap().put("d",dateobj);
                operationBinding1.execute();
                String vval[] =(String[])operationBinding1.getResult();

  • How use set up with office 2011 for mac as I did keep tried put download but it's always 'update' download. I want get start set up new office 2011 for mac? please help me

    how use set up with office 2011 for mac as I did keep tried put download but it's always 'update' download. I want get start set up new office 2011 for mac? please help me

    You must be using an update CD.  You need the software that has the full version first - install that, then you can use the update one if needed. I know, cuz I made the same mistake - lol

  • How to setting the root user profile?

    It seems that I can't fine any complet manual to introduce how to setting the root user profile file which locate at /etc/profile? Who can help me find out or figure it out

    first /etc/profile is a global profile for the system
    its not only specific to root
    from here you can configure the system wide paths
    Regardless of the shell you are using, when you first log in your system generally runs the system profile file, /etc/profile. This file is generally owned by the system administrator and is readable (but not writable) by all users.
    After your system executes the system profile, it runs the user profile. The user profile is one (or more) initialization files that define your working environment. For example, if you're in the CDE environment your system checks this file (or set of files) each time you start a new terminal or window.
    refer this::
    http://www.shrubbery.net/solaris9ab/SUNWabe/ADVOSUG/p33.html
    man page here
    http://www.unix.com/man-page/OpenSolaris/4/profile/

  • How to set client within SQL statement without using another pl/sql stmt.

    I have a following select statement
    SELECT SUM (w.prior_forecasted_costs + w.prior_committed_costs)
    FROM xxsuf.job_cost_summary_table w,
    apps.pa_periods p,
    pa.pa_resources bz,
    pa.pa_resource_list_members cz,
    pa.pa_tasks dz
    WHERE w.project_id = z.project_id
    AND w.task_id = dz.task_id
    AND dz.task_number '98000'
    AND w.resource_list_member_id = cz.resource_list_member_id
    AND cz.resource_id = bz.resource_id
    AND NOT EXISTS (SELECT NULL
    FROM pa.pa_tasks zz
    WHERE zz.parent_task_id = dz.task_id)
    AND w.resource_list_member_id != 1000
    AND p.period_name = w.pa_period
    AND p.current_pa_period_flag = 'Y'
    Above select statement uses pa_periods view which only works when I set my client using "exec DBMS_Application_Info.set_client_info(83);" in Toad or SQL*Plus session.
    I was wondering how can I achieve it within select statement. so that I don't have to use another PL/SQL statement to set my client. Is there anyway to set client with my org id within above select statement ?
    Please advise.
    --Rakesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    You can simply create a function which calls dbms_application_info and use that in your sql statement as in
    SQL> create or replace function set_client_info (i_info varchar2)
       return varchar2
    as
    begin
       dbms_application_info.set_client_info (i_info);
       return i_info;
    end set_client_info;
    Function created.
    SQL> create or replace view v_emp
    as
      select * from emp where empno = to_number(sys_context('userenv','client_info'))
    View created.
    SQL> select ename from v_emp where set_client_info(7788) is not null
    ENAME    
    SCOTT    
    1 row selected.
    SQL> select ename from v_emp where set_client_info(7900) is not null
    ENAME    
    JAMES    
    1 row selected.

  • How to set encoding  with xmldom ?

    Hello !
    I have to build an xml file from a query.
    I need to have : <?xml version="1.0" encoding="ISO8859-1"?> on the first line.
    I know how to set the version --> xmldom.setVersion(doc,'1.0'); ... but I don't know how to set the encoding.
    Is there a way to set it ?
    Thanks

    No. It is not possible. Here is an extract of a document I found on metalink :
    (XML Parser for PL/SQL FAQs)
    Q: Is it possible to dynamically set the encoding in the XML document?
    A: No, you must include the proper encoding declaration in your document, as
    per the specification. You cannot use setCharset(DOMDocument) to set the
    encoding for the input of your document. SetCharset(DOMDocument) is used
    with oracle.xml.parser.v2.XMLDocument to set the correct encoding for
    printing of the document.

  • How does SAP deal with authorization profiles combination?

    Will anyone please confirm me that how authorization checking works with profiles combination in SAP? If I set two profiles for a user. In one profile, I grant auhorization object F_BKPF_BES with value 3/001. And in another profile, I grant F_BKPF_BES 1/002. Will the system reckon that the user have been granted F_BKPF_BES (1,3)/(001,002) or it will consider the two profiles separately?
    Regards
    Robbie

    > All the authorisations are loaded in the user buffer when the ID logs in...
    Yes, the reference to the authorizations are loaded, per authorization(!) for each object.
    >... and are combined to maximise the user buffer.
    Not completely. Authorizations are generated per role and per object. You cannot mix the field values of the objects in different authorizations.
    > Therefore your authorisations will be seen as if they are all combined.
    The consequence is combinations of all roles, per object. Not per field. Otherwise you could not create authorizations which permit you to display some values and change only a subset of them.
    Cheers,
    Julius

  • How to do it with SQL Loader

    All,
    I have two tables HEADER_TABLE and LINE_TABLE. Each header record can have multiple line records. I have to load data from a flat file to these tables.Flat file can have two types of records. H-Header, L-Line. It looks as follows.. Each H record can have multiple corresponding L records
    H..........
    L.......
    L......
    L......
    H.........
    L.......
    L......
    L......
    I have HEADER_ID column in HEADER_TABLE and HEADER_ID, LINE_ID columns in the LINE_TABLE.
    While loading data using SQL Loader, I need to generate HEADER_ID and LINE_ID values as follows and load them.
    H..........<HEADER_ID = 1>
    L....... <HEADER_ID = 1><LINE_ID = 1>
    L...... <HEADER_ID = 1><LINE_ID = 2>
    L...... <HEADER_ID = 1><LINE_ID = 3>
    H......... <HEADER_ID = 2>
    L....... <HEADER_ID = 2><LINE_ID = 4>
    L...... <HEADER_ID = 2><LINE_ID = 5>
    L...... <HEADER_ID = 2><LINE_ID = 6>
    Is it possible to do this with SQL LODER?
    I tried to do this with sequences. But it loaded the tables as follows.
    H..........<HEADER_ID = 1>
    L....... <HEADER_ID = 1><LINE_ID = 1>
    L...... <HEADER_ID = 1><LINE_ID = 2>
    L...... <HEADER_ID = 1><LINE_ID = 3>
    H......... <HEADER_ID = 2>
    L....... <HEADER_ID = 1><LINE_ID = 4>
    L...... <HEADER_ID = 1><LINE_ID = 5>
    L...... <HEADER_ID = 1><LINE_ID = 6>
    Thanks
    Ketha

    Morgan,
    Examples given in the link are quite generic and I have tried them. But my requirement is focused on generating header_id and line_id values as i have described. It seems that SQLLDR scans all records for a particular WHEN clause and insert them into the specified table. I think that if SQLLDR is made to read recod in the data file sequentially, this can be done.
    ANy idea of how to make SQLLDR read the records from the file sequentially?
    Thanks
    Ketha

  • How to set fetchsize of sql Query when using Database Adapter.

    Hi All,
    I am using DatabaseAdapter to connect to database and retriving huge amount of data.For improvement in the performance I want to set the "fetchsize" of sql query. I know fetchsize can be preset in Java using Jdbc 2.0 API.Please let me know how to set this value in BPEL when using DBAdapter?
    Thanks
    Chandra

    I talked to the developer of the db adapter - and he told me this feature will be available in BPEL PM 10.1.3 (which is supposed to be production later this year, and a public beta soon). If this is an emergency I would recommend going throug Oracle support and have them file an enhancement for 10.1.2.0.2
    hth clemens

  • How-To Set Up with Uverse Gateway with Airport Extreme

    I just spent hours figuring this out so I thought it would be helpful to someone. Maybe, maybe not. My goal was to get Back to My Mac turned on...but this should also be how you set up your wireless network if you have both an Airport Extreme and a Uverse Gateway.
    As I was trying to setup BTMM, I got a "double NAT" error. To use BTMM, you have to use either Time Capsule or Airport Extreme, so that NAT has to be enabled. That meant I had to figure out how to turn off U-verse's. I looked through the settings but saw nothing about it. Several hours of research--and a useless support call to AT&T--I finally figured it out. Here's the configuration you need, in brief.
    On the Airport Extreme, under Internet > Internet Connections, Connection Sharing must be set to "Share a public IP address". Then under the NAT button, Enable NAT Port Mapping Protocol must be checked.
    Now, unless you doe rest of this configuration, you will get a double DHCP error. So, in the Uverse Gateway settings, you must do this:
    1. Under Wireless, click the option to DISABLE wireless. Click Save.
    2. Under Firewall, click the option with DMZ in the name. On this page, choose your Airport Extreme (whatever you named it). Then scroll down and choose the option that says "Allow All Applications (DMZPlus Mode)". Save that configuration. DO A HARD RESET ON THE AIRPORT EXTREME. Then that should enable a single NAT protocol and BTMM will be on its way. And your wireless network will be set up properly.

    Will the above method work on a set up with a Verizon Modem to a DLink wireless router to a Time Capsule?
    I know of no reason why it would not. Whenever there is another router ahead of the Time Capsule, the Time Capsule must be configured in Briddge Mode. My network has 4 routers. The "main" router is setup to handle DHCP and NAT and the other 3 routers are setup in Bridge Mode. No problems.
    Weird thing is Air Video set up tells me I have a double NAT
    Double NAT occurs when you have two routers on a network both set up to handle DHCP and NAT services. Your Verizon "modem" may be a gateway....a combination modem/router on the same chassis. If that's the case, then every other router on the network must be confgured as a "Bridge".
    If you have the "main" router on the network setup to handle DHCP and NAT, in theory, you can have multiple other routers on the network as long as they are all setup in Bridge Mode. In Bridge Mode, DHCP and NAT are turned off, so the other routers simply pass through the network information from the main router. It's by far the easiest way to configure multiple routers without having to go into special DMZ, port mapping, etc type of configurations.

  • How to set volume with AudioServicesPlaySystemSound?

    I got playing sound with AudioServicesPlaySystemSound working, its quite simple but theres no documentation on how to set volume at all. Is it possible and how?

    Did you ever find an answer to this? I need to do the same thing.

  • How to set one custom SQL to blank

    I would like to manage the update of the objects of a given descriptor in the code of an "about to update" method (toplink event).
    At the same time I would like the default update statement does not occur any more. I was thinking about setting the update sql query in my descriptor, using workbench (custom sql section). But what should I write down here.
    Please advice,
    Chris

    This is fairly advanced; you could do it a few different ways:
    1 - Set the custom update SQL to some no-op operation, i.e. "Delete from Dual where 1 = 2".
    2 - Use a redirect UpdateObjectQuery for the descriptor's update operation.
    3 - Use a custom query subclass for the descriptor's update operation.
    i.e. something similar to,
    descriptor.getQueryManager().setUpdateQuery(new UpdateObjectQuery() {
    public void executeCommit() {
    // custom update code here.
    public void executeCommitWithChangeSet() {
    executeCommit();
    4 - Use a custom call on a descriptor's update operation.
    What are you doing instead of the update?

  • How to check if an SQL profile is being used or not?

    Hi,
    We have a couple of SQL profiles and outlines in the database. There has been a couple of code changes and it is now difficult to keep track if an SQL profile or an Outline is still being used? Is there any way to find that?
    Thanks in advance

    Find the entry corresponding to the SQL statement you are reviewing in V$SQL. Look at OUTLINE_CATEGORY and SQL_PROFILE columns. NULL indicates that no Outline/Profile was used.

  • How to set  dbURL with characterEncoding

    hi all,
    How can I add characterEncoding in my JDBC connection, do I need to do that inorder to insert and display Chiness character into mysql db?
    Thank you!

    Hi,
    BTITLE works a lot like TTITLE. See your other thread:
    how to set page number & current date in sqlplus result
    It's not considered nice to post (essentially) the same question more than once.
    If it happens by accident (which is easy to do on this site) then mark one of the duplicate threads as "Answered" right away.

  • WLC 5508- how to setting up with Web auth with 2 profile

    Hi Guys,
    I wanted to control the 2 different profile to access internet with Cisco default landing page is that possible??
    Example:
    When connnected the SSID will redirect to Cisco landing pages
    Cisco landing pages will differentiate there is member or guess with the password key in.
    Member can access internet for 30 minute
    guess only can access internet for 15 minute

    Just some notes on WebAuth in the WLC. The timeout is specified per SSID so there would be no way to set a timeout unless you use a radius server and send a radius attribute to the WLC to set the session timeout.
    So we really need to know if you have a radius server, is the radius server tied to Active Directory or is the plan just using the WLC for everything.
    Sent from Cisco Technical Support iPhone App

Maybe you are looking for

  • How to fire mouse wheel events to parent container?

    Hi, When I create a JPanel (let's say jParent) inside a JScrollPane and this JPanel is larger than the current viewport I can use my mouse wheel to scroll the JPanel's containt without coding anything about that. But if I add another JPanel-derived c

  • Re : Issue with the column display in Bex reports

    Hello Gurus, I have an issue with the reports in Bex, this is a bit confusing scenario I would try to explain in more details. A query was already built for monthly Report in Sales and Billing for which the variable were  Calender month/year range 1

  • There is no Applicationserver on Host with System ID 00?!?

    Hi there, i tried to import a Scenratio from our XI Consolidation System to the Prod System. When i go to tools - > Import Configuration Objects and Import the Scenario the following Error Occurs: As you can see in the Screenshot: http://img10.images

  • How to add a new field to the notification mail

    Hi All, We want to add the description of the GOA to the notification mail. Currently when an approval is required the following mail is sent: #CONTRACT.VERSIONTYPENAME# no.#CONTRACT.OBJECT_ID# was designated for release by employee#CONTRACT.CHANGEDB

  • Extract-Export iCloud Contacts Locally

    Greetz Commnunity! I'd like your help with something if anybody knows.. I'm in need to extract or export my iCloud contacts to my local Address Book. I happen not to backup the Address book when i bought a new macbook pro 6.2, so now.. i have'em on m