Query on the Oracle Concepts: advantages of the SAMS

Hello

A query on the Concepts of the Oracle, specifically on the benefits of the SAMS.

While I am able to understand "Simplified Administration" & "Increased Concurrency", can someone mention this in simple terms:
• Dynamic affinity of space to instances in an Oracle Real Application Clusters (Oracle RAC) environment.
I guess I know what Oracle RAC, but what is meant by 'dynamic affinity of space bodies "?

Kind regards
Ankit Rouault

When choosing a path of navigation through SAMS bitmaps, your session uses an algorithm (which I believe is a hash algorithm) which includes your session identifier. It is unlikely that many sessions will seek the same part of the bitmap and therefore insert into blocks of same of the segment, reducing contention between sessions. In a RAC, the algorithm also includes the instance number. This should mean that sessions against different instances will tend to get different parts of the bitmap image, reducing the contention between instances.
I am of course open to correction on this.
--
John Watson
Oracle Certified Master s/n
http://skillbuilders.com

Tags: Database

Similar Questions

  • Why I have two different execution plans for the same query on two different servers

    Hello everyone.

    I need your help to solve the problem quickly.

    In a nutshell, we have two servers that have the same version of Oracle RDBMS (11.2.0.4 EE). One of them for purposes of development and another is a production one.

    We have therefore two different execution plans for the same query executed on both servers. The only case of execution is OK and another is too slow.

    So I have to slow down the work of query using the same scheme to explain that young.

    Fence wire.

  • Error in query of the ordered result query contained CFSCRIPT in CF10

    I came across a very interesting error when you perform a query of a query within a CFSCRIPT tag...

    I get a result in withdrawal of a SQL Server stored procedure.  This is a list of metric names (METRIC_ID) and the metric measures themselves.

    I need to pull the METRIC_ID for this outcome, plans to make a JOIN on another query having display and other attributes of formatting for display in a web page.

    The following code runs without error when the query is not ordered:

    var displayDataQuery = new Query();

    displayDataQuery.setName ("joinedQuery");

    displayDataQuery.setDBType ("query");

    displayDataQuery.setAttributes (qry1 = fullMetricsListQuery);

    displayDataQuery.setAttributes (qry2 = arguments.cubeData);

    displayDataQuery.setSQL ("SELECT METRIC_ID FROM qry2");

    var tempResultSet = displayDataQuery.execute ();

    var cubeMetricIDList = tempResultSet.getResult ();

    When I take the same results of exact query of the same stored procedure, but it is controlled by an ORDER BY clause, this statement;

    var tempResultSet = displayDataQuery.execute ();

    get the following error: "value" cannot be converted to a number.»   It is 2 apostrophes, meaning an empty string between 'value' and 'impossible.'


    Wait, what?  I want to just a list of names metrics, varchars.  Why is there a conversion error...?


    The error in the end pprovided back to ColdFusion10\cfusion\CustomTags\com\adobe\coldfusion\base.cfc, line 445

    OK, this is where it takes an interesting twist...

    Starting at line 444, in base.cfc, line 445 bolded in red:

    "< cfif sqlType NEQ" "and arraylen (sqlParams) gt 0 >."

    < cfloop index = "i" = "2" to = "#ArrayLen (sqlArray) #" >

    < arraylen (sqlParams) of lte cfif (i-1) >

    < cfqueryparam attributeCollection = "#sqlParams [i-1] #" / >

    < / cfif >

    #getPreserveSingleQuotes (sqlArray [i]) #.

    < / cfloop >

    < / cfif >

    So if I understand correctly, when I have a query, unordered, copy the following code in base.cfc bed the SQL code in displayDataQuery.setSQL ("SELECT METRIC_ID FROM qry2"), but is not when the query is controlled by METRIC_ID... ?

    Oh, wait... the CFDUMP when using an ordered set of data says something else...

    query
    RESULTSET
    CACHINGfake
    EXECUTIONTIME4
    SQLSELECT * FROM qry1 ORDER OF METRIC_ID, LOCATION

    I'm a bit confused why the same data in works set ordered, while an ordered set causes this error.

    All useful suggestions or clues would be greatly appreciated!

    Do you mean that the error has occurred without the order by clause?

    Given that the error only occurs with one unsorted data set, I'm a bit confused why you ask this...?

    I've followed your suggestion:

    Run the same code, but use the cfquery instead of cfscript tag. The error persists there?

    My assumption was that your suggestion is to test it against a set of ordered data because that is what caused the original error.

    Unfortunately, the error occurs in the scenarios the tag and script-based.

    There is absolutely no sense why this happens.  The order of a set of data should have no impact on a query of a query on a column defined as varchar.

    If there are null values in the other columns defined as a type of digital, big deal, the code in question does not seek to assess these columns.  Still more interesting thing is why disorderly orderly vs makes a difference.

  • When you perform the query from the query, it assumes that the field is numeric

    I have a query that has 30 some files inside from an AS400 file. Now, when I do a query on the query, he thinks one of the columns is a numeric field, even if it is not. Now I do the same thing with another query (with the same file and fields, just different data) and it works fine.

    This is the error I get: the 73 "d" value cannot be converted to a number

    This column looks like this for example
    75
    75
    71
    71
    75
    73
    75
    63%
    etc. (the 73D is the only one in this column)

    Now in the query of queries I question not even this field (there are about 10 fields in the query, and I want the results of one) and then I get the above error. Any ideas?

    Thanks in advance,
    CJ

    CJ wrote:
    > I have a query that has 30 some files inside from an AS400 file. Now when I do

    you create the original query? If so, create the AND define the data types:

    newQ = QueryNew ("user, lastLogin, manager", "varChar, time, bit");

    > a query on the query, he thinks one of the columns is a digital, same field
    > if it's not. Now do the same thing with another application (with the same file
    (> and fields, just different data) and it works fine.
    >
    > This is the error I get: the 73 "d" value cannot be converted to a
    > number
    >
    > This column looks like this for example
    > 75

    CF will build the query result based on the first line of data (if you are not
    define the data types in the original query), which resembles digital data.

    > 73D

    Thus, when it hits this row it will fail.

    If you do not use the data in that column, and then not put it back. Otherwise, use it.
    Method CAST dan suggested.

  • query: without the help of the union

    Hai, everyone,

    IHAVE àtable like this:

    Table1:

    ID emp1 emp2 emp3
    1 100 200 300
    2 90 295 977
    3 150 299 500




    and I need the result like this:

    100
    90
    150
    200
    295
    299
    300
    977
    500



    the result is just union emp1, emp2 and emp3

    That is to say, this type of result, we can produce with this:

    Select emp1 in table1 union select emp2 emp3 union table1 select from table1

    but I need a query with the same result as above without using the union statement

    Thanks in advance...

    Published by: jp_valapad on Sep 12, 2008 02:38

    Published by: jp_valapad on Sep 12, 2008 02:39

    But the order guaranteed?

    N ° as it is never without an order by ;)
    But op didn't say anything about a particular order (again)...

  • Exception sometimes when you send the query to the oracle server

    Hello

    I'll send the following query to the oracle server:
    t (*) AS 'COUNT' FROM 'DEPT_MANAGER' JOIN 'EMPLOYEES' ON DEPT_MANAGER. EMP_NO = EMPLOYEES. EMP_NO AND DEPT_MANAGER. TO_DATE = 9999-01-01' LEFT JOIN 'DEPT_EMP' ON DEPT_MANAGER. EMP_NO = DEPT_EMP. EMP_NO AND DEPT_EMP. TO_DATE = 9999-01-01' LEFT JOIN 'DEPARTMENTS"ON DEPT_EMP. DEPT_NO = DEPARTMENTS. DEPT_NO GROUP OF DEPARTMENTS. DEPT_NAME, EMPLOYEES. FIRST_NAME. » '|| EMPLOYEES. LAST_NAME, DEPT_MANAGER. EMP_NO, DEPT_MANAGER. DEPT_NO, DEPARTMENTS. DEPT_NO

    A java application, it works and another does not.
    Here are the exception?

    What can cause this? What does this exception?

    Message:-2
    Cause: null
    StackTrace
    oracle.jdbc.driver.T4CStatement.saveDefineBuffersIfRequired(T4CStatement.java:464)
    oracle.jdbc.driver.OracleStatement.prepareAccessors(OracleStatement.java:927)
    oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1047)
    oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:830)
    oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1132)
    oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1687)
    oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1653)

    Thank you

    To remove the suspected driver, download and use the latest ojdbc14.jar is.

  • Different output for the same query in SQL Server and Oracle

    I have two tables table1 and table2

    -table1 has two columns c1 int and varchar c2. There are no constraints added in it. It contains data as shown below

    C1 c2
    -------------------
    d 6
    5 d
    102 g
    6%
    f 103
    5.
    501 j
    1 g
    601 n
    2 m

    -table2 has only a single column c1 int. There is no added in constraints. It contains data as shown below

    C1
    ----
    6
    1
    4
    3
    2

    now when I run below, given the query in sql server and oracle it gives me different results

    Select *.
    FROM table1
    table2 on table2.c1 = table1.c1 inner join (SELECT ROW_NUMBER() (any ORDER by ASC c1) AS c1 from table2)

    output of SQL server
    ------------------------
    C1 c2 c1
    --------------------------------
    1 g 1
    2 m 2
    3 h 3
    4 g 4
    5 d 5


    release of Oracle
    ----------------------
    C1 C2 C1
    ---------------------------------
    5 d 5
    4 g 4
    3 h 3
    1 g 1
    2 m 2


    If you notice the first column in the two outputs. It is sorted in sql server and no oracle.

    Why he behaves differently in oracle? Is there a way I can fix this problem in oracle?

    Thank you
    Jigs

    It is NOT a behavior "differently" in Oracle; you did not specify just an order that you expect of your results, so you'll get output in what order the fantasies of the database showing (ie. no guaranteed order). It is an artifact of the way the database chooses to collect the data and databases (or same sets of data within the same database) can and will most likely behave differently.

    Same SQL Server will not be guaranteed to always get your data in an orderly manner if you exclude the order by clause, even if you think that there always display the data in an orderly manner.

    Your solution is to add an order by clause, in the TWO databases, to force the order of the data output.

  • How to write this query in the hierarchy

    Hi gurus,

    Really need your help on this query.  Thank you very much in advance.

    SELECT
      t1.key as root_key ,
    (SELECT
          t2.unit_id AS unit_id 
          level-1 AS level ,
          t2.name,
          t2.creator
        FROM
          tab t2
          START WITH t2.unit_id       =   t1.unit_id            -----check each node as root
          CONNECT BY prior t2.unit_id = t2.parent_unit_id
    
      )
       t1.name as parent_unit_name
    FROM
      tab t1
    

    I'll write a query of the hierarchy as above, and that EACH line (node, totally more than 10200) is checked as root node to see how many sheets are accessible for her... It must be implemented in a single query.

    I know inline query should NOT return multiple rows or multiple columns, but the inline elements are necessary and can certainly be made in a correct solution.

    (env):

    Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production

    PL/SQL Release 12.1.0.2.0

    )

    Test data:

    select 1 as unit_id, null as parent_organization_unit_id, 'U1' as name from dual
    union all
    select 2, 1, 'U2' FROM DUAL
    UNION ALL
    SELECT 3, NULL, 'U3' FROM DUAL
    UNION ALL
    SELECT 4, 3, 'U4' FROM DUAL
    UNION ALL
    SELECT 5, 2, 'U5' FROM DUAL
    UNION ALL
    SELECT 6, 5, 'U6' FROM DUAL
    UNION ALL
    SELECT 7, 6, 'U7' FROM DUAL
    UNION ALL
    SELECT 8, 5, 'U8' FROM DUAL
    UNION ALL
    SELECT 9, 5, 'U9' FROM DUAL;
    

    Final result should be like this

    key unit_id,    level,   name, parent_name
    1    1    0    u1      u1
    1    2    1    u2       u1
    1    5    2     u5      u1
    1    6    3     u6      u1
    1    7    4    u7       u1
    1    8    3    u8       u1
    1    9    3     u9      u1
    2    2    0     u2       u2
    2    5    1      u5       u2
    2    6    2     u6       u2
    2    7    3      u7      u2
    2    8    2      u8       u2
    2    9    2      u9       u2
    
    

    Don't know how get you your output, it does not match your data...

    with tab as)

    Select 1 as unit_id, null as parent_organization_unit_id 'U1' as the name of double

    Union of all the

    Select 2, 1, 'U2' FROM DUAL

    UNION ALL

    SELECT 3, NULL, 'U3' FROM DUAL

    UNION ALL

    SELECT 4, 3, 'U4' FROM DUAL

    UNION ALL

    SELECT 5, 2, 'U5' OF THE DOUBLE

    UNION ALL

    SELECT 6, 5, 'U6' OF THE DOUBLE

    UNION ALL

    SELECT 7, 6, "U7" OF THE DOUBLE

    UNION ALL

    SELECT 8, 5, 'U8' FROM DUAL

    UNION ALL

    9. SELECT, 5, 'U9' FROM DUAL

    )

    Select dense_rank() key (order by connect_by_root unit_id), unit_id, level - 1 as 'LEVEL', connect_by_root name root_parent_name

    t tab

    Start with parent_organization_unit_id is null

    Connect prior unit_id = parent_organization_unit_id

    KEY UNIT_ID LEVEL ROOT_PARENT_NAME
    1 1 0 "U1".
    1 2 1 "U1".
    1 5 2 "U1".
    1 6 3 "U1".
    1 7 4 "U1".
    1 8 3 "U1".
    1 9 3 "U1".
    2 3 0 "U3".
    2 4 1 "U3".
  • How many times can I use a variable binding in a query of the VO?

    Is it possible that I can use a variable binding in a query of VO just once?

    I test a query that keeps throwing the Houston-27122 error by pressing the application module tester. I tried to limit the problem to the simplest possible case, and it seems that the error is caused by the fact that I use the same variable bind two or more times.

    When the query looks like this:

    query1.png

    I have run, enter 'x' and it returns me the result.

    When I change to:

    query2.png

    I have run, enter the value

    param.png

    and immediately get the error

    error.png

    The same thing in sqlplus runs without problem:

    sqlplus.png

    My version of JDev is build JDEVADF_11.1.1.9.0_GENERIC_150314.0718.6673

    Please, advise.

    P. S. where can I find documentation queries are supported in your? In particular, I'm interested if I can use WITH the clause. There seems to be some confusion on this matter (see, for example, Oracle SQL WITH clause support - JDeveloper and ADF)

    Thank you.

    It depends on:

    Open your VO in JDev and go the the query page.

    In the lower part, there is a drop down 'link type', it is usually set to "JDBC-positional. In this case, you will need to provide the bind value for each occurrence of the variable binding separately.

    You could change that to "named" (don't remember the exact name). But beware, this will also affect all relatioships master retail to others your. I think that this is not a good idea to change the style of binding to a single VO.

    Good bye

    DPT

  • Can I get the total number of records that meet the conditions of a query using the Table API?

    Hello

    A < row > TableIterator is returned when I ask operations using the index of tables. If I want to get the total number of records, I count one by one using the returned TableIterator < row >.


    Can I get the total number of records directly meets the conditions of the query?

    I can get the total number of records directly the request of the meeting of the conditions of CLI using the command Global table - name tableName - count - index index-name-field fieldName - start startValue-end endValue.

    Can I get the same results using the Table API?

    I used MongoDB and NoSQL Oracle for about a year. According to the experience of the use of these dbs, I think mongoDB querying interface is powerful. In the contras, the query interface is relatively simple, which results is a lot of work that is usually a long time in the client side.

    Hello

    Counting records in a database is a tricky thing.  Any system that gives you an accurate count of the records will have a hotspot of concurrency on updates, namely the place where the counting is maintained.  Such a count is a problem of performance in addition to competitive access problem.   The problem is even more difficult in a system widely distributed such a NoSQL database.

    The CLI has overall command that counts, but does so by brutal force - iterate keys that correspond to the parameters of the operation.  This is how you must do this within the API.  There is not a lot of code, but you have to write.  You certainly want to use TableIterator TableAPI.tableKeysIterator (), because a key iteration is significantly faster than the iteration of lines.  Just one iteration and count.

    If you use TableAPI.multiGet () and a key with a touch of brightness full then, in fact, count the results as they are returned in a single piece (a list).

    Kind regards

    George

  • [ADF, JDev 12.1.3] To run a query on the fly is always necessary to define a VO? How to get the Id of the last line inserted in a VO...

    Hallo,

    Sometimes, in the code for my application, I need to run smaller queries to retrieve data from the database.

    I wonder if for these queries, it is necessary to define a View object or if I can avoid this for example creation and execution of a VO on the fly.

    In this case I would not define a VO, given that queries will be never used to display data, but only for the internal logic.

    A use case, I want to solve it next.

    I would like to create a function to be used after validation for last inserted record by a user in a TableVO.

    For example

    Select the Id of the Table where UserId =? and Type =?

    The query should be run in a managed bean...

    public String okButton_action() {}

    OperationBinding operationBinding is BindingsUtils.getBindings () .getOperationBinding ("Commit");.

    Object result = operationBinding.execute ();

    If (! operationBinding.getErrors () .isEmpty ()) {}

    Error handling

    return;

    }

    Here, I need to:

    1. run the query to get the Id of the last inserted record

    2 call the setCurrentRowWithKey on the TableVO to update the display

    and get the Id (identity/auto-increment) than the database

    assigned to the field

    return "return";

    }

    If I can create a function that creates / runs the VO on the fly and return the value ID... It is best to create it in a class of public services or in the implementation class TableVO?

    I need to get the Id of the last line inserted since the ADF is not able to manage MS SQL Server identity fields (it seems that REFRESH AFTER INSERT cannot be used with non - Oracle DB).

    Any notice will be welocome.

    Thank you

    Federico

    The query should be run in a managed bean...

    Much better to execute the query in the template project.

    Example query: http://amit-adf-work.blogspot.com/2013/09/how-to-execute-sql-using-adf-application.html

    If I can create a function that creates / runs the VO on the fly and return the value ID... It is best to create it in a class of public services or in the implementation class TableVO?

    If you have the function that accepts the SQL as a parameter, then this should go to class util.

    Dario

  • Vs. runtime vs. ViewObject ViewObject SQL query in the xml file.

    Hello

    I wonder what is the difference between query SQL in the long term, creating a view object in the duration and the creation of a display with an XML object.

    I'm not trying to have the result set cached just to pick once.


    My code for a creation of a view in a run-time object:

    HashSet<Integer> allPersonIdThatUserHasAccessTo = new HashSet<Integer>();
                AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
    
                String sqlStr = "SELECT up.person_id FROM user_person up where up.user_id = " + userId;
                ViewObjectImpl vo = (ViewObjectImpl)am.createViewObjectFromQueryStmt("AllPeopleUserHasAccessToVo", sqlStr);
                vo.executeQuery();
                RowSetIterator rsi = vo.createRowSetIterator(null);
                while (rsi.hasNext()) {
                    Row personRow = rsi.next();
                    Integer personId = ((BigDecimal)personRow.getAttribute(0)).intValue();
                    allPersonIdThatUserHasAccessTo.add(personId);
                }
    
                rsi.closeRowSetIterator();
                vo.remove();
    

    When should I use SQL query, when the view object use at time of execution and time to create the view object to an xml file?

    In general you should not write this code in a managed bean. Access code or in your case creating a VO belongs behind the façade in the module of the application.

    You can create the original Version, but the main difference is that it takes more time. Code everything that the definition of VO created in the data model of the application module would make too and it clears directly after the query only to create the same code again the next time you call the method.

    If the goal is not to keep the data, you can create the hashset class and call executeEmptyRowSet() on the VO (https://blogs.oracle.com/smuenchadf/entry/what_does_executeemptyrowset_d for details). This way you only need a VO that takes a parameter and gets you the same result in less time.

    Timo

  • place a select query calculation in a different column in the same table

    How can I put my calculation result in a column named within the same table?

    I have a table called: dgpercentagedatachart

    I use the columns of this dgpercentagedatachart: totalcecrating divided by lowestfeederrating times 100 to get the percentage

    In the query, I gave the result the Alias of the cal

    What I want is to put this result in my application or my calculation (in percentage) in my column "percent" on my table of dgpercentagedatachart vacuum.

    How can I configure this syntax?

    This is the select query, I came with:

    Select dgpercentagedatachart.totalcecrating, dgpercentagedatachart.lowestfeederrating,.

    100.00*dgpercentagedatachart.totalcecrating/dgpercentagedatachart.lowestfeederrating as cal

    of dgpercentagedatachart;

    Here are the results:

    CAL lowestfeederrating Totalcecrating

    8,978 7.48166666666666666666666666666666666667 120

    30.951 25.7925 120

    5.04                         120                          4.2

    Hello

    2685870 wrote:

    How can I put my calculation result in a column named within the same table?

    I have a table called: dgpercentagedatachart

    I use the columns of this dgpercentagedatachart: totalcecrating divided by lowestfeederrating times 100 to get the percentage

    In the query, I gave the result the Alias of the cal

    What I want is to put this result in my application or my calculation (in percentage) in my empty column '%' on my table of dgpercentagedatachart .

    How can I configure this syntax?

    This is the select query, I came with:

    Select dgpercentagedatachart.totalcecrating, dgpercentagedatachart.lowestfeederrating,.

    100.00*dgpercentagedatachart.totalcecrating/dgpercentagedatachart.lowestfeederrating as cal

    of dgpercentagedatachart;

    Here are the results:

    CAL lowestfeederrating Totalcecrating

    8,978 7.48166666666666666666666666666666666667 120

    30.951 25.7925 120

    5.04                         120                          4.2

    To change an existing column in a table, you can use the UPDATE or MERGE, instructions like this:

    UPDATE dgpercentagedatachart

    Percentage of VALUE = 100,00 * totalcecrating

    / lowestfeederrating

    ;

    Noramlly, tables is not redundant columns like this.  If percent can always be calculated from other columns, then it is probably better to calculate at run time and store it in the database, where you will have to be updated each time the columns it depends on change.  You can use a view to avoid having to encode them the calculation.

    If you really don't want a column that can be calculated in the same lines other columns, then use a virtual column (if you use Oracle 11 or higher).

    I hope that answers your question.

    If this isn't the case, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.

    If you ask on a DML statement, such as UPDATE, the sample data will be the content of the or the tables before the DML, and the results will be the State of the or the tables changed when it's all over.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

  • Query with the having clause

    Hi all

    I have this select statement to help to filter different from zero records.

    Select GroupName, Nom_liste,

    Sum ((a_cost/1000) * degradation * quantity * total_count * index) such as total_cost,.

    FROM MyTable

    having sum ((a_cost/1000) * degradation * quantity * total_count * index) <>0

    Group GroupName, Nom_liste

    Having done so the query to run more slowly.

    How can I filter records with zero total_cost (they can be negative or greater than zero).

    Thank you!

    Hello

    user9542267 wrote:

    Hi all

    I have this select statement to help to filter different from zero records.

    Select GroupName, Nom_liste,

    Sum ((a_cost/1000) * degradation * quantity * total_count * index) such as total_cost,.

    FROM MyTable

    having sum ((a_cost/1000) * degradation * quantity * total_count * index) <> 0

    Group GroupName, Nom_liste

    Having done so the query to run more slowly.

    How can I filter records with zero total_cost (they can be negative or greater than zero).

    Thank you!

    The query you posted should not take more time with or without the HAVING clause.  The right of the comma before 'from' causes a compilation error very quickly anyway.

    If you get no result other than an error message, then this is not the code you are running.  Show the code you actually run, or a simplified version that has the same problem.

    For all performance issues, see the FAQ forum:

    https://community.Oracle.com/message/9362003#9362003

    If the problem was really in the HAVING clause, then you can try something like this:

    WITH got_total_cost AS
    (
    SELECT GroupName, Nom_liste
    , SUM ((a_cost/1000) * degradation * quantity * total_count * index) SUCH as total_cost
    FROM MyTable
    GROUP BY GroupName, Nom_liste
    )
    SELECT *.
    OF got_total_cost
    WHERE as total_cost <> 0
    ;

    but it would be very surprising he made all the difference.  I suspect that the problem is not really in the HAVING clause.

  • Should I wait until the end of the execution time of the query for the execution plan?

    Hello Experts,

    I want to see the execution plan of the query below. However, it takes more than 3 hours. Should I wait all the time to see the execution plan?

    Note: EXPLAIN PLAN for does not work. (I mean that I do not see the actual line number, etc. with EXPLAIN the PLAN of market)

    You can see the output of the execution plan when I canceled the execution after 1 minute.

    My first question is: what should I do to see the execution plan for queries running out of time time?

    2nd question: when I cancel the query during execution in order to see the execution plan, will I see the specific plan of execution or erroneous values? Because the first execution plan seems inaccurate, what do you think?

    question 3: why EXPLAIN the PLAN for the clause does not work? Also, should I use EXPLAIN the PLAN of the clause to this scenerio? Can I see the result of running for long time without her queries?

    Thnaks for your help.

    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production

    PL/SQL Release 11.2.0.2.0 - Production

    CORE Production 11.2.0.2.0

    AMT for Linux: Version 11.2.0.2.0 - Production

    NLSRTL Version 11.2.0.2.0 - Production

    Select / * + GATHER_PLAN_STATISTICS NO_PARALLEL * / J.INVOICEACCOUNT, J.INVOICEID, J.INVOICEDATE, (T.LINEAMOUNT + T.LINEAMOUNTTAX) price

    of custinvoicejour j join custinvoicetrans t on

    substr (nls_lower (j.DataAreaId), 1, 7) = substr (nls_lower (t.dataareaid), 1, 7) and

    substr (nls_lower (J.INVOICEID), 1: 25) = substr (nls_lower (t.INVOICEID), 1: 25)

    where

    substr (nls_lower (T.DATAAREAID), 1, 7) = '201' and T.AVBROCHURELINENUM = 29457

    and substr (nls_lower (j.dataareaid), 1, 7) = '201' and

    J.INVOICEACCOUNT in

    (select IT. Drmpos.avtr_seg_cust_campend ACCOUNTNUM this where THIS. CAMPAIGN = '201406' and THIS. SEGMENT_LEVEL in (', 'E'))

    and J.AVAWARDSALES > 190

    and substr (nls_lower (J.AVBILLINGCAMPAIGN), 1, 13) = '201406'

    "and J.INVOICEDATE between ' 04.06.2014' and ' 13.06.2014 ';

    SQL_ID, dznya6x7st0t8, number of children 0

    -------------------------------------

    Select / * + GATHER_PLAN_STATISTICS NO_PARALLEL * / J.INVOICEACCOUNT,.

    J.INVOICEID, J.INVOICEDATE, (T.LINEAMOUNT + T.LINEAMOUNTTAX) price of

    CustInvoiceJour j join custinvoicetrans t on

    substr (nls_lower (j.DataAreaId), 1, 7) =

    substr (nls_lower (t.DataAreaId), 1, 7) and

    = substr (nls_lower (J.INVOICEID), 1: 25)

    substr (nls_lower (t.INVOICEID), 1: 25) where

    substr (nls_lower (T.DATAAREAID), 1, 7) = '201' and T.AVBROCHURELINENUM =

    29457 and substr (nls_lower, (j.dataareaid), 1, 7) = '201' and

    J.INVOICEACCOUNT in (select CE. ACCOUNTNUM of

    drmpos.avtr_seg_cust_campend this where THIS. CAMPAIGN = '201406' and

    IT. SEGMENT_LEVEL in (', 'E')) and J.AVAWARDSALES > 190 and

    substr (nls_lower (J.AVBILLINGCAMPAIGN), 1, 13) = '201406' and

    "J.INVOICEDATE between ' 04.06.2014' and ' 13.06.2014 '.

    Hash value of plan: 2002317666

    --------------------------------------------------------------------------------------------------------------------------------------------------------------

    | ID | Operation | Name                           | Begins | E - lines. A - lines.   A - time | Pads | Bed |  OMem |  1Mem | Used Mem.

    --------------------------------------------------------------------------------------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |                                |      1.        |      0 | 00:00:00.01 |       0 |      0 |       |       |          |

    |*  1 |  HASH JOIN |                                |      1.   3956.      0 | 00:00:00.01 |       0 |      0 |  2254K |  1061K | 2190K (0) |

    |*  2 |   HASH JOIN |                                |      1.     87.  16676. 00:00:01.64 |     227K |   3552.  3109K |  1106K | 4111K (0) |

    |*  3 |    TABLE ACCESS BY INDEX ROWID | CUSTINVOICEJOUR |      1.   1155 |  31889 | 00:00:01.16 |     223KO |     15.       |       |          |

    |*  4 |     INDEX RANGE SCAN | I_062INVOICEDATEORDERTYPEIDX |      1.   4943 |    134K | 00:00:00.83 |   45440 |      0 |       |       |          |

    |   5.    SIMPLE LIST OF PARTITION.                                |      1.  82360 |    173K | 00:00:00.08 |    3809 |   3537 |       |       |          |

    |*  6 |     TABLE ACCESS FULL | AVTR_SEG_CUST_CAMPEND |      1.  82360 |    173K | 00:00:00.06 |    3809 |   3537 |       |       |          |

    |   7.   TABLE ACCESS BY INDEX ROWID | CUSTINVOICETRANS |      1.   4560 |      0 | 00:00:00.01 |       0 |      0 |       |       |          |

    |*  8 |    INDEX RANGE SCAN | I_064INVLINENUMCAMPAIGNOFPRICE |      1.   4560 |      0 | 00:00:00.01 |       0 |      0 |       |       |          |

    --------------------------------------------------------------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    1 - access("J".") "SYS_NC00299$"="T". "' SYS_NC00165$ ' AND SUBSTR (NLS_LOWER ('J'. "" "" REFFACTURE")(, 1, 25) = SUBSTR (NLS_LOWER ("T"." "" "REFFACTURE")(, 1, 25)).

    2 - access("J".") INVOICEACCOUNT '= SYS_OP_C2C ("EC". ". ACCOUNTNUM'))

    3 - filter("J".") AVAWARDSALES"> 190)

    4 - access("J".") SYS_NC00299$ "= U ' 201"AND "J". INVOICEDATE"> = TO_DATE(' 2014-06-04 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND

    "J"." SYS_NC00307$ "= U ' 201406"AND "J". INVOICEDATE"< = TO_DATE (' 2014-06-13 00:00:00 ',' syyyy-mm-dd hh24:mi:ss')))

    filter ((' J'. "INVOICEDATE' > = 'J' AND TO_DATE(' 2014-06-04 00:00:00', 'syyyy-mm-dd hh24:mi:ss') '." " SYS_NC00307$ "= U '201406' AND"

    "J"." INVOICEDATE"< = TO_DATE (' 2014-06-13 00:00:00 ',' syyyy-mm-dd hh24:mi:ss'))))

    6 filter (("CE". "SEGMENT_LEVEL" = A "OR"THIS"." SEGMENT_LEVEL "=" E"))

    8 - access("T".") SYS_NC00165$ "= U ' 201"AND "T". AVBROCHURELINENUM "= 29457)

    filter ("T". ("AVBROCHURELINENUM" = 29457)

    EXPLAIN PLAN FOR

    Select / * + GATHER_PLAN_STATISTICS NO_PARALLEL * / J.INVOICEACCOUNT, J.INVOICEID, J.INVOICEDATE, (T.LINEAMOUNT + T.LINEAMOUNTTAX) price

    of custinvoicejour j join custinvoicetrans t on

    substr (nls_lower (j.DataAreaId), 1, 7) = substr (nls_lower (t.dataareaid), 1, 7) and

    substr (nls_lower (J.INVOICEID), 1: 25) = substr (nls_lower (t.INVOICEID), 1: 25)

    where

    substr (nls_lower (T.DATAAREAID), 1, 7) = '201' and T.AVBROCHURELINENUM = 29457

    and substr (nls_lower (j.dataareaid), 1, 7) = '201' and

    J.INVOICEACCOUNT in

    (select IT. Drmpos.avtr_seg_cust_campend ACCOUNTNUM this where THIS. CAMPAIGN = '201406' and THIS. SEGMENT_LEVEL in (', 'E'))

    and J.AVAWARDSALES > 190

    and substr (nls_lower (J.AVBILLINGCAMPAIGN), 1, 13) = '201406'

    "and J.INVOICEDATE between ' 04.06.2014' and ' 13.06.2014 ';

    SELECT * FROM table (DBMS_XPLAN. DISPLAY_CURSOR);

    SELECT * FROM table (DBMS_XPLAN. DISPLAY_CURSOR ('7h1nbzqjgwsp7', 2));

    SQL_ID, 7h1nbzqjgwsp7, number of children 2

    EXPLAIN PLAN for select / * + GATHER_PLAN_STATISTICS NO_PARALLEL * /.

    J.INVOICEACCOUNT, J.INVOICEID, J.INVOICEDATE,

    (T.LINEAMOUNT + T.LINEAMOUNTTAX) join price j custinvoicejour

    CustInvoiceTrans t on substr (nls_lower (j.dataareaid), 1, 7) =

    substr (nls_lower (t.DataAreaId), 1, 7) and

    = substr (nls_lower (J.INVOICEID), 1: 25)

    substr (nls_lower (t.INVOICEID), 1: 25) where

    substr (nls_lower (T.DATAAREAID), 1, 7) = '201' and T.AVBROCHURELINENUM =

    29457 and substr (nls_lower, (j.dataareaid), 1, 7) = '201' and

    J.INVOICEACCOUNT in (select CE. ACCOUNTNUM of

    drmpos.avtr_seg_cust_campend this where THIS. CAMPAIGN = '201406' and

    IT. SEGMENT_LEVEL in (', 'E')) and J.AVAWARDSALES > 190 and

    substr (nls_lower (J.AVBILLINGCAMPAIGN), 1, 13) = '201406' and

    "J.INVOICEDATE between ' 04.06.2014' and ' 13.06.2014 '.

    NOTE: cannot fetch SQL_ID plan: 7h1nbzqjgwsp7, CHILD_NUMBER: 2

    Check the value of SQL_ID and CHILD_NUMBER;

    It could also be that the plan is no longer in the cursor cache (check v$ sql_plan)

    NightWing wrote:

    Randolf,

    I don't understand. What you hear from the above statement that you mean A-lines and E will be incorrect, but the ratio between them remain the same. Therefore, you can deduct the bad things by comparing the differences.

    Thus, A-lines always give a wrong result for cancellation of queries, isn't it?

    Charlie,

    I think that Martin gave a good explanation. Here's another example that hopefully makes more obvious things:

    17:56:55 SQL >-things go very wrong here with a small buffer cache

    17:56:55 SQL >-T2 lines are badly scattered when you access through T1. FK

    17:56:55 SQL >--

    17:56:55 SQL >-"Small job" approach would have been a good idea

    17:56:55 SQL >-if the estimate of 100 iterations of the loop was correct!

    17:56:55 SQL > select

    17:56:55 (t2.attr2) count 2

    17:56:55 3 of

    17:56:55 4 t1

    17:56:55 5, t2

    17:56:55 6 where

    17:56:55   7  /*------------------*/

    17:56:55 8 trunc (t1.attr1) = 1

    17:56:55 9 and trunc (t1.attr2) = 1

    17:56:55 10 / *-* /.

    17:56:55 11 and t1.fk = t2.id

    17:56:55 12.

    T1

    *

    ERROR on line 4:

    ORA-01013: user has requested the cancellation of the current operation

    Elapsed time: 00:04:58.30

    18:01:53 SQL >

    18:01:53 SQL > @xplan_extended_display_cursor ' ' ' ' 'ALLSTATS LAST + COST.

    18:01:53 SQL > set echo off verify off termout off

    SQL_ID, 353msax56jvvp, number of children 0

    -------------------------------------

    SELECT count (t2.attr2) from t1, t2 where

    / / *-* trunc (t1.attr1) = 1 and

    trunc (T1.attr2) = 1 / *-* / and t1.fk = t2.id

    Hash value of plan: 2900488714

    ------------------------------------------------------------------------------------------------------------------------------------

    | ID | The NEST | DSB | Operation | Name | Begins | E - lines. Cost (% CPU). A - lines.   A - time | Pads | Bed |

    ------------------------------------------------------------------------------------------------------------------------------------

    |   0 |     |   7. SELECT STATEMENT |        |      1.        |  4999 (100) |      0 | 00:00:00.01 |       0 |      0 |

    |   1.   0 |   8 2 GLOBAL TRI |        |      1.      1.            |      0 | 00:00:00.01 |       0 |      0 |

    |   2.   1.   5.   NESTED LOOPS |        |      1.        |            |  57516 | 00:04:58.26 |     173K |  30770 |

    |   3.   2.   3.    NESTED LOOPS |        |      1.    100.  4999 (1) |  57516 | 00:00:21.06 |     116K |   3632.

    |*  4 |   3.   1.     TABLE ACCESS FULL | T1 |      1.    100.  4799 (1) |  57516 | 00:00:00.19 |    1008 |   1087 |

    |*  5 |   3.   2.     INDEX UNIQUE SCAN | T2_IDX |  57516 |      1.     1 (0) |  57516 | 00:00:20.82 |     115K |   2545 |

    |   8 2 2 |   4.    TABLE ACCESS BY INDEX ROWID | T2 |  57516 |      1.     2 (0) |  57516 | 00:04:37.14 |   57516 |  27138 |

    ------------------------------------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    4 filter ((TRUNC ('T1'. "ATTR1") = 1 AND TRUNC ('T1'. " ATTR2') = 1))

    5 - access("T1".") FK '= 'T2'.' (ID')

    You say here that I canceled a query after about 5 minutes, and looking at the statistics of content (RowSource) I can already say the following:

    1. the estimation of cardinality of T1 is far - the optimizer estimated 100 lines, but it actually generated more than 57000 lines when the query was cancelled. If this definitely seems like a candidate at the origin of the problems

    2. the query has spent most of the time in search of random table T2

    So while it is true that I don't know final A-lines of this cancelled query information, I can still say a lot of this and begin to deal with the problems identified so far.

    Randolf

Maybe you are looking for

  • IPhone bricks 6 after 9.3.2

    I am EXTREMELY * RIGHT NOW... I've just updated the 9.3.2 update and it bricked my phone.* * APPLE? I had so much data out there, I was going to backup but didn't because I didn't think it was necessary because it was just a simple update. THE ONLY T

  • Firefox crashes all the time, this list is not in safe mode. What is the difference instead of the plugins and supplements?

    My browser crashes every time and I must reduce and restore the browser to make it work. I disabled all add-ins and plugins in 'normal' mode, deleted my profile and created a new one, reset firefox and the problem persists, drunk when I run firefox i

  • Windows live Family Safety web reporting most used web site and is also in the blocked list

    Weekly activity report More popular Web sites) (64% of all websites visited Bekah) Facebook.com Google.com Microsoft.com gstatic.com YouTube.com 0 66 132 198 264 330 396 462 528 594 660 Number of pages visited Web of change for filtering Last pages b

  • Setting permissions on Pearl 8220

    I have a 8220 Pearl V4.6.0.155. My application uses permissions to define entry simulation to allow. On the V4.6.0.266 Bold and Curve 8900 V4.6.1.231 the code works and sets the simulation of entry to allow. The code I use is as follows: ApplicationP

  • Block the wide use of old VPN client.

    Hello I would like to block connections that still use older versions of the VPN client software. I use an ASA5510. I can ask customers to use the new version, as provided on the SAA, but they can always refuse this. To force the use of the latest ve