Architecture Oracle query

Hi all

I was reading about architecture oracle docs and

I was confused that if oracle database receives a Sql statement, then he gets first in what part of the LMS? Area DBBC or SQL shared (in the Shared pool).

Thanks in advance

If you want to understand the process, you need to actually READ this doc of Concepts - not just look at the pictures.

1. even the output of select statements gets written in Database Buffer and Redo Log Buffer, respectively.

NO! -Read this doc and learn the purpose of the buffer cache and the redo logs. Why a select statement would cause data is written in the REDO logs if there was no change to the data?

2 and when a DDL / DML statements is executed, first exit-East block written to redo log buffer and then he gets to the data buffer.

NO! -Read this doc and learn the purpose of the buffer cache and the redo logs. If the data did not change why it would be written to the REDO log?

http://docs.Oracle.com/CD/E11882_01/server.112/e40540/physical.htm#sthref1447

Structure of the online Redo Log

Online redo logs contain records of roll forward. A redo record is composed of a group of agents of change, which describes a change to a data block. For example, an update to a salary in the employees table generates a redo record that describes the changes on the block of the data segment of the table, the data of the undo segment block and the table transactions undo segments.

Do you think ANY reference to a select in there?

Read the section above.

Tags: Database

Similar Questions

  • Question the use of Oracle query Variables

    Hello

    I am new to Oracle, I tried to extract the data from the Oracle database by using the following query which includes 1 variable SYSDATE_UTS, but when I try to execute the query I get an error. Please let me know what I am doing wrong and how I can fix.

    Error message
    -----
    ORA-06550: line 4, column 1:
    PLS-00428: an INTO clause in this SELECT statement
    -----

    Oracle query

    DECLARE SYSDATE_UTS NUMBER: = (sysdate-to_date('19700101','yyyymmdd')) * 86400;
    BEGIN

    SELECT
    INCIDENT_NUMBER,
    TO_DATE (to_char ((1/86400 * REPORTED_DATE) + to_date ('19700101', 'YYYYMMDD'), "jj/mm/aaaa hh24:mi:ss"), 'hh24:mi:ss dd/mm/yyyy') as REPORTED_DATE_TIME,
    GROUP_TRANSFERS
    LAST_MODIFIED_BY
    , to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * LAST_MODIFIED_DATE, "mm/dd/yyyy hh24:mi:ss"), 'hh24:mi:ss dd/mm/yyyy') as LAST_MODIFIED_DATE
    , (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) age
    CASE
    WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 0 AND 1, THEN ' 0 - 1 days
    WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 2 AND 4 and THEN 2-4 days
    WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 5 AND 9, THEN 5-9 days
    WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 10 AND 19, THEN 10-19 days
    WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) > 20 THEN ' Days 20 + ".
    ANOTHER "UNKNOWN".
    END AS AGE_GROUP
    OF IncidentDataBase
    and the STATE not in (4,5,6)
    and rownum < 10;
    END;

    If you run this query in sql * plus you can declare a sql * more variable, assign a numeric value according to 'now' and use in your application, i.e.

    SQL > variable NUMBER of SYSDATE_UTS;
    SQL > exec SYSDATE_UTS: = (sysdate-to_date('19700101','yyyymmdd')) * 86400;

    You would then call your request, referring to sql * more variable with a colon as SYSDATE_UTS prior to it (i.e.: SYSDATE_UTS)

    SELECT
    INCIDENT_NUMBER,
    TO_DATE (to_char ((1/86400 * REPORTED_DATE) + to_date ('19700101', 'YYYYMMDD'), "jj/mm/aaaa hh24:mi:ss"), 'hh24:mi:ss dd/mm/yyyy') as REPORTED_DATE_TIME,
    GROUP_TRANSFERS
    LAST_MODIFIED_BY
    , to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * LAST_MODIFIED_DATE, "mm/dd/yyyy hh24:mi:ss"), 'hh24:mi:ss dd/mm/yyyy') as LAST_MODIFIED_DATE
    , (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) age
    CASE
    WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 0 AND 1, THEN ' 0 - 1 days
    WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 2 AND 4 and THEN 2-4 days
    WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 5 AND 9, THEN 5-9 days
    WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 10 AND 19, THEN 10-19 days
    WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) > 20 THEN ' Days 20 + ".
    ANOTHER "UNKNOWN".
    END AS AGE_GROUP
    OF IncidentDataBase
    and the STATE not in (4,5,6)
    and rownum<>

    Table stores IncidentDataBase the "dates" in the number of seconds since the epoch unix?

  • Architecture Oracle book

    Hi DBAs,
    Oracle version: 10 g
    OS: Windows / Linux

    Please suggest me book Architecture Oracle and concepts.
    I want to understand oracle architecture and basic concepts of each theme.
    I have basic/initial understanding of concepts and architecture, but I want to make my clear understanding with knowledge.

    Thank you

    You've already got great suggestions in the first answer, of Centinul.

    What you're looking for?

    If you have not already during the studies of the OCA, be sure to read Concepts guide/book of end-to-end a couple of times.

    As you get more comfortable, refer to the guide of the Admin, reference manuals, etc. in the section "Support the Documentaion" for more details. Concepts guide of course includes links to relevant and specific topics in other books in the library of documents.

    In addition, it can help learning (and remembering) If you have a lab nearby, database server so that you can practice stuff alongside read on this subject.

    Edit:
    Response was for last message to the op above.

    Published by: orafad on January 25, 2012 21:51

  • MySQL to Oracle query

    Hello World ^^

    I just downloaded Oracle XE and migrated my database from MySQL to Oracle successfully.
    And I'm doing/reviewing my application now especially the query syntax.
    I am facing a problem, I have a request in the form below in MySQL and it works fine but when I tried it at the Oracle XE database, it cannot run :( So I'm asking for help here, I have already searched on the internet but had no luck.

    SELECT A.INVOICEDATE,
    *@Step1:=cast (adddate (A.INVOICEDATE, A.TERMOFPAYMENT) as date) AS STEP1, *.
    *@Step2:=if (@step1 > CURDATE (), A.TOTALAMOUNT, 0) AS STEP2, *.
    *@step3:=if (@step2 <>0,0,IF(DATEDIFF(CURDATE(),@step1) < = 30, A.TOTALAMOUNT, 0)) AS step 3,
    T_invoice FROM has
    WHERE A.STATUS = 'Open'

    I can conclude the problem is based on the variable declaration in Oracle, but I still can't understand.
    What I do in MySQL, it's that I want to fill the variable with the expression/logic so I can use 'than' variable more later in the other part of the query output syntax.
    I used variables to be filled by value due to I can't use / select ALIAS later in the other party.

    So please help to convert to Oracle query syntax. Thank you.

    Oracle and MySql are two different animals. You need to learn SQL and Oracle's PL/SQL.

    Your SQL

    SELECT A.INVOICEDATE,
    @step1:=cast(ADDDATE(A.INVOICEDATE,A.TERMOFPAYMENT) as date) AS STEP1,
    @step2:=IF(@step1>CURDATE(),A.TOTALAMOUNT,0) AS STEP2,
    @step3:=IF(@step20,0,IF(DATEDIFF(CURDATE(),@step1)<=30,A.TOTALAMOUNT,0)) AS STEP3,
    FROM t_invoice A
    WHERE A.STATUS='Open' 
    

    Can be writern as

    select invoicedate,
           step1,
           step2,
           case when step2 = 0
                then case when sysdate-step1 <=30 then A.TOTALAMOUNT else 0 end
           end AS step3
      from (
             select A.invoicedate,
                    A.invoicedate+A.termofpayment step1,
                    case when (A.invoicedate+A.termofpayment) > sysdate then A.totalamount else 0 end as step2,
               from t_invoice A
              where A.status = 'Open'
           )
    
  • How Oracle query space on versions

    Hey Geeks,

    I'm doing a spatial query to find the intersection of polygons.

    But the scenario is, for the new user there will be a new version under his name, then he creates features in bentley map and post in Oracle Server.

    Then I need to make the query to find those who intersect but only entities newly created version.

    SELECT c.RECORD_ID FROM VW_LYR_STES c, T_LYR_LND p WHERE c.case_id = 'ABCD019034. '

    AND SDO_RELATE (c.GEOM, p.GEOM, 'mask = anyinteract') = 'TRUE '.

    Any ideas on how to achieve this, queries on the particular version.

    Thanks in advance,

    Ken

    With Workspace Manager you shouldn't really be query the table LT - you should go through the view of high - T_LYR_STES in your case.  You can query the underlying table for the LT, but it's a bit nebulous art.  I use Workspace Manager for years and I've never asked the LT table directly if trying to debug some weird data scenarios.  In the normal course of events, you always pass by the view.

    If the user has not yet merged to the workspace, then you should go to this area of work and request here.  For example

    execute dbms_wm.goToWorkspace(');
    SELECT c.RECORD_ID
    FROM VW_LYR_STES c, T_LYR_LND p
    WHERE c.case_id = 'ABCD019034'
    AND SDO_RELATE(c.GEOM,p.GEOM,'mask=anyinteract') = 'TRUE';
    
  • Oracle query performance.

    In one of my oracle procedure, I make the following query.

    Select plate in amountA from Table1 where Bill_id = billId and CATEGORY = 'A ';

    Select plate in amountB from Table1 where Bill_id = billId and CATEGORY = 'B ';.

    Select plate in amountC from Table1 where Bill_id = billId and CATEGORY = 'C ';

    I want to improve this code block.  I want to make a single request and get the result.

    SELECT
    (Select sum(amount) into amountA from Table1 Where Bill_id=billId and CATEGORY='A') AS x1,
    (Select sum(amount) into amountB from Table1 Where Bill_id=billId and CATEGORY='B') AS x2,
    (Select sum(amount) into amountC from Table1 Where Bill_id=billId and CATEGORY='C') AS x3


    Can be a solution, but I not wish on it.


    Is there a better approach?

    Select sum (decode (category 'A', amount, 0))

    sum (decode(category,'B',amount,0))

    sum (decode(category,'C',amount,0))

    in amountA

    amountB

    amountC

    FROM table1

    where bill_id = billid

    and the category ('A', 'B', 'C');

  • Behavior inconsistent performance Oracle query

    Consider the following query:

    SELECT * FROM ( SELECT ARRM.*, ROWNUM FROM CRS_ARRANGEMENTS ARRM WHERE CONCAT(ARRM.NBR_ARRANGEMENT, ARRM.TYP_PRODUCT_ARRANGEMENT) > CONCAT('0000000000000000', '0000') ORDER BY ARRM.NBR_ARRANGEMENT, ARRM.TYP_PRODUCT_ARRANGEMENT, ARRM.COD_CURRENCY) WHERE ROWNUM < 1000;

    This query is performed on a table that has 10 000 000 entries. While running the query Oracle SQL Developer or my application it takes 4 minutes to run! Unfortunately, it's also the behaviour within the application I am writing. Change the value of 1000 to 10 has no impact, which suggests that he made a full table scan.

    However when the squirrel running the query returns within a few milliseconds. How is that possible? Explain plan generated in squirrel gives:

    Explain plan in SQuirreL

    But a plan different explain is generated in Oracle SQL Developer, for the same query:

    Explain plan in Oracle SQL Developer

    No idea how this difference in behavior is possible? I can't understand it. I tried with JPA and raw JDBC. In the application, I need to parse through 10 000 000 records and this query is used for pagination, so 4 minutes of waiting is not an option (which would take 27 days).

    Note: I use the same Oracle jdbc driver into a squirrel and my application so it's not the source of the problem.

    I also posted this to other web sites, for example

    http://StackOverflow.com/questions/28896564/Oracle-inconsistent-performance-behaviour-of-query

    OK - I created a test (below) case and got the same exact results you did 'test' - a FFS using SQL index * more. I then tested with SQL Developer and got the same results. You are 100 billion sure that you did not have two databases somewhere with the same name?

    SQL> create table crs_arrangements
      2  (nbr_arrangement varchar2(16) not null,
      3   product_arrangement varchar2(4) not null,
      4   cod_currency varchar2(3) not null,
      5   filler1 number,
      6  filler2 number);                                             
    
    Table created.                                                    
    
    SQL> alter table crs_arrangements add constraint crs_pk primary key
      2  (nbr_arrangement, product_arrangement, cod_currency);        
    
    Table altered.                                                    
    
    REM generate some data
    
    SQL> select count(*) from crs_arrangements;          
    
      COUNT(*)
    ----------
      10000000                                           
    
    SQL> exec dbms_stats.gather_table_stats('HR', 'CRS_ARRANGEMENTS', cascade=>true);
    
    SQL> ed
    Wrote file afiedt.buf                                                        
    
      1  explain plan for
      2  SELECT * FROM
      3    ( SELECT ARRM.*, ROWNUM FROM CRS_ARRANGEMENTS ARRM
      4      WHERE CONCAT(ARRM.NBR_ARRANGEMENT, ARRM.PRODUCT_ARRANGEMENT) > CONCAT('
    0000000000000000', '0000')
      5* ORDER BY ARRM.NBR_ARRANGEMENT, ARRM.PRODUCT_ARRANGEMENT, ARRM.COD_CURRENCY)
    WHERE ROWNUM < 1000
    SQL> /                                                                       
    
    -------------------
    | Id  | Operation                      | Name             | Rows  | Bytes | Cost
    (%CPU)| Time     |
    --------------------------------------------------------------------------------
    -------------------
    |   0 | SELECT STATEMENT               |                  |   999 | 55944 |  112
    7   (0)| 00:00:14 |
    |*  1 |  COUNT STOPKEY                 |                  |       |       |
           |          |
    |   2 |   VIEW                         |                  |  1000 | 56000 |  112
    7   (0)| 00:00:14 |
    |   3 |    COUNT                       |                  |       |       |
           |          |
    |   4 |     TABLE ACCESS BY INDEX ROWID| CRS_ARRANGEMENTS |   500K|    17M|  112
    7   (0)| 00:00:14 |
    |*  5 |      INDEX FULL SCAN           | CRS_PK           |  1000 |       |   13
    0   (0)| 00:00:02 |      
    

    However, as noted earlier in this thread:

    alter session set NLS_SORT = FRENCH;
    
    |   0 | SELECT STATEMENT        |                  |   999 | 55944 |       | 202
    85   (1)| 00:04:04 |
    |*  1 |  COUNT STOPKEY          |                  |       |       |       |
            |          |
    |   2 |   VIEW                  |                  |   500K|    26M|       | 202
    85   (1)| 00:04:04 |
    |*  3 |    SORT ORDER BY STOPKEY|                  |   500K|    17M|    24M| 202
    85   (1)| 00:04:04 |
    |   4 |     COUNT               |                  |       |       |       |
            |          |
    |*  5 |      TABLE ACCESS FULL  | CRS_ARRANGEMENTS |   500K|    17M|       | 155
    48   (1)| 00:03:07 | 
    

    Can you check your preferences of SQL Developer under database-> NLS and ensure that sorting is set to BINARY? I wonder if either he is on something else in SQL Developer or maybe your by default, the database is not BINARY and squirrel is assigning BINARY when connecting.

  • Oracle query setting

    Hello

    We are generating SSRS reports based on Oracle DB as backend. We are using oracle 11.2.0.3. We have a request in oracle that is created on the view and lots of conditions. It takes more than 8 minutes to generate a report. What are the steps I should follow to refine the query to generate report in very less time. Can someone suggest me please.

    Thank you

    VI

    Good to hear! The appearance to explain what now?

    How long does it take?

    [edit] Cartesian join are not always bad, however, they are usually a good candidate to look at on a long running (in my experience anyway) query [/ edit]

    If the answer to the question, the brand is so

  • Oracle query sort by case-sensitivity

    Hi all

    I use the oracle 11g database.

    My use case is that I have a table with the following values

    Name table - test

    product id     productsortdescription
    H58098        ACETAMIDOHYDROXYPHENYLTHIAZOLE
    043994         Alloy .MM.INTHICK
    

    My query is

    select * from test order by productsortdescription;
    

    This query gives the result as it is like

    product id productsortdescription

    H58098 ACETA

    product id productsortdescription

    H58098 ACETA

    produit id productsortdescription

    H58098 ACETA

    product id     productsortdescription

    H58098        ACETA

    product id     productsortdescription
    H58098        ACETAMIDOHYDROXYPHENYLTHIAZOLE
    043994         Alloy .MM.INTHICK
    

    MIDOHYDROXYPHENYLTHIAZOLE

    043994 alloy. MR. INTHICK

    but early output/outcome should be as below:

    product id productsortdescription

    043994Alloy. MR. INTHICK

    H58098 ACETAMIDOHYDROXYPHENYLTHIAZOLE

    like all and ACE in productsortdescription

    l is in a small suitcase to C.

    The NLS Session parameters are as follows

    SELECT * from NLS_SESSION_PARAMETERS;

    NLS_LANGUAGE AMERICAN

    NLS_TERRITORY AMERICA

    NLS_CURRENCY $

    NLS_ISO_CURRENCY AMERICA

    NLS_NUMERIC_CHARACTERS.,.

    NLS_CALENDAR GREGORIAN

    NLS_DATE_FORMAT DD-MON-RR

    NLS_DATE_LANGUAGE AMERICAN

    NLS_SORT BINARY

    NLS_TIME_FORMAT HH.MI. SSXFF AM

    NLS_TIMESTAMP_FORMAT-DD-MON-RR HH.MI. SSXFF AM

    NLS_TIME_TZ_FORMAT HH.MI. SSXFF AM TZR

    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI. SSXFF AM TZR

    NLS_DUAL_CURRENCY $

    BINARY NLS_COMP

    NLS_LENGTH_SEMANTICS BYTES

    NLS_NCHAR_CONV_EXCP FAKE

    Please, help me in this scenario.

    One option is to use the NLSSORT function. Most of the ASCII character set defines the sort lowercase before uppercase but EBCDIC kinds of lowercase before uppercase. So you can use

    with t as)

    Select the id "H58098", "ACETAMIDOHYDROXYPHENYLTHIAZOLE" union str double all the

    SELECT id, ' 043994 ',' alloy. Mr. INTHICK' double str

    )

    SELECT id, str

    t

    NLSSORT order (str, 'NLS_SORT = EBCDIC')
    ;

    ID STR

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

    043994 alloy. MR. INTHICK

    H58098 ACETAMIDOHYDROXYPHENYLTHIAZOLE

    Of course, if your strings can contain non-alphanumeric characters, you should check that the sort of EBCDIC order is acceptable for them as well. To check this, you can use something like

    with t (str, ascii) as long as)

    Select chr(level+32), level + 32 double connect by level<=>

    )

    Select str, ascii from t by NLSSORT (str, 'NLS_SORT = EBCDIC')

    ;

    or simply do a search of the internet on EBCDIC. You can also substitute other kinds of language for EBCDIC and see if any of them meet your needs. See Appendix A of the Guide to support globalization for the list of valid values for NLS_SORT.

    You say that you are on 11g - if you want to say 11.2.x, then you can use the listagg function to get a more compact view of the sort order:

    with t (str, ascii) as long as)

    Select chr(level+32), level + 32 double connect by level<=>

    )

    Select listagg (str) in the Group (order by NLSSORT (str, 'NLS_SORT = EBCDIC')) as EBCDIC_order

    t

    ;

    EBCDIC_order


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

    . <(+|&!$*);- %_="">?': #@'="abcdefghijklmnopqr~stuvwxyz[^]{ABCDEFGHI}JKLMNOPQR\STUVWXYZ0123456789

    Kind regards

    Bob

  • Hierarchical Oracle query help needed - path between the crux of two brothers and sisters

    I want to find the path between two nodes of oracle hierarchical Table.

    Consider the following case-
    NodeId - ParentId
    =============
    1 > > > > > > 0
    2 > > > > > > 1
    3 > > > > > > 2
    4 > > > > > > 3
    5 > > > > > > 0
    6 > > > > > > 5
    Here I want to query the database table that if there is a path between nodes 3 and 5?
    The previous query you provided work upwards to the root node.

    Here is my expected result, 3-> 2-> 1-> 0-> 5

    Yet once if I have a query in the table to get the path between 1 and 3, I want to get out of the way - next
    1-> 2-> 3

    Therefore, the query works in both cases. Where ADI root can act as an intermediate or no node.

    Can you please guide me how I can get it?

    Thank you.

    Hello

    user13276471 wrote:
    I want to find the path between two nodes of oracle hierarchical Table.

    Consider the following case-
    NodeId - ParentId
    =============
    1 >>>>>> 0
    2 >>>>>> 1
    3 >>>>>> 2
    4 >>>>>> 3
    5 >>>>>> 0
    6 >>>>>> 5
    Here I want to query the database table that if there is a path between nodes 3 and 5?
    The previous query

    What application is this? If you're referering to another thread, then post a link, such as {message identifier: = 10769125}

    you provided work upwards to the root node.

    Here is my expected result, 3--> 2--> 1--> 0--> 5

    Yet once if I have a query in the table to get the path between 1 and 3, I want to get out of the way - next
    1--> 2--> 3

    Therefore, the query works in both cases. Where ADI root can act as an intermediate or no node.

    Can you please guide me how I can get it?

    I think you want something like this:

    WITH     bottom_up_from_src    AS
    (
         SELECT     nodeid
         ,     parentid
         FROM     table_x
         START WITH     nodeid      = :src_nodeid
         CONNECT BY     nodeid   = PRIOR parentid
    )
    ,     bottom_up_from_dst     AS
    (
         SELECT     *
         FROM     bottom_up_from_src
        UNION ALL
         SELECT     parentid     AS nodeid
         ,     nodeid          AS parentid
         FROM     table_x
         WHERE     nodeid     NOT IN (
                                          SELECT  nodeid
                                   FROM    bottom_up_from_src
                                      )
         START WITH     nodeid        = :dst_nodeid
         CONNECT BY     nodeid        = PRIOR parentid
    )
    SELECT      :src_nodeid || SYS_CONNECT_BY_PATH (parentid, '-->')     AS display_path
    FROM       bottom_up_from_dst
    WHERE       parentid     = :dst_nodeid
    START WITH  nodeid     = :src_nodeid
    CONNECT BY  nodeid     = PRIOR parentid
    ;
    

    This will show how you can get it from: src_nodeid at dst_nodeid, moving to the top or to the bottom of a hierarchy at a time step. This will work regardless of the fact that


    • : src_nodeid is the ancestor of the: dst_nodeid, or
    • : src_nodeid is a descendant of: dst_nodeid, or
    • both: src_nodeid and: dst_nodeid are the descendants of another node (e.g. 0).

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) and also publish outcomes from these data.
    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). It is always important, but particularly so with CONNECT BY queries, because each version since Oracle 7 had significant improvements in this area.
    See the FAQ forum {message identifier: = 9360002}

  • Requests deployment architecture Oracle Timesten Geo-redundent

    Hello

    We have 6 sites and each site to connect with the line of lease.

    There are 5 different physical Remote Site, we want to deploy the database to the active / standby timesten on 5 sites
    We want to create READ ONLY CACHE LOCAL GROUP for each 5 Sites which is unique site automatic updating (2 node RAC) Central database
    Data changes always happen on the Central Site.

    Oracle timesten active / standby is LAN on each site, but each site is connected via WAN to the Local Central site where the Oracle RAC database
    and configure the Cache to connect each site for Auto refresh read only Cache and a Local Group on each site.


    OVERVIEW OF THE ARCHITECTURE

    Remote Site location-1 == > (read cache only Local Group) Oracle TT c/o < < = auto-refresh <-|
    ||
    Location of Site remote-2 == > (read cache only Local Group) Oracle TT c/o < < = auto-refresh <-| (CENTRAL LOCATION)
    ||
    Remote Site location-3 == > (read cache only Local Group) Oracle TT c/o < < = auto-refresh <-| (Database RAC 2 knots)
    ||
    Remote Site location-4 == > (read cache only Local Group) Oracle TT c/o < < = auto-refresh <-|
    ||
    Remote Site location-5 == > (read cache only Local Group) Oracle TT c/o < < = auto-refresh <-|

    We pass below Oracle technical document.
    http://www.Oracle.com/technetwork/database/performance/WP-IMDB-cache-130299.PDF
    Please check the Figure 7 == > differentials Autorefresh of Read - Only Cache of local groups

    Please suggest your advice and your suggestion for above deployment architecture

    Concerning
    Hitgon

    Published by: hitgon on 10 July 2012 18:44

    Published by: hitgon on 10 July 2012 18:46

    There are many things that you must understand and keep in mind when implementing a complex system, and it is oexception n. You should start by studying documentation TimesTen. In particular you should familiarize yourself with the information in the Cache User Guide and the Guide of the replication. These contain a lot of very important information regarding the installation/deployment and operation c/o pairs and groups of cache, configuration cache link for CARS etc. You should also read through the troubleshooting guide to familiarize yourself with what things to look if things do not seem to work as expected.

    If you are not already familiar with TimesTen, I would also highly recommend that you take the time to read the rest of the documentation. TimesTen is not Oracle Db and it is very compatible with Oracle in many areas, there are also many significant differences you need to consider when developing applications, management of the etc system, if you are able to take a training course OR on Timesten then I would recommend but if not then read the documentation is a good second best.

    It is "not recommended" operating systems specifically, but 64-bit Linux is definitely a good choice. You might consider Oracle Enterprise Linux instead of Redhat; It has some advantages.

    In each site, the two nodes in the pair of active / standby TimesTen should be on the same local network. I would recommend GigaBit ethernet as a minimum.

    Although it is possible to write your own scripts much easier (and much more robust) handful of deployment, monitoring, failover and recovery of pairs a/s there a lot, if you deploy Oracle Clusterware on each site for automated management of the pairs a/s. It is our strong recommendation and is also recommended.

    From a point of view TimesTen, system clock synchronization is necessary within each site (i.e., the clocks on both nodes in a system have? Pair of S must be closely aligned). However, it may be desirable to have all nodes in all sites have their clocks in line for other reasons.

    You must ensure that the bandwidth and latency of the WAN connections is sufficient for the amount of traffic to refresh you. There is no simple way to estimate/calculate this. you will need to determine empirically.

    These are probably the most important things. As you progress, you can of course ask questions in this forum and use Oracle.

    Chris

  • some doubts in the conversion of oracle query

    I have to convert the following query in ms access to oracle.

    INSERT INTO the Bill (Reffacture, InvoiceDesc)
    Select a_Invoices! [Ref provider] & "-" & Trim (a_Invoices! [invoice No.]) & "Q" & DatePart ("q", [invDate]) & "-" & DatePart("yyyy",[invDate]) & "SB" as Reffacture.
    Trim (a_Invoice_Desc! [Invoice line Description]) AS a Expr4
    Of a_Invoices a_Invoice_Desc INNER JOIN
    WE (a_Invoices. [Ref provider] is a_Invoice_Desc. [Ref provider])
    AND (a_Invoices. [Invoice No.] is a_Invoice_Desc. [Invoice No.)]
    WHERE (((a_Invoices. [<>ACK GL account]) »--- »)) ;

    for the quarter, I tried with select to_char (to_date ("PRVBTOT", "dd/mm/yy '"), 'Q') as quarterdate of "a_Invoices" - it worked, but how to combine all the

    Hello

    882431 wrote:
    Thanks for the input... I have another doubt based on the date

    I have a date stored in a field of type varchar, n'm copy in the date field

    For example: ' 18/4/2011 0:0:0.0' varchar field is, I tried with "' 2011/4/18 as yyyy/mm/dd ', I can add hh: mm: for the moment (I wasn't looking this), but there is one.0, can someone please tell me how shud convert it..." Sorry if asking a basic question, I already searched but to no avail.

    DATEs do not include fractions of a second. If you don't mind losing fractions of a second, you can simply remove them before pass the string to TO_DATE, like this

    TO_DATE ( REGEXP_REPLACE ( varchar2_column
                    , '\.[0-9]*$'
                    )
         , 'YYYY/MM/DD HH24:MI:SS'
         )
    

    REGEXP_REPLACE will remove the decimal point and any numbers after him. If the string does not contain a decimial, it is correct: REGEXP_REPLACE returns the immutable string in this case.

    If the fraction of a second is important, use a TIMESTAMP instead of a DATE column (and use the TO_TIMESTAMP instead of TO_DATE function).

  • simple oracle query does not not in cf9

    When running in oracle 10 g, this query returns correctly a line:

    WITH myResults AS

    (

    SELECT 1 AS MonNiveau, "someString" AS myData

    OF the double

    )

    SELECT *.

    OF myResults;

    Returns:

    MONNIVEAUMYDATA
    1someString

    When put inside a cfquery in a cf9 page, returns nothing.

    < cfset qryRan = "false" >

    < isDefined ('myQry.recordCount') cfif >

    < cfset qryRan = "true" >

    < / cfif >

    Qry: < cfoutput > #qryRan # < / cfoutput >

    Returns:

    Qry: false

    Yes, the query always had the name the value attribute

    It was certainly the oracle driver, I install v10.1 in parallel with 8.1, recreated my datasources and everything works fine now

    Thanks for the reply

  • Need to improve the performance of oracle query

    Hello
    Currently I wrote the request to get the maximun of XYZ company like this salary

    Select the salary of)
    Select the salary of the employee
    where the company = "XYZ".
    salary desc order)
    where rownum < 2;

    I thought to replace the same with the following query

    Select max (salary)
    the employee
    where the company = "XYZ";

    That one will be faster? can you provide some statistical data. It will be good if you share an oracle for this documentation.

    Thank you
    Khaldi

    Well, that's your requests, your data contained in your database, on your hardware... Anything that can have an impact. So who better to check if there is no difference in performance than yourself?

    Enable SQL tracing, run the statements, then analyze trace (with the help of tkprof or similar) files and look at the differences.

  • Hierahical Oracle query

    Can you help me get crawl space resulting from the oracle table. Here especially, I want to get the Qty_above columns. It is calculated as

    qty_above = the parent node qty_above * Qty value of the current node.

    Name of the table: -.

    project_product_structure_tab
    . Table create statement given the bottom of the page.


    create table PROJECT_PRODUCT_STRUCTURE_TAB

      seq_no   NUMBER not null,

    parent_seq_no NUMBER ,

    sorting_code NUMBER not null,

    modified_structure VARCHAR2 (1) not null,

      qty  NUMBER not null,

      rental   VARCHAR2(30),

      pos   VARCHAR2(10) not null,

    customer_part_no VARCHAR2 (80),

    customer_part_desc VARCHAR2 (200),

    information VARCHAR2 (2000),

      site   VARCHAR2(5),

    mrp_code NUMBER ,

    proj_work NUMBER ,

    proj_level_work NUMBER ,

    Calc_WORK NUMBER ,

    dt_calc_work DATE ,

    dt_calc_hour DATE ,

    dt_cre DATE not null,

    user_created VARCHAR2 (30) not null,

    dt_chg DATE ,

    user_sign VARCHAR2 (30),

    operation_list_template VARCHAR2 (10),

    calc_value NUMBER ,

    dt_calc_value DATE ,

    dt_designed DATE ,

    dt_realized DATE ,

    aquisition_code VARCHAR2 (1) not null,

    part_no VARCHAR2 (25) not null,

    part_rev VARCHAR2 (6) not null,

    project VARCHAR2 (10) not null,

    tag_no VARCHAR2 (20),

    activity_seq NUMBER ,

    part_responsible VARCHAR2 (20),

    serial_no VARCHAR2 (50),

    dt_received DATE ,

    dt_issued DATE ,

    qty_above NUMBER ,

    qty_received NUMBER ,

    qty_issued NUMBER ,

    rowversion DATE not null,

    RowState VARCHAR2 (20) not null,

    part_ownership VARCHAR2 (20) not null,

    supply_option VARCHAR2 (20),

    net NUMBER ,

    qty_assigned NUMBER ,

    reservation_type VARCHAR2 (10),

    reserve_at_receipt NUMBER not null,

    text_id$ VARCHAR2 (50) default SYS_GUID() not null,

    provide VARCHAR2 (7),

    RowKey VARCHAR2 (50) default sys_guid() not null,

    supply_created VARCHAR2 (20) not null,

    configuration_id VARCHAR2 (50) not null,

    use_project_operations VARCHAR2 (20) not null,

    build_structure_date DATE ,

    config_modified_date DATE ,

    ADDRESS_ID VARCHAR2 (50)

    Like this:

    WITH PROJECT_PRODUCT_STRUCTURE_TAB (seq_no, parent_seq_no, quantity)

    (SELECT 11, NULL, 2 FROM dual UNION ALL)

    SELECT 22,11,3 FROM dual UNION ALL

    SELECT 33,22,4 FROM dual UNION ALL

    SELECT 44,33,5 FROM dual UNION ALL

    SELECT 55,22,6 FROM dual UNION ALL

    SELECT double 66,11,7)

    my_hierarchy (parent_seq_no, seq_no, parent_qty, quantity)

    Did YOU (SELECT seq_no, parent_seq_no, qty, quantity

    OF project_product_structure_tab

    WHERE parent_seq_no IS NULL

    UNION ALL

    SELECT child.seq_no, child.parent_seq_no, child.qty, parent.parent_qty * child.qty

    OF project_product_structure_tab CHILD

    INNER JOIN my_hierarchy ON PARENT (PARENT.seq_no = CHILD.parent_seq_no))

    Select *.

    of my_hierarchy

    /

    HTH

Maybe you are looking for