Tablespace name starting with o1_mf and ending with cb58lw2z_.dbf?

Hi all

I can't figgure where in the database creation process how all tablespaces being named for example, beginning with o1_mf and ending with cb58lw2z_.dbf:

DB_1 > select name from v$ datafile;

NAME
--------------------------------------------------------------------------------
/U01/shared_data/oradata/DB/datafile/o1_mf_system_cb58lw2z_.dbf
/U01/shared_data/oradata/DB/datafile/o1_mf_undotbs3_cb58q00g_.dbf
/U01/shared_data/oradata/DB/datafile/o1_mf_sysaux_cb58krqh_.dbf
/U01/shared_data/oradata/DB/datafile/o1_mf_undotbs1_cb58nbnn_.dbf
/U01/shared_data/oradata/DB/datafile/o1_mf_undotbs2_cb58pznk_.dbf
.
.
.
/U01/shared_data/oradata/DB/datafile/o1_mf_index_cb58pznk_.dbf

Not that it's a big problem, I would like to know how this happens.  Example of how I create a tablespace:

CREATE bigfile TABLESPACE 'INDEX' LOGGING datafile SIZE 100 M AUTOEXTEND ON NEXT 250 M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

DB_1 > select * from v version $;

BANNER                                                                               CON_ID
-------------------------------------------------------------------------------- ----------
Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production 0
PL/SQL Release 12.1.0.2.0 - Production 0
CORE 12.1.0.2.0 Production 0
AMT for Linux: Version 12.1.0.2.0 - Production 0
NLSRTL Version 12.1.0.2.0 - Production 0

Thank you!

2932017 wrote:

Hi all

I can't figgure where in the database creation process how all tablespaces being named for example, beginning with o1_mf and ending with cb58lw2z_.dbf:

DB_1 > select name from v$ datafile;

NAME
--------------------------------------------------------------------------------
/U01/shared_data/oradata/DB/datafile/o1_mf_system_cb58lw2z_.dbf
/U01/shared_data/oradata/DB/datafile/o1_mf_undotbs3_cb58q00g_.dbf
/U01/shared_data/oradata/DB/datafile/o1_mf_sysaux_cb58krqh_.dbf
/U01/shared_data/oradata/DB/datafile/o1_mf_undotbs1_cb58nbnn_.dbf
/U01/shared_data/oradata/DB/datafile/o1_mf_undotbs2_cb58pznk_.dbf
.
.
.
/U01/shared_data/oradata/DB/datafile/o1_mf_index_cb58pznk_.dbf

Not that it's a big problem, I would like to know how this happens.  Example of how I create a tablespace:

CREATE bigfile TABLESPACE 'INDEX' LOGGING datafile SIZE 100 M AUTOEXTEND ON NEXT 250 M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

DB_1 > select * from v version $;

BANNER                                                                               CON_ID
-------------------------------------------------------------------------------- ----------
Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production 0
PL/SQL Release 12.1.0.2.0 - Production 0
CORE 12.1.0.2.0 Production 0
AMT for Linux: Version 12.1.0.2.0 - Production 0
NLSRTL Version 12.1.0.2.0 - Production 0

Thank you!

https://www.Google.com/webhp?hl=en&tab=WW#hl=en&q=Oracle+managed+files

Tags: Database

Similar Questions

  • Temporary tables are themselves created, name starting with BIN$...

    Hello

    I use Oracle 10.2 and a problem that make certain operations on existing tables, some temporary tables to develop starting with BIN$.

    For ex: BIN$ HULdSlmnRZmbCXAl/pkA9w == $0

    But I do not see these tables in the database after two or three days. I found that these temporary tables are a replica of the existing tables and these contain only the structure of the table, but not the data. I couldn't even drop database.

    Can someone throw some tips on this?

    Thank you and best regards,
    Siva

    These paintings are in the trash of Oracle. When you delete a table, Oracle renames just for BIN$ xxx so that you can undrop table if you made a mistake.

    -You can ignore tables in the trash if you wish. Oracle purge them automatically when it needs the space.
    -You can prevent a table goes the trash by adding the command serve down, i.e.

    DROP TABLE table_name PURGE
    

    -You can empty the trash using the command

    SQL> purge dba_recyclebin
    

    (or just recyclebin if you do wish to erase objects you own to the recyclebin).

    Justin

  • dimension members start with zero (0)?

    Is it possible to have essbase dimension member names starting with number as say 0123? Its getting stored as 123. The 0 (zero) as the first alphabet is ignored. Pls help.

    Certainly possible. Naming limitations are described here: Naming Conventions for Essbase

    What do you mean when you say that it is getting "stored" without the zero? I wonder if your recovery in Excel and Excel is stripping the leading zero significant (use an apostrophe as a prefix in Excel in this case).

  • Breaking a year in coming weeks of beginning and end Dates (parameters) and first and last day of the month

    Hello people:

    I have currently a query that picks up all the weeks between a date range where my week starts on Thursday and ends on Wednesday. The following query works fine except that I need the week of beginning and end, from beginning and end Dates of months and the beginning and the Dates of end of the values of the settings, I'm passing. In this case, I chose January 1, 2013 to 31 December 2013.

    Any help or pointers would be great!

    Thank you!

    Problem: I am picking up days of December 2012 as the first week began on December 27, 2012. In addition, in December, I'm pretty much lost last week as well (26 December - 31 December).

    The request in hand:

    SELECT first_thursday + (7 * (LEVEL - 1))   AS week_start_date,
                     first_thursday + (7 * LEVEL) - 1    AS  week_end_date
    FROM
    (
      SELECT TRUNC(p_from_date + 4, 'IW') - 4   AS first_thursday, -- Week should start the pre ceeding THURSDAY based on the Start Date
                      TRUNC( p_to_date + 4,  'IW') - 5     AS last_wednesday
      FROM
      (
        SELECT to_date('01-JAN-2013') AS p_from_date,
                        NVL(to_date('31-DEC-2013'), SYSDATE) AS p_to_date
        FROM     dual
      ) parms
    ) end_points
    CONNECT BY LEVEL <= ( last_wednesday + 1 - first_thursday)/7;
    

    Currently, this is the result I get (I'm only including the months of January and December here).

    Week_Start_Date     Week_End_Date
    27-DEC-12                02-JAN-13
    03-JAN-13                 09-JAN-13
    10-JAN-13                 16-JAN-13
    17-JAN-13                 23-JAN-13
    24-JAN-13                 30-JAN-13
    31-JAN-13                 06-FEB-13
    

    December:

    28-NOV-13               04-DEC-13
    05-DEC-13              11-DEC-13
    12-DEC-13              18-DEC-13
    19-DEC-13              25-DEC-13
    

    What I would really like is based on start and end Dates, as well as the first and the last day of the month is similarly try nicely. I have provided and then gently break at the end of the month:

    January:

    01-JAN-13              02-JAN-13
    03-JAN-13              09-JAN-13
    10-JAN-13             16-JAN-13
    17-JAN-13             23-JAN-13
    24-JAN-13             30-JAN-13
    31-JAN-13             31-JAN-13
    

    February:

    01-FEB-13    06-FEB-13
    07-FEB-13    13-FEB-13
    14-FEB-13    20-FEB-13
    21-FEB-13    27-FEB-13
    28-FEB-13    28-FEB-13
    

    November:

    31-OCT-13    06-NOV-13
    07-NOV-13    13-NOV-13
    14-NOV-13    20-NOV-13
    21-NOV-13    27-NOV-13
    28-NOV-13    04-DEC-13
    

    December:

    01-DEC-13           04-DEC-13
    05-DEC-13           11-DEC-13
    12-DEC-13          18-DEC-13
    19-DEC-13          25-DEC-13
    26-DEC-13          31-DEC-13
    

    Hello

    Roxyrollers wrote:

    Hello people:

    I have currently a query that picks up all the weeks between a date range where my week starts on Thursday and ends on Wednesday. The following query works fine except that I need the week of beginning and end, from beginning and end Dates of months and the beginning and the Dates of end of the values of the settings, I'm passing. In this case, I chose January 1, 2013 to 31 December 2013.

    Any help or pointers would be great!

    Thank you!

    Problem: I am picking up days of December 2012 as the first week began on December 27, 2012. In addition, in December, I'm pretty much lost last week as well (26 December - 31 December).

    The request in hand:

    1. First_thursday SELECT + (7 * (LEVEL - 1)) AS week_start_date,
    2. first_thursday + (7 * LEVEL)-1 AS week_end_date
    3. Of
    4. (
    5. SELECT TRUNC (p_from_date + 4, 'IW') - 4 AS first_thursday,-week should start to perform the pre-mounted THURSDAY based on the Start Date
    6. TRUNC (p_to_date + 4, 'IW') - 5 AS last_wednesday
    7. Of
    8. (
    9. SELECT to_date('01-JAN-2013') AS p_from_date,
    10. NVL (to_date('31-Dec-2013'), SYSDATE) AS p_to_date
    11. OF the double
    12. ) parms
    13. ) end_points
    14. CONNECT BY LEVEL<= (="" last_wednesday="" +="" 1="" -="">

    Currently, this is the result I get (I'm only including the months of January and December here).

    1. Week_Start_Date Week_End_Date
    2. DECEMBER 27, 12 2 JANUARY 13
    3. JANUARY 3, 13 JANUARY 9, 13
    4. 10 JANUARY 13 JANUARY 16, 13
    5. 17 JANUARY 13 23 JANUARY 13
    6. 24 JANUARY 13 30 JANUARY 13
    7. 31 JANUARY 13 FEBRUARY 6, 13

    December:

    1. NOVEMBER 28, 13 4 DECEMBER 13
    2. 5 DECEMBER 13 DECEMBER 11, 13
    3. 12 DECEMBER 13 18 DECEMBER 13
    4. 19 DECEMBER 13 DECEMBER 25, 13

    What I would really like is based on start and end Dates, as well as the first and the last day of the month is similarly try nicely. I have provided and then gently break at the end of the month:

    January:

    1. JANUARY 1, 13 2 JANUARY 13
    2. JANUARY 3, 13 JANUARY 9, 13
    3. 10 JANUARY 13 JANUARY 16, 13
    4. 17 JANUARY 13 23 JANUARY 13
    5. 24 JANUARY 13 30 JANUARY 13
    6. 31 JANUARY 13 JANUARY 31, 13

    February:

    1. 1ST FEBRUARY 13 FEBRUARY 6, 13
    2. 7 FEBRUARY 13 FEBRUARY 13, 13
    3. 14 FEBRUARY 13 FEBRUARY 20, 13
    4. 21 FEBRUARY 13 FEBRUARY 27, 13
    5. 28 FEBRUARY 13 FEBRUARY 28, 13

    November:

    1. 31 OCTOBER 13 NOVEMBER 6, 13
    2. 7 NOVEMBER 13 NOVEMBER 13, 13
    3. 14 NOVEMBER 13 NOVEMBER 20, 13
    4. 21 NOVEMBER 13 NOVEMBER 27, 13
    5. NOVEMBER 28, 13 4 DECEMBER 13

    December:

    1. 1ST DECEMBER 13 DECEMBER 4, 13
    2. 5 DECEMBER 13 DECEMBER 11, 13
    3. 12 DECEMBER 13 18 DECEMBER 13
    4. 19 DECEMBER 13 DECEMBER 25, 13
    5. 26 DECEMBER 13 DECEMBER 31, 13

    Why the "weeks" in November, have all 7 days, while the "weeks" in the first or the last week in the other month usually have less?  (For example, February 28 is a 'week' alone.)

    The following works for the other months:

    WITH all_days AS

    (

    SELECT DATE "2013-01-01' + LEVEL - AS a_date 1

    OF the double

    CONNECT BY LEVEL<=>

    )

    SELECT DISTINCT

    More GRAND (TRUNC (a_date + 4, 'IW') - 4)

    , TRUNC (a_date, 'MONTH')

    ) AS week_begin

    , The LEAST (TRUNC (a_date + 4, 'IW') + 2

    TRUNC (LAST_DAY (a_date))

    ), Week_end

    Of all_days

    ORDER BY week_begin

    ;

    Output:

    WEEK_BEGIN WEEK_END

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

    January 1, 2013 January 2, 2013

    January 3, 2013 January 9, 2013

    January 10, 2013 January 16, 2013

    January 17, 2013 January 23, 2013

    January 24, 2013 January 30, 2013

    January 31, 2013 January 31, 2013

    February 1, 2013 February 6, 2013

    February 7, 2013 February 13, 2013

    February 14, 2013 February 20, 2013

    February 21, 2013 February 27, 2013

    February 28, 2013 February 28, 2013

    ...

    November 1, 2013 November 6, 2013

    November 7, 2013 November 13, 2013

    November 14, 2013 November 20, 2013

    November 21, 2013 November 27, 2013

    November 28, 2013 November 30, 2013

    December 1, 2013 December 4, 2013

    December 5, 2013 December 11, 2013

    December 12, 2013 December 18, 2013

    December 19, 2013 December 25, 2013

    26 December 2013 31 December 2013

  • Find the string starts with a string and ending with a year

    Hi all

    I have the following situation.

    I'm in a string TVTdamacus LKK214/342009sstLKK
    I need to select the channel that begin withLKK and end a year. This year can be any year. In this case it is 2009, but it can also be 2012
    In this case the right string would be LKK214/342009
    Does anyone have an idea how I can do this.
    I thank in advance for your help is.

    --------------------------------------------------------------------------------
    Create table test (identification number, name varchar2 (100));

    Insert into test (id, name)
    values (1,'TVTdamacus LKK214/342009sstLKK ');

    Insert into test (id, name)
    values (2,'TVTdamacus LKK24/342012sstLKK ');

    I missed the 'between condition of 20 years' in the above query.

    Fix here...

    SQL> WITH test AS
      2  (
      3      SELECT 1 id,'TVTdamacus LKK214342009sstLKK' name FROM dual UNION all
      4      SELECT 1 id,'TVTdamacus LKK214341999sstLKK' name FROM dual UNION all
      5      SELECT 2 id,'TVTdamacus LKK24/342012sstLKK' name FROM dual UNION all
      6      SELECT 1 id,'TVTdamacus LKK214341989sstLKK' name FROM dual UNION all
      7      SELECT 2 id,'TVTdamacus LKK24344012sstLKK' name FROM dual
      8  )
      9  SELECT
     10      id,
     11      name,
     12      case when to_number(substr(REGEXP_SUBSTR (name, 'LKK[0-9]+[[:digit:]]{4}'),-4))
     13              between extract(year from sysdate)-20 and  extract(year from sysdate)
     14           then REGEXP_SUBSTR (name, 'LKK[0-9]+[[:digit:]]{4}')
     15           else null end newstr
     16  FROM test;
    
            ID NAME                          NEWSTR
    ---------- ----------------------------- -----------------------------
             1 TVTdamacus LKK214342009sstLKK LKK214342009
             1 TVTdamacus LKK214341999sstLKK LKK214341999
             2 TVTdamacus LKK24/342012sstLKK
             1 TVTdamacus LKK214341989sstLKK
             2 TVTdamacus LKK24344012sstLKK
    
  • Does anyone have the keyboard shortcut start and end of selection of audio with CS6?

    Does anyone know the keyboard shortcut for beginner and ending an audio selection with CS6?  Cannot use mouse - rely on the keyboard to change.

    By default 'I' and 'o' for inside and out. Shortcuts see keyboard/Edit

  • New session started with an advertising page and all my tabs are lost

    New session started with an advertising page and all my tabs are lost. Restore the previous session is not active. How can I restore my tabs?

    Great work!

    Sessionstore.bak files are ancient, probably autour time that you have installed Firefox 33 when the sessionstore-backup folder has been added.

    To try using one or more files in the sessionstore-backup folder, here is the process:

    (1) exit Firefox and it must create a sessionstore.js from the main level of the profile folder file.

    (2) rename sessionstore.js to sessionstore.old file, or if you think that you will ever need, delete it.

    (3) copy in recovery.js or previous.js and rename sessionstore.js.

    (4) start Firefox then try to restore previous Session. Those are the tabs you want? If this isn't the case, you can try one of the other files in your backup sessionstore-backup.

    If none of the files has the missing tabs, you could try a recent Windows restore point. It's more complicated on Windows 8 on Windows 7, and you could benefit from using a third-party utility. These have been mentioned in another thread:

    Or... I read on a roundabout way to get previous Versions on the Properties dialog box in Windows 8. I can't test it myself, but here's what you do:

    In the address bar of your Windows Explorer dialog box, replace the current path with the following and press ENTER:

    \\localhost\c$

    Then click at the end and nail on the following (with your user name) and press ENTER:

    \Users\username\AppData\Roaming\Mozilla\Firefox\Profiles

    That should help you in the vicinity of your profile folder. Then you can right-click sessionstore.js > properties > Previous Versions, or try one of the files in sessionstore-backups.

  • Increment Dt start with day greater than the Dt at the end of the year Prev in Pro * C

    Morning people and greetings from Toronto.

    I'm trying to change a Pro * C program. Since ages I touched a Pro * C program but I have made an attempt for her. I would probably need some help andhopefully is the right forum I could nto seem to find any section decicated Pro * C programs.

    Here's what its supposed to do. I'm supposed to check if a Start Date of overlap between the start dates and dates from the end of the previous year, and if so, I'm supposed to assign one day Start Date greater than the Date of the end of the previous year.

    I have a control panel that stores records for start date and end Date for each year. Here's what I have for 2010.

    Start date = 8 May 2010 '; End date = may 12, 2011 'year =' 2010 From now the previous record in the table 1 (where the new record is supposed to be inserted) has a record that looks like this:
    DOC_ID     NAME               YEAR         START_DATE     END_DATE
    ------------------------------------------------------------------------------------------------
    999999     Mary Poppins      2009         03-May-2009      08-May-2010
    Now, based on the control table, the Start Date for 2010 coincides with the Date of the end of 2009. In this case, I would need to move the start date = may 9, 2010 "(Date of end + 1)

    Here is my ProC program in hand
    /* Include Headers */
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <ctype.h>
    #include <math.h>
    ---------------------------
    /* Define constants */
    ---------------------------
    #define  nullterm(string) string.arr[string.len] = '\0';
    /* SQL Host Variables */
    exec sql begin declare section;
    exec sql include sqlca;
    
     varchar   ctrl_start_date[11];
     short     ctrl_start_date_ind;
     varchar   ctrl_end_date[11];
     short     ctrl_end_date_ind;
    
     varchar   end_date[11];
     short     end_date_ind;
    
     int       exist_end_date_flag;
     short     exist_end_date_flag_ind;
    
    exec sql end declare section;
    
    
    /* Function Prototypes */
    
    void check_date_overlap();
    
    
    void main(int argc, char *argv[])
    {
    /* Coding starts here */
    
    void get_ctrl_dates()
    {
     exec sql
      select  to_char(trunc(ctrl_start_date),'YYYY/MM/DD'),
              to_char(trunc(ctrl_end_date),'YYYY/MM/DD')
      into    :ctrl_start_date :ctrl_start_date_ind,
              :ctrl_end_date  :ctrl_end_date_ind
      from    control_tb
      where   current_yyyy = :year_number;
    }
    
       check_date_overlap();
    
       if (strcmp( (char *)run_mode.arr,"N")==0)
       {
        check_date_overlap();
        create_person_rec(); /* This will insert record into person_tb table */
       }
    }
    
    /***********************/
    /* CHECK_DATE_OVERLAP  */ 
    /***********************/
    void check_date_overlap()
    {
    
     exist_end_date_flag = 0; /* assume he does not have a record */
    
     exec sql
      select count(*), end_date + 1
      into   :exist_end_date_flag exist_end_date_flag_ind,
             :end_date :end_date_ind
      from   person_tb
      where  doc_id = :doc_id
      and (( :ctrl_start_date between start_date  and end_date ) or
           ( :ctrl_end_date   between start_date  and end_date ) or
           ( start_date between :ctrl_start_date  and :ctrl_end_date ) or
           ( end_date   between :ctrl_start_date  and :ctrl_end_date ))
      and    year_number = (:year_number - 1)
      group by end_date
      having count(*) = 1;
    
      /*** Error Check Routine goes in here ***/
    
      /* Overlapping of dates; Set the Start Date equal End Date + 1 to avoid overlap */
      if (exist_end_date_flag == 1)
      {
       print_to_err_file("The Start Date is overlapping with a previous period.",0);
      }
    
       nullterm(end_date);
    
    } /* check_date_overlap */
    Here would be my question:

    My question is, should the SQL above be written like this instead?
    /***********************/
    /* CHECK_DATE_OVERLAP  */ 
    /***********************/
    void check_date_overlap()
    {
    
     exist_end_date_flag = 0; /* assume he does not have a record */
    
     exec sql
      select count(*), end_date
      into   :exist_end_date_flag exist_end_date_flag_ind,
             :end_date :end_date_ind
      from   person_tb
      where  doc_id = :doc_id
      and (( :ctrl_start_date between start_date  and end_date ) or
           ( :ctrl_end_date   between start_date  and end_date ) or
           ( start_date between :ctrl_start_date  and :ctrl_end_date ) or
           ( end_date   between :ctrl_start_date  and :ctrl_end_date ))
      and    year_number = (:year_number - 1)
      group by end_date;
    
      /*** Error Check Routine goes in here ***/
    
      /* Overlapping of dates; Set the Start Date equal End Date + 1 to avoid overlap */
      if (exist_end_date_flag == 1)
      {
        /* Is this even correct or would I have to do a strcpy?.
            Also note that I am overwriting ctrl_start_date which
            was fetched earlier in get_ctrl_dates() */
       ctrl_start_date = end_date + 1;
       print_to_err_file("The Start Date is overlapping with a previous period.",0);
      }
    
       nullterm(end_date);
    
    } /* check_date_overlap */
    Published by: Raj404261 on June 10, 2009 11:21

    You can put your code between the {code}

    As
    {code}
    your code...
    ...
    {code}

    SS

  • When I open a link irc with a string name that contains "~" at the end, firefox (14.0.1) opens the same channel name but with "7%" instead of "~" at the end

    When I open a link irc with a string name that contains "~" at the end, firefox (14.0.1) opens the same channel name but with "7%" instead of "~" at the end
    http://img835.imageshack.us/img835/2856/clipboard05nq.jpg

    I can't open the image, but I can say something in general about the tilde.

    The tilde "~" is an unreserved character and that's why it can be replaced by its form encoded percentage '% 7' inside a URI without changing the meaning. See

    http://en.Wikipedia.org/wiki/percent-encoding

    According to article 2.3 of RFC3986 we should prefer the encrypted form so this behavior seems to be somewhat outdated.

  • IE8 and it just started with a lot of error reports and custom back to the home page

    Well for a reason my first thread is not here so Im start again, I have IE8 and it just started with a lot of error reports and custom back to the homepage it just on the same page of the article, I was reading and said that this tab was recovered, I end up having to close on restarting the program n also since I reloaded my xp cd my sound got rough n jumps, it was well before I did this if Im not sure what to do. Im not exactly smart pc and am afraid of doing something wrong then Im left to do very limited things, any help would be appreciated

    Hello mikegrimesWQ,

    Because it looks like you have reinstalled Windows XP, what happens when you turn on your computer?  Windows loads correctly and allow you to connect with success?  Have you completed all the updates of Windows since the relocation?  Do you get errors at any time?

    What version of Windows XP you are using and which service pack is currently installed?  I would say confirming all your drivers are recognized and updated.

    How to download updates that include drivers and hotfixes from the Windows Update Catalog

    Please let us know status.

    Thank you

    James

  • four digits starting with 1 0001 and not only the numbering.

    How do I re name and renumber a folder of photos and include four numbers starting with 1 0001 and not only the numbering. I need this for an another computer program can keep the images in numeric order

    Now I have number say marriage... 1 Smith_Jones ect up to 659, but a program that I use to create the albumes blurs all my photos because they say the digital system must have 4 digits so number 1 is 0001 so stay in order.  I have d see how to assign 3 zeros on numbers-# 344 front would therefore 0344 LR wants to keep 344.

    In the rename library use the following custom parameters.

  • START WITH and CONNECT BY PRIOR

    Hello

    Database: Oracle 11g

    1.

    SELECT ename, empno, mgr

    WCP

    START WITH empno = 7839

    CONNECT BY PRIOR MGR = EMPNO

    Result set:

    EMPNO, ENAME MGR

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

    KING 7839

    2.

    SELECT empno.ename, Bishop

    WCP

    START WITH mgr = 7839

    CONNECT BY PRIOR MGR = EMPNO

    Result set:

    EMPNO, ENAME MGR

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

    7566 JONES 7839

    7698 BLAKE 7839

    7782 CLARK 7839

    KING 7839

    KING 7839

    KING 7839

    My questions are:

    Q1. What is actually happening in the result defines two queries. I'm not able to grasp the difference when I use START WITH empno = 7839 and START WITH mgr =. 7839

    Q2. What is the difference between

    CONNECTION BY MGR PRIOR = EMPNO and

    CONNECT BY PRIOR EMPNO = MGR?

    can someone please help me here?

    Thank you

    Hello

    A CONNECT BY query looks like an operation UNION ALL of the data of different levels, numbered 1, 2, 3 and more.

    Level 1 is filled with the START WITH clause.

    If there are data on level N, then N + 1 level is filled, using the CONNECT BY clause, which generally refers to something on the N level via the PRIOR operator.  Another way to put it is that level N + 1 is filled by a self-join with lines that have already chosen the level N.

    If there is no data on the level of N, the query stops.

    Let's see how this applies to your queries.

    Level being such an important concept in CONNECT BY queries, you might want to see in all your CONNECT BY queries all test and debug the.

    1 query, including the level are:

    SELECT ename, empno, mgr

    LEVEL

    FROM scott.emp

    START WITH empno = 7839

    Empno = mgr PRIOR CONNECTION

    ;

    You will notice that I have re-arranged the CONNECT BY clause.  I find it a little more clear medium.  Of course, it never changes the results just if you say "x = y" or "y = x.

    The results, including the level, are:

    LEVEL OF ARCHBISHOP EMPNO, ENAME

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

    7839 KING 1

    What happened to produce these results?

    First level 1 has been met using the START WITH clause.  Level 1 is identical to the results of

    SELECT ename, empno, mgr

    AS LEVEL 1

    FROM scott.emp

    WHERE empno = 7839 - same as your START WITH clause

    ;

    It happens to be only 1 row in the table scott.emp who met the empno = 7839 condition, and we show a few columns of this line.

    That's all that need the level 1.  Something has been on level 1, so we're trying now to complete level 2, using the CONNECT BY condition.

    Any line that is included in the level 2 meets the empno = mgr PREREQUISITE condition, where the PREVIOUS operator refers to a line of level 1.  In this case, there is only 1 row at level 1, this line gets to have a NULL mgr.  Given that PRIOR mgr is NULL in this case, the condition to connect BY

    EmpNo = mgr BEFORE equals

    EmpNo = NULL and who obviously won't be true for any line, so nothing is added to level 2, and ends the query.

    Now let's look at application 2.  I'll add another column of debugging, called path, which I'll describe later:

    SELECT ename, empno, mgr

    LEVEL

    , SYS_CONNECT_BY_PATH (empno, "/") AS path

    FROM scott.emp

    START WITH mgr = 7839

    CONNECT BY PRIOR Mgr = empno

    LEVEL CONTROL

    path

    ;

    Output:

    EMPNO, ENAME MGR LEVEL PATH

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

    7566 7839 1 7566 JONES

    7698 7839 1 7698 BLAKE

    7782 7839 1 7782 CLARK

    7839 KING 2/7566/7839

    7839 KING 2/7698/7839

    7839 KING 2/7782/7839

    Again, we'll study how people got 1 level.  It happens to be 3 scott.emp lines that meet this condition START WITH, so there are 3 lines in the game at level 1.

    Given that the data on the level 1, the test of the query to complete level 2, referring to some PRIOR line on level 1.  Any line that meets the condition to connect BY, with a line any level 1 in the PREVIOUS line, will appear at level 2.

    Let's look at the line at level 1 where ename = 'JONES '.  Are there lines in sccott.emp that met the empno = mgr PREREQUISITE condition, where mgr PREREQUISITE is the column of Archbishop of the line with "JONES"?  Yes, there are one, the line with ename = 'KING', so that the rank is included at level 2.

    Let's look at the line at level 1 where ename = 'BLAKE '.  Are there lines in sccott.emp that met the empno = mgr PREREQUISITE condition, where mgr PREREQUISITE is the column of Archbishop of the line with "BLAKE"?  Yes, there are one, the line with ename = 'KING', so that the rank is included at level 2.

    Let's look at the line at level 1 where ename = 'CLARK '.  Are there lines in sccott.emp that met the empno = mgr PREREQUISITE condition, where mgr PREREQUISITE is the column of Archbishop of the line with 'CLARK '?  Yes, there are one, the line with ename = 'KING', so that the rank is included at level 2.

    There are thus 3 rows at level 2.  They happen to all be on the same line of the table emp; It is correct.  Remember, CONNECT BY is like a UNION ALL (not just a UNION).  It is a UNION of

    lines that are at level 1, because him meets the condition to BEGIN WITH, and

    lines that are at level 2 because puts it CONNECT BY condition regarding the 'JONES', and

    lines that are at level 2, because they meet the condition to connect BY regarding the "BLAKE", and

    lines that are at level 2, because they meet the condition to connect BY regarding the "CLARK".

    SYS_CONNECT_BY_PATH can enlighten us on that.  SYS_CONNECT_BY_PATH (empno, ' / ') shows the empno of each level that caused this line appears in the result set.  It's a delimited list /, where the nth element (i.e. the empno after bar oblique nth) is the empno who found the N level.

    Since there were data at level 2, the quert now trying to complete level 3.

    Is there all the rows in the table that satisfy the CONNECT BY condition (mgr PRIOR = empno) with respect to any line level 2?  No, Bishop is be NULL on all lines of level 2, so no line can satisfy this condition CONNECT BY, no lines are added at level 3, and ends the query.

    I hope that answers the question:

    Q1. What is actually happening in the result defines two queries. I'm not able to grasp the difference when I use START WITH empno = 7839 and START WITH mgr =. 7839

    I'll try to not be so detailed answering

    Q2. What is the difference between

    CONNECTION BY MGR PRIOR = EMPNO and

    CONNECT BY PRIOR EMPNO = MGR?

    These 2 CONNECT BY conditions are different where you put the PRIOR operator.  The operator PRIOR to switching as it change the direction, upward or downward, which move you through the tree you get from level to level.

    Bishop PRÉALABLE = empno means the employee on level N + 1 will be the same as the Manager of level N.  This means that higher level numbers will be the most senior people in the hierarchy.  This is called a query from the bottom up.  (Both of the queries that you have posted this same CONNECT BY exact state; both are requests from bottom to top).

    Mgr = empno PREREQUISITE or equivalent

    PRIOR empno = mgr means exactly the opposite.  When you move from level N to level N + 1 in the query, you will move to an older person, to a junior position in the hierarchy.  This is called a query from top to bottom.  The employee level N will be the Manager of wover is a level N + 1.

  • START WITH and CONNECT BY in Oracle SQL (hierarchical)

    Hi, the original table as below
    Customer_ID         Account_ID          Paying_Account_ID         Parent_Account_ID          Company_ID
    158                    158                    158                         158                     0
    159                    159                    158                         158                     0
    160                    160                    158                         158                     0
    181                    181                    181                         181                     0
    183                    183                    183                         183                     0
    24669                  24669                  24669                       24669                   0         
    24671                  24671                  24671                       24669                   0
    24670                  24670                  24670                       24669                   0     
    3385127                3385127                3385127                     24670                   0
    To identify the hierarchical relationship of the data, which are PARENT_ACCOUNT_ID & ACCOUNT_ID, here's the query I used.
     select  lpad(' ', 2*level) || A.ACCOUNT_ID AS LEVEL_LABEL, CONNECT_BY_ISCYCLE "Cycle", LEVEL, A.* from ACCOUNT A
    START WITH parent_account_id = account_id
    CONNECT BY NOCYCLE  PRIOR A.ACCOUNT_ID = A.PARENT_ACCOUNT_ID
    AND account_id != parent_account_id
    ;
    It is the result of the query
    Level_Label              Level          Cycle        Customer_ID             Account_ID        Paying_Account_ID      Parent_Account_ID      Company_ID
    158                         1             0              158                     158              158                   158                     0
       159                      2             0              159                     159              158                   158                     0
       160                      2             0              160                     160              158                   158                     0
    181                         1             0              181                     181              181                   181                     0
    183                         1             0              183                     183              183                   183                     0
    24669                       1             0              24669                   24669            24669                 24669                   0       
        24671                   2             0              24671                   24671            24671                 24669                   0
        24670                   2             0              24670                   24670            24670                 24669                   0
            3385127             3             0              3385127                 3385127          3385127               24670                   0
    My question is how can I changed the query to calculate the values for:

    My_Total_PR - number of my accounts to child PR which do not include himself.
    Total_PR - Total number of accounts PR in the overall structure
    My_Total_NPR - number of my accounts of child NPR which do not include himself.
    Total_NPR - Total number of accounts NPR in the overall structure

    * PR stand for responsible for payment, for example the responsible account payment 158 158 (Paying_Account_ID), therefore the Total_PR to 158 is 3 (158, 159, 160)
    * NPR stand responsible for Non-payment, for example the responsible account payment 159 is 158 (Paying_Account_ID), so the Total_NPR for 159 1

    This is the expected result, any advice appreciated. Thank you
    Level_Label                     Level           Cycle           My_Total_PR     Total_PR     My_Total_NPR     Total_NPR     Paying_Account
    158                               1                0                  2              3          0              0              158
        159                           2                0                  0              0          0              1              158
        160                           2                0                  0              0          0              1              158
    181                               1                0                  0              1          0              0              181
    183                               1                0                  0              1          0              0              183
    24669                             1                0                  0              1          3              3              24669                   
        24671                         2                0                  0              1          0              0              24671
        24670                         2                0                  0              1          1              1              24670
            3385127                   3                0                  0              1          0              0              3385127
    Published by: user11432758 on February 14, 2012 01:00

    Published by: user11432758 on February 14, 2012 07:05

    Hello

    user11432758 wrote:
    Hi here is the statement DDL, thank you

    CREATE TABLE "SYSTEM"."ACCOUNT" ...
    

    Do not create your own objects in the diagram of the SYSTEM or any scheme that comes with the database. Create a separate schema and place your items. You'll have fewer security problems, and the migration to a new database will be easier.

    Here's a way to can get the aggregates you want:

    WITH     got_descendants          AS
    (
         SELECT     CONNECT_BY_ROOT account_id     AS ancestor_id
         ,     paying_account_id
         ,     LEVEL                    AS lvl
         FROM     account
         CONNECT BY NOCYCLE     PRIOR account_id     = parent_account_id
              AND          account_id          != parent_account_id
    )
    SELECT       ancestor_id
    ,       COUNT (CASE WHEN lvl             > 1
                      AND  ancestor_id  = paying_account_id THEN 1 END)     AS my_total_pr
    ,       COUNT (CASE WHEN ancestor_id  = paying_account_id THEN 1 END)     AS total_pr
    ,       COUNT (CASE WHEN lvl             > 1
                      AND  ancestor_id != paying_account_id THEN 1 END)     AS my_total_npr
    ,       COUNT (CASE WHEN ancestor_id != paying_account_id THEN 1 END)     AS total_npr
    FROM       got_descendants
    GROUP BY  ancestor_id
    ;
    

    Output:

    `             MY_         MY_
                TOTAL TOTAL TOTAL TOTAL
    ANCESTOR_ID   _PR   _PR  _NPR  _NPR
    ----------- ----- ----- ----- -----
            158     2     3     0     0
            159     0     0     0     1
            160     0     0     0     1
            181     0     1     0     0
            183     0     1     0     0
          24669     0     1     3     3
          24670     0     1     1     1
          24671     0     1     0     0
        3385217     0     1     0     0
    

    This gives the correct numbers, but how can bring us in an order that reflects the hierarchy, with the columns (for example lvl) that come from the hierarchy?
    A solution would be to make two CONNECT BY queries; a service without START WITH clause (like the one above) who collects the aggregates and the other with a START WITH clause (as your original query), which is in the right order and columns such as level_label and level. We could join result sets and get exactly what we want. I'll leave that as an exercise.

    Here is another way, which gets good results with only one CONNECTION PER request:

    WITH     got_descendants          AS
    (
         SELECT     CONNECT_BY_ROOT account_id     AS ancestor_id
         ,     paying_account_id
         ,     account_id
         ,     LEVEL                    AS lvl
         ,     CONNECT_BY_ISCYCLE          AS cycle
         ,     CASE
                  WHEN  CONNECT_BY_ROOT account_id
                      = CONNECT_BY_ROOT parent_account_id
                  THEN  ROWNUM
              END                    AS r_num
         FROM     account
         CONNECT BY NOCYCLE     PRIOR account_id     = parent_account_id
              AND          account_id          != parent_account_id
         ORDER SIBLINGS BY     account_id     -- Optional
    )
    ,     got_o_num     AS
    (
         SELECT     got_descendants.*
         ,     MIN (r_num) OVER (PARTITION BY  account_id)     AS o_num
         ,     MAX (lvl)   OVER (PARTITION BY  account_id)      AS max_lvl
         FROM     got_descendants
    )
    SELECT       LPAD ( ' '
                , 2 * (MIN (max_lvl) - 1)
                )  || ancestor_id                         AS level_label
    ,       MIN (max_lvl)                                AS "Level"
    ,       MIN (cycle)                                   AS "Cycle"
    ,       COUNT (CASE WHEN lvl             > 1
                      AND  ancestor_id  = paying_account_id THEN 1 END)     AS my_total_pr
    ,       COUNT (CASE WHEN ancestor_id  = paying_account_id THEN 1 END)     AS total_pr
    ,       COUNT (CASE WHEN lvl             > 1
                      AND  ancestor_id != paying_account_id THEN 1 END)     AS my_total_npr
    ,       COUNT (CASE WHEN ancestor_id != paying_account_id THEN 1 END)     AS total_npr
    ,       MIN (paying_account_id)                                    AS paying_account
    FROM       got_o_num
    GROUP BY  ancestor_id
    ORDER BY  MIN (o_num)
    ;
    

    Output:

    `                             MY_         MY_
                                TOTAL TOTAL TOTAL TOTAL  PAYING_
    LEVEL_LABEL     Level Cycle   _PR   _PR  _NPR  _NPR  ACCOUNT
    --------------- ----- ----- ----- ----- ----- ----- --------
    158                 1     0     2     3     0     0      158
      159               2     0     0     0     0     1      158
      160               2     0     0     0     0     1      158
    181                 1     0     0     1     0     0      181
    183                 1     0     0     1     0     0      183
    24669               1     0     0     1     3     3    24669
      24670             2     0     0     1     1     1    24670
        3385217         3     0     0     1     0     0  3385217
      24671             2     0     0     1     0     0    24671
    

    That's exactly what you asked for, except that you have posted the line with level_label =' 24671' before the line with level_label = "24671 '. You may not care about who comes first, but if it's important, explains why these lines should be in descending order of account_id, while "159 and 160" are in ascending order. You will need change the ORDERBY brothers and SŒURS clause accordingly.

  • Why my DVD does not start with the film and not on the menu?

    HI -.

    I'm just starting to use yet.

    I import my film as a timeline, my PSD as a Menu, link the button in the menu to the timeline and tie the end to the Timeline action to return to the Menu.  I get no error, when I check prior to construction.

    But when I play the DVD, the menu is entirely ignored.  The movie just started.  End action works and I can navigate the Menu using the remote control, but I want the disc to start with the Menu.

    What Miss me?

    TIA your instruction.

    JL

    Hello

    In this case, first of all, I would check my first piece of the project. You can check the first play in the drive properties in the properties panel.

    Click on the disk icon in the window of the chart and look at the properties of the disc in the properties panel.

    If you want your menu to play first you insert the disc in the drive, then this menu must be set as the first piece of theatre.

    I hope this works.

    Thank you

    Ramesh.

  • Hierarchical connect by and start with and joined?

    I have an Employees table and a table of identifiers. The table of identifiers is hierarchical, with parents and children. Each employee has one or more identifiers, but that a unique identifier is considered to be the "primary" or root for each employee identifier. Unfortunately, the employee table can point to one of the children identifier lines and not the root. I need a quick query to reach employees with their most recent ID (root).

    Here's the code to define the problem.
    create table employees (employeeid varchar2(8), fakeNationalID varchar2(9), empname varchar2(30));
    insert into employees (employeeid, fakeNationalID, empname) values (1,'001000001','John Smith');
    insert into employees (employeeid, fakeNationalID, empname) values (2,'002000002','James Jones');
    
    create table realids (realidkey NUMBER, fakeNationalID VARCHAR2(9) not null, 
       realNationalID VARCHAR2(9) UNIQUE, parent_realidkey number);
    insert into realids (realidkey, fakeNationalID, realNationalID, parent_realidkey) values
       (1,'001000001','111111111',3);
    insert into realids (realidkey, fakeNationalID, realNationalID, parent_realidkey) values
       (2,'002000002','222222222',null);
    insert into realids (realidkey, fakeNationalID, realNationalID, parent_realidkey) values
       (3,'003000003','333333333',null);
    commit;   
    
    create or replace function get_parentid (fakeID in VARCHAR2) return varchar2 is
       tempid VARCHAR2(9);
       begin
          select realNationalID into tempid 
             from (
               select realNationalID, fakeNationalID
                  from realids
                  start with fakeNationalID = fakeID
                  connect by nocycle prior parent_realidkey = realidkey
                  order by level desc)
                  where rownum = 1;
          return tempid;
          exception 
             when NO_DATA_FOUND then
                return NULL;
             when others then raise;
        end;
    
        
    select get_parentid('001000001') from dual; -- returns 333333333 because its linked to a parent
    select get_parentid('002000002') from dual; -- returns 222222222 because there is only one child
    select get_parentid('003000003') from dual; -- returns 333333333 because it is the parent
    What I want is to put the parent node above realids for each line of employees...

    It works, but it is NOT very effective:
    select employeeid, get_parentid(fakeNationalID) realid, empname from employees;
    employeeid   realid       empname
    ----------   -----------  ------------
    1            333333333     John Smith
    2            222222222     James Jones
    You can imagine what it would be like with 100K lines or more. It takes about 3 minutes to run.

    It seemed like a good way to do it, but with a sub query.
    select e.employeeid, e.fakenationalid, e.empname, sub.realnationalid
       from employees, 
          (select realidkey, fakenationalid, realnationalid, parent_realidkey
             from realids r
             start with r.fakenationalid = e.fakenationalid
             connect by prior r.parent_realidkey = r.realidkey) sub
    Unfortunately, it produces an invalid identifier on e.fakenationalid (in the beginning with the clause).

    Anyone has any ideas on how to get top most parent node of the realids for each row in the employees table? In real life, there are 6 or more employees tables across multiple remote instances of what children in the realids table and how much to the parents. We always want the highest parent of the page realid. Any help would be appreciated.

    Hello

    Thanks for posting the sample data in a convenient form!
    It is always useful to post your version of Oracle, too, especially when it comes with CONNECT BY queries.

    What follows is what you asked for in Oracle 10:

    WITH     got_roots   AS
    (
         SELECT     CONNECT_BY_ROOT     fakenationalid     AS leaf_id
         ,     realnationalid
         FROM     realids
         WHERE     CONNECT_BY_ISLEAF     = 1
         START WITH      fakenationalid IN ( SELECT  fakenationalid
                                              FROM    employees
                               )
         CONNECT BY     realidKEY     = PRIOR parent_realidkey
    )
    SELECT     e.employeeid
    ,     r.realnationalid
    ,     e.empname
    FROM     employees     e
    JOIN     got_roots     r     ON     r.leaf_id     = e.fakenationalid
    ;
    

    In any query, call a function defined by the user for each line is going to be slow. Fortunately, Oracle now has the built-in functions and operators that can take the place of get_parentid. The CONNECT_BY_ROOT operator, which was introduced in Oracle 10, is the key to the problem. In Oracle 9, you can get the same results using SYS_CONNECT_BY_PATH.

    It is generally faster to CONNECT BY query separately, and then join some other tables you need for results.

    You had a good idea in your last query. The problem was that void and employees were equal tables in the FROM clause, and you cannot establish a correlation between equals. You can only correlate a subquery to its Super application. You could make to this general idea work by changing void in a scalar sub-requete, which can be connected to the employees, but I think it would be much less effective than what I posted above.

Maybe you are looking for