Help to order duplicate RMAN

Hi all

I need to restore an oracle rac in another server with another dbname.

I found notes 452868.1 (on the link https://support.oracle.com/CSP/main/article?cmd=show & type = NOT & id = 452868.1 #aref_section31)

On my system there is the network user and listener is managed by the grid.
After nomount an istance of simple as test note starting, I can see test service in the status of the listener. but I read blocked service:

Service 'TEST' has 1 instance (s).
Instance of 'TEST', LOCKED status, has 1 operation for this service...

When I try to reproduce the rman test server db:

RMAN >
connect the target (the source database)
connected to target database: DBCORP (DBID = 2331160416)
auxiliary connection.
connected to the auxiliary database: TEST (not mounted)
Connect catalog rmancat/rmanpwd@rmancat
connected to the recovery catalog database

RMAN > DATABASE of TARGET 'TEST' FOR ACTIVE DATABASE duplicate;


From 14 December 12 Db double
RMAN-00571: ===========================================================
RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =.
RMAN-00571: ===========================================================
RMAN-03002: failure of Db in dual at 14/12/2012 12:31:27
RMAN-05501: abandonment of duplicate target database
RMAN-06217: not connected to an auxiliary database with a network service name


Where is my mistake?

as indicated error, you have to active replication link both sides by using a network service name, so ' target / "or" auxiliary / "will not work in this scenario
the correct method is written in the note

dynamic registration in NOMOUNT form will result in a BLOCKED service
This is why you must modify your listener.ora and use the static record

Tags: Database

Similar Questions

  • Help to identify duplicate lines.

    I have a table that looks like the following.

    create table Testing(
    inv_num varchar2(100),
    po_num  varchar2(100),
    line_num varchar2(100)
    )
    

    data by the following.

    Insert into Testing (INV_NUM,PO_num,line_num) values ('19782594','P0254836',1);
    Insert into Testing (INV_NUM,PO_num,line_num) values ('19782594','P0254836',1);
    Insert into Testing (INV_NUM,PO_num,line_num) values ('19968276','P0254836',1);
    Insert into Testing (INV_NUM,PO_num,line_num) values ('19968276','P0254836',1);
    

    what I'm trying to do, is to identify the different multiple elements within the table with the same PO_num, but inv_num.

    I have try this

    SELECT  
            T1.inv_num,
            T1.Po_num,
            T1.LINE_num  ,
            count(*) over( partition by 
            T1.inv_num)myRecords
        FROM testing T1
         where  T1.Po_num  = 'P0254836'
         group by 
            T1.inv_num,
            T1.Po_num,
            T1.LINE_num
            order by t1.inv_num
    

    but I end up with a result similar to the following.

    "INV_NUM"                 "PO_NUM"                  "LINE_NUM"                "MYRECORDS"
    '19782594 '.'P0254836 '.« 1 »« 1 »
    "19968276" "P0254836" "1"                       "1"                     

    I really want to end up with a result similar to the following.

    "INV_NUM"                 "PO_NUM"                  "LINE_NUM"                "MYRECORDS"
    '19782594 '.'P0254836 '.« 1 »« 1 »
    '19968276 '.'P0254836 '.« 1 »« 2 »

    in substance, I wish that the County invoices in purchase order and I also want to include the row id so that I can pass the record with more than 1 at a separate table.

    Please note that this is part of a much larger project, and I change took only a small subset of show here.

    Thanks for the help in advance.

    Hello

    mlov83 wrote:

    Hi Etbin

    Thanks for the reply.

    I really need it to be the result.

    INV_NUM PO_NUM LINE_NUM RN
    19782594 P0254836 1 1
    19782594 P0254836 1 1
    19968276 P0254836 1 2
    19968276 P0254836 1 2

    Let me explain a little better. I want to remove the second instance of inv_num for this po_num if 19782594 and 19782594, although they are duplicates which is the first dup put so I want to keep. Then19968276 for this po_num I want to identify separately as a separate set and finally remove from my table.

    Hope that makes sense.

    That's what you asked for:

    SELECT inv_num, po_num, line_num

    DENSE_RANK () OVER (PARTITION BY po_num,

    ORDER BY inv_num

    ), Rn

    Tests

    ORDER BY po_num, inv_num

    ;

    Output:

    INV_NUM PO_NUM LINE_NUM RN

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

    19782594 1 1 P0254836

    19782594 1 1 P0254836

    P0254836 19968276 1 2

    P0254836 19968276 1 2

    But I do not see how this will help to eliminate duplicates.  Does not add another column in double for records that are already duplicates.  To distinguish the first of a series of other duplicates, Etbin request is much more useful.

  • Another issue duplicate RMAN - RAC database to single instance

    Hello

    I have a problem with RMAN duplicate procedure and hoped that someone can help you.

    I would like to create a duplicate of our data base RAC production on a separate and autonomous, database on another site server. This duplicate will be used to execute queries to another business unit that I don't want to have access to our database of intensive production.

    My procedure goes like this:

    1. create a (not ASM) disk based backup data files and recovery logs archived:

    'run {} '.
    allocate channel d1 type disk;
    backup format ' / u02/stage/df_t%t_s%s_p%p' database more entered archivelog delete;
    output channel d1;
    }"

    2 tar and scp those files to the same location on the standalone database server.

    3. in the meantime, work that's happened on the basis of data production and other archived redo logs have been generated. I don't really care about these papers for the purposes of the duplicate however, I just want to replicate to the point of the last backup. I have to do this, run the following SQL to determine the sequence number should I be duplicating up to:

    "Select max(sequence#) thread # v $ archived_log, whereas the deleted = 'YES' group by thread #;"

    4 duplicate the production to the stand-alone database database (SQL Net work orders).

    'run {} '.
    until the sequence (the value returned by the SQL statement above);
    duplicate target database xxx;
    }"

    However, my problem because I don't know how to handle the fact that he has two sons. I understand that each thread relates to one of the CARS, I don't know which one to specify the copy. We have a service of data that the client application connects through, and that the service runs on any of the bodies. I should just care about newspapers in the instance where the service is running?

    AM I even approach that this is the right way?

    I look forward to any help that people may be able to offer.

    Kind regards

    Phil

    1 9746 569095777 28 OCTOBER 09 569150229 28 OCTOBER 09
    1 9747 569150229 28 OCTOBER 09 569187892 28 OCTOBER 09
    1 9748 569187892 28 OCTOBER 09 569231956 28 OCTOBER 09
    1 9749 569231956 28 OCTOBER 09 569259816 28 OCTOBER 09
    2 7931 569095774 28 OCTOBER 09 569187902 28 OCTOBER 09
    2 7932 569187902 28 OCTOBER 09 569259814 28 OCTOBER 09

    You must use the VALUE until and specify the sequence with the next lowest change, or RMAN will search for the next log in this thread.

    for example, if you specify until the thread in the sequence 9750 1; RMAN will search journal 7933 on thread2 to catch the 1 wire SNA 569259816.
    Specify the set as a thread in 7933 2 sequence; and two copies must go ok!

    Published by: MrShh on October 29, 2009 14:35

  • Helps To DB connection RMAN required

    Hi all

    I am new customer RMAN.  I'm working on the creation of the DB duplicate DB existing Active DATABASE duplication. Steps are

    TARGET MTAU44

    AUXILIARY MTAU14

    I'm Miracle out while RMAN connect as below

    [oracle@bonsa@|mtau14]/apps/oracle/network/admin > $ORACLE_HOME/bin/rman target sys/sys@mtau44 auxiliary sys/ram@mtau14 ]

    Recovery Manager: release 11.2.0.4.0 - Production game 7 21:31:30 Jan 2016

    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

    connected to target database: MTAU44 (DBID = 1817866374)
    connected to the auxiliary database: MTAU44 (unassembled)

    Here connected to the auxiliary database: must be MTAU14, but why is it show like MTAU44?  Where I missed.

    Help, please

    S

    supersen skrev:

    Hi all

    Here connected to the auxiliary database: must be MTAU14, but why is it show like MTAU44?  Where I missed.

    You probably db_name = "MTAU44" in the settings of your auxiliary of the instance file.

    AJ

  • Duplicate RMAN


    I am trying to perform RMAN duplicate in 11.2.0.2, but faced with the below error.

    mounted database

    output channel: ORA_AUX_DISK_1

    allocated channel: ORA_AUX_DISK_1

    channel ORA_AUX_DISK_1: SID = 19 type of device = DISK

    RMAN-00571: ===========================================================

    RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =.

    RMAN-00571: ===========================================================

    RMAN-03002: failure of Db in dual at 12:57:28 05/12/2015

    RMAN-05501: abandonment of duplicate target database

    RMAN-05541: no newspaper archived in the database to target

    controlfile restores successfully but, restore fails. Please help me on this.

    Is this the first time you save the target database or do there are backups of the journal of the archives previously taken?

    Can you try ' overlap archivelog all ' on the basis of target data, if any expired archivelog all found, delete them and then try to make a level 0 backup.

    Include archivelogs all well in backup of L0, may not be the case, but you can do a test and then perform the duplication.

    run

    {

    format of database backup incremental level 0 ' / u02/bkp/%d_inc0_%T_%U.bak';

    ARCHIVELOG backup all the format ' / u02/bkp/%d_arc_%T_%U.bak';

    }

    -Jonathan Rolland

  • Duplicate RMAN with specific backup location

    Hello

    I explain here my architecture:

    -Server Oracle 11.2.0.4 production: prod db with the instance name PROD with RMAN backups on the F: drive

    -Test the Oracle 11.2.0.4 Server: test-db with the instance name TEST with RMAN backups on the F: drive and production available on the G: drive backup drive

    -Customer name: customer

    My goal is to reproduce the production server to the test server instance and I can't achieve this goal. The connection is client-side.

    I do it like this:

    -startup nomount TEST

    -On the client, run the following "rman target sys/pass@PROD auxiliary sys/pass@TEST.

    Then in RMAN, I run the following:

    RUN

    {

    CHANNEL AUXILIARY ALLOCATE ch01 DEVICE TYPE DISK;

    CHANNEL AUXILIARY ALLOCATE ch02 DEVICE TYPE DISK;

    DUPLICATE THE DATABASE TO THE LOCATION OF THE BACKUP TEST "G:\RMAN";

    }

    RMAN does not see my "LOCATION of BACKUP" command because it tries to reproduce the F: drive and can't find the backup files.

    I have the thing like this:

    CH01 channel: reading of the element of backup F:\RMAN\CTRLFILES\CTRL-PROD-C-2267984545-20150826-00

    CH01 channel: ORA-19870: error when restoring full backup, F:\RMAN\CTRLFILES\CTRL-PROD-C-2267984545-20150826-00

    ORA-19505: impossible to identify the file "F:\RMAN\CTRLFILES\CTRL-PROD-C-2267984545-20150826-00 '

    ORA-27041: could not open the file

    04002 - OSD: could not open the file

    S/O-error: (OS 2) the system cannot find the file specified.

    Single quote, double quote, tried almost everything and RMAN always look for the backup in the F: drive. Can you help me to use the G: drive?

    And at the beginning of this thread someone told me not to connect to the target database.

    You use the clauses unwanted duplicating without connecting to the target database. SPFILE clause is not necessary, but you seem to use it in the block of the RACE.

    Create a simple PFILE with all the parameters required for the auxiliary instance, startup nomount and run the duplicate.

    Also worth db_file_name_convert log_file_name_convert parameters in the PFILE to the auxiliary instance file, run the duplicate.

    run

    {

    CHANNEL AUXILIARY ALLOCATE ch01 DEVICE TYPE DISK;

    CHANNEL AUXILIARY ALLOCATE ch02 DEVICE TYPE DISK;

    DUPLICATE THE DATABASE TO THE LOCATION OF THE BACKUP TEST "G:\RMAN";

    output channel ch01.

    output channel ch02;

    }

    HTH

    Duplication of data without a connection to the target database or catalog of database in Oracle 11 g | Shivananda Rao

    -Jonathan Rolland

  • Duplicate RMAN cloning using the database using the current database

    Hi all

    I am new bie, I want to clone my target database using the rman command 'DUPLICATE database OF ACTIVE DATABASE"new host.

    steps on google, I searched, but I got confused, I doubt if you need to install oracle rdbms softare on new host or not? and also should I copy all files (redo, control, datafiles) to the new host? kind LY help and tell me the steps to clone the database using rman.your help will be appreciated.

    Thank you.

    Kind regards.

    OS: RHEL 5.4

    DB: 11.2.0.3

    Hello

    Have you not through document link to Gavin at least. It's very simple steps. If you wait until other measures, then won't them.

    He had provided the demonstration, at least get in 'google' (you'll have so many links)

    The Oracle Dba Italian Blogger: how to clone an Oracle 11 g 2 home

    http://balaoracledba.com/2013/12/16/cloning-an-existing-Oracle11g-release-2-RDBMS-installation/

    Note: If you feel always complex, better skip the task itself.

    -Thank you

    Pavan Kumar N

  • Duplicate RMAN DATABASE

    Hello

    I am creating a new 11.2.0.1 database by duplicating a 11.2.0.1 existing database with Rman "from database" option.

    I created a password file and the listening port is configured this way.
    The database to the is started in nomount State.

    RMAN
    connect target sys/pwd123@SRCDB
    connect auxiliary sys/pwd123@AUXDB
    AUXDB duplicate target database
    ACTIVE DATABASE;

    It does not, saying that "ORA-12528: TNS:listener: all appropriate instances are blocking new connections" which is normal given that the listener is havig a handful in the State BLOCKED for this AUXDB is it in NOMOUNT State.

    Could you please help me on how to proceed?

    An option can be manually create the controlfile and edit the instance before doing the double. I hope that Rman can continue from there.
    Another option is to go for the basic duplicate backup.

    Is there another way to go?

    Kind regards
    Aravind

    It does not, saying that "ORA-12528: TNS:listener: all appropriate instances are blocking new connections" which is normal given that the listener is havig a handful in the State BLOCKED for this AUXDB is it in NOMOUNT State.

    Could you please help me on how to proceed?

    An option can be manually create the controlfile and edit the instance before doing the double. I hope that Rman can continue from there.
    Another option is to go for the basic duplicate backup.

    Is there another way to go?

    Provide static record side AUXILIARY for your auxiliary instance, then try again. For example, edit listener.ora as

    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (GLOBAL_DBNAME = AUXDB)
          (ORACLE_HOME = )
          (SID_NAME = AUXDB)
        )
      )
    
    LISTENER =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1521))
      )
    

    And restart the receiver on the auxiliary host and try again

  • Need help with iTunes duplicate Applescript.

    Hello

    I found this script that works great with iTunes automatically duplicates deleting. Something that I had wanted for a long time.

    I use Lion with the older version of ITunes, so I really need this script to work.

    It is an import script that helps me sync my music library to my home office with my nightclub iTunes library.   The only problem I have with this script is that it does not keep this last recorded double track.  I want to keep the last tracks because sometimes I replace a track with a better record of video or audio clip.  I would like to change this script to just base duplicates on the artist, Album artist, and name.   I hope that someone with apple great capabilities of script can check the script and help me adjust.  I tried to contact Randolf who created the script, but he did not.   Here is his magnificent scenario.   I'm sure that many people will find this useful.   I hope someone can help me.  I am very limited in my applescripting.

    -Ron

    _______________________________________________________________________________'

    Remove the Script duplicates ITunes

    (*

    This small script detects and removes duplicates in your iTunes library. Two tracks are considered duplicates if they share the same name of the track, the artist and the title of the album. If these 3 fields are the same, all the tracks except for one can be deleted. In addition, the game account and group entries are "merged."

    You can also use the account manager to remove duplicates in any other selection as the main library.

    You can enable or disable the registry deleted. Logging goes to the "logFile.txt" in your home folder.

    Any comment to

    Gmail.com

    *)

    property doLogging: false

    textlog property: missing value

    performance {}

    Tell application "iTunes" to the value plList library playlist 1

    hand (plList)

    end of race

    on hand (plList)

    -set up the recorder

    the value textlog makeFileLog (((chemin d'accès àle dossier de base) as String) & "logFile.txt")

    If doLogging logImportant then textlog ("start remove duplicates...")

    findDuplicates (plList)

    If doLogging logImportant then textlog ("completed the removal of duplicates...")

    end main

    on findDuplicates (plList)

    Tell application "iTunes".

    -find all artists

    the value artistList to the artist for each track of plList which the artist no lack of value

    Set actArtList to {}

    Repeat with an artistList in

    otherwise (actArtList contains (an AsString)) then copy (a string) to end of actArtList

    end repeat

    -find all the albums of a given artist

    Repeat with an actArtList in

    the value albList (album the album and each track of plList which the artist is a missing value)

    Set actAlbList to {}

    Repeat with al in albList

    If not (contains the actAlbList (al AsString)) then copy (al AsString) at the end of actAlbList

    end repeat

    -find all the titles with the artist one and al album

    Repeat with al in actAlbList

    the trList value (each track name of plList which the artist is an album is al and name no lack of value)

    Set actTrList to {}

    Repeat with tr in trList

    If not (contains the actTrList (tr AsString)) then copy (tr AsString) at the end of actTrList

    end repeat

    -manage these tracks

    Repeat with tr in actTrList

    the tracksWithThisComb value (all tracks of plList which the artist is an album is al and name is tr)

    If tracksWithThisComb > 1 then length

    My mergeTracks (tracksWithThisComb)

    Repeat with i of 2 all tracksWithThisComb

    the value of t to the point i of tracksWithThisComb

    If doLogging then

    the value of str (tr & "-" & al & "-" & a)

    Comment by TextLog ("Remove" & str)

    end if

    remove the t

    end repeat

    end if

    end repeat

    end repeat

    end repeat

    tell the end

    end findDuplicates

    on mergeTracks (possDupl)

    Tell application "iTunes".

    Set arrive in section 1 of the possDupl

    played playCount value number to arrive

    the grOfTrack group value to arrive

    "the gr value.

    the value compOfTrack compilation to arrive

    the value of comp «»

    -collect all of the information would

    Repeat with i of 2 all possDupl

    value tr to the point i of possDupl

    value played trPlCount number of tr

    If trPlCount > playCount then set playCount on trPlCount

    If (grOfTrack is equal to "") then

    the value trGroup grouping of tr

    If not (trGroup is equal to "") then the value gr trGroup

    end if

    If (compOfTrack is equal to "") then

    the value trComp compilation of tr

    otherwise (trComp is equal to "") then the comp trComp value

    end if

    end repeat

    game played count to arrive at playCount

    If (grOfTrack is equal to "") then set grouping of arrive in gr

    If (compOfTrack is equal to "") then set compilation to arrive in comp

    tell the end

    end mergeTracks

    on makeFileLog (\\server\share\file_path)

    script FileLog

    Category: "log file".

    property _linefeed: 10 characters id

    -Written records messages in a file encoded in UTF8 text

    on logMessage (the_text)

    the value of f to open for access file_path with write permission

    Try

    write (the_text & my _linefeed) f from folklore as 'class utf8 '.

    on error error_message number error_number

    Close access f

    error error_message number error_number

    try to end

    Close access f

    end logMessage

    on logImportant (the_text)

    logMessage ("*" & the_text & "*")

    end logImportant

    end of script

    end makeFileLog

    iMac, Mac OS X (10.7.3)

    < personal information under the direction of the host >

    iMac, Mac OS X (10.7.3), null

    Please... y at - there anyone out there that can help me?

    Ron

  • I need help to remove duplicate files

    I have MANY files duplicate on my, new to me, the laptop. Including but not limited to photos and lower costs.  I would like to delete all the duplicate files and other unnecessary junk files and I could use some (a lot) of help. I'm not that effective with the numeracy skills so I need it set as simple as possible.  Thanks for any help you give.   Its a Dell computer inspiron laptop if that means something.

    Use Bing or Google to find 'duplicate file remover' or 'duplicate file finder' - there are several dozens of utilities that can do it for you.

  • Need help with ordering high voltage

    Hello

    NI PCIe-6341 card is already installed. And I want to order a power supply voltage (CZE1000R) to generate the high voltage (DC). The goal is to fully control the high voltage. For example, the voltage can chang from zero to 30 kV in 5 or 10 seconds and be stable to 30 kV to 30 minutes and then go down smoothly at 20 kV in 5 minutes and finally back to zero. Could someone help me with this task? Thank you.

    Hi, apok,

    I used the 'panels-test' on 'measurement and automation explorer. And I see signals on an oscilloscope.

    Thank your for your help.

    But when I try to test the "tension cntrl.vi" it has not worked.

    On the manual, he said:

    "

    Programming with external voltage:

    Disconnect between TB1-2 and TB1 - 3 riders. Connect signal 0 - 10V between TB1-3 and TB1-6 (common)".

    This means that I need to plug TB1 - 3 and TB1 - 6 and out of the acronym to TB1-3?

  • RMAN or duplicate RMAN restore

    Hello

    I have a node of RAC 3 11 GR 2 ASM on Windows 2008 and want to migrate on linux with a case only, no cars, but also with the ASM.

    It was my idea, remove a node from the cluster and install Oracle Linux, then 11.2.0.3 software.

    But I need to get the database on this new linux server, and I thought to restore the most recent backup CARS db

    on the linux server, then turn on the DG and synchronize the linux server.

    Once synchronization is complete, disconect DG and continue testing.

    But I've heard maybe use rman duplicate would be better.

    What are your comments, what would you choose to achieve this migration?

    Thank you

    You can have a physical standby database set up on top of the linux machine and back it. In this way, you can perform the migration with minimal downtime.

    Also try to see what how to migrate has huge ASM database of Windows 64 bit for Linux 64-bit with low minimum time? (Doc ID 1371759.1)

    HTH

    -Jonathan Rolland

  • ORA-01017 when duplicate RMAN database active

    Hello, ORACLE guru!

    I have some difficulties trying to reproduce DB via RMAN duplicate from active database.

    The script is simple:

     run
     {
     allocate channel ch1 device type disk;
     allocate auxiliary channel aux1 device type disk;
     duplicate target database to mydb from active database;
     }
    
    

    The problem is in this summary:

    Starting backup at 15-JAN-14
    channel ch1: starting datafile copy
    copying current control file
    Oracle instance started
    
    
    Total System Global Area   10689474560 bytes
    
    
    Fixed Size                     2237776 bytes
    Variable Size               4227861168 bytes
    Database Buffers            6442450944 bytes
    Redo Buffers                  16924672 bytes
    
    
    contents of Memory Script:
    {
       sql clone "alter system set  db_name =
    ''mydb'' comment=
    ''Reset to original value by RMAN'' scope=spfile";
       sql clone "alter system reset  db_unique_name scope=spfile";
       shutdown clone immediate;
    }
    executing Memory Script
    
    
    sql statement: alter system set  db_name =  ''mydb'' comment= ''Reset to original value by RMAN'' scope=spfile
    
    
    sql statement: alter system reset  db_unique_name scope=spfile
    
    
    Oracle instance shut down
    released channel: ch1
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of Duplicate Db command at 01/15/2014 12:16:07
    RMAN-05501: aborting duplication of target database
    RMAN-03015: error occurred in stored script Memory Script
    RMAN-03009: failure of backup command on ch1 channel at 01/15/2014 12:15:57
    ORA-17629: Cannot connect to the remote database server
    ORA-17627: ORA-01017: invalid username/password; logon denied
    ORA-17629: Cannot connect to the remote database server
    
    
    RMAN>
    RMAN>
    

    check and see the differences:

    The database with RMAN duplicate

  • Help! Illustrator duplicates everything on the trail, as if I am now hold the Option key.

    I've never had this problem before. Whenever I drag an object, it automatically duplicates the object as if I am now hold the Option key. I can move objects with the arrow keys, but if I drag anything with the mouse, it it duplicates automatically.

    Please help because it is impossible to work with. I restarted the computer, but also Illustrator several times. The problem does not occur in InDesign or Photoshop. Just to Illustrator. I'm Runnin' Mac OSX 10.6.

    Thanks in advance for your help.

    Try the suggestions in this thread of Jacob in the post #4

  • [10g] need help with order by hierarchical query clause

    I have the following data samples:
    CREATE TABLE     bill_test1
    (     parent_part     CHAR(25)
    ,     child_part     CHAR(25)
    ,     line_nbr     NUMBER(5)
    ,     qty_per          NUMBER(9,5)
    );
    
    INSERT INTO bill_test1 VALUES ('ABC-1','ABC-10',100,1);
    INSERT INTO bill_test1 VALUES ('ABC-1','ABC-20',200,2);
    INSERT INTO bill_test1 VALUES ('ABC-1','ABC-30',300,3);
    INSERT INTO bill_test1 VALUES ('ABC-1','HARDWARE-1',401,10);
    INSERT INTO bill_test1 VALUES ('ABC-1','HARDWARE-2',402,5);
    INSERT INTO bill_test1 VALUES ('ABC-10','ABC-155',100,2);
    INSERT INTO bill_test1 VALUES ('ABC-10','HARDWARE-1',200,1);
    INSERT INTO bill_test1 VALUES ('ABC-155','RAW-2',100,4.8);
    INSERT INTO bill_test1 VALUES ('ABC-155','HARDWARE-3',200,3);
    INSERT INTO bill_test1 VALUES ('ABC-20','RAW-1',100,10.2);
    INSERT INTO bill_test1 VALUES ('ABC-30','RAW-3',100,3);
    And the following query gives me exactly what I want, in the order I want. However, I wonder if there is a way to get this order without creating the column SEQ, given that I don't need in my results
    SELECT     part_nbr
    ,     parent_part
    ,     child_part
    FROM     (
         SELECT     CONNECT_BY_ROOT b.parent_part                         AS part_nbr
         ,     b.parent_part
         ,     b.child_part
         ,     SYS_CONNECT_BY_PATH(b.line_nbr,' ')                    AS seq
         FROM     bill_test1 b
         ,     dual
         CONNECT BY     parent_part     = PRIOR child_part
         )
    WHERE          part_nbr     = 'ABC-1'
    ORDER BY     seq
    ;
    
    Results of above query, except with SEQ included in SELECT (just to show what I'm sorting off of):
    PART_NBR                     PARENT_PART                  CHILD_PART                   SEQ
    ---------------------------- ---------------------------- ---------------------------- -----------------
    ABC-1                        ABC-1                        ABC-10                        100
    ABC-1                        ABC-10                       ABC-155                       100 100
    ABC-1                        ABC-155                      RAW-2                         100 100 100
    ABC-1                        ABC-155                      HARDWARE-3                    100 100 200
    ABC-1                        ABC-10                       HARDWARE-1                    100 200
    ABC-1                        ABC-1                        ABC-20                        200
    ABC-1                        ABC-20                       RAW-1                         200 100
    ABC-1                        ABC-1                        ABC-30                        300
    ABC-1                        ABC-30                       RAW-3                         300 100
    ABC-1                        ABC-1                        HARDWARE-1                    401
    ABC-1                        ABC-1                        HARDWARE-2                    402

    Hello

    As long as there is that a single root, brothers and SŒURS of ORDER BY, you say, but you can not do in a subquery (well, you can, but usually there is no interest in a subquery). If the CONNECT BY in a subquery, there is no guarantee that the main request will preserve the hierarchical order which provides the subquery.

    The query you posted does not require a query of Tahina, so you can say:

    SELECT     CONNECT_BY_ROOT b.parent_part                         AS part_nbr
    ,     b.parent_part
    ,     b.child_part
    --,     SYS_CONNECT_BY_PATH(b.line_nbr,' ')                    AS seq
    FROM     bill_test1 b
    WHERE          CONNECT_BY_ROOT b.parent_part     = 'ABC-1'
    CONNECT BY     parent_part     = PRIOR child_part
    ORDER SIBLINGS BY     b.line_nbr
    ;
    

    I said the query you posted does not require a subquery. It also does not require double, so I guess that what you posted is a simplification of what you are really doing, and that could have a subquery. In particular, if you want to GROUP BY part_nbr, you need the subquery. We can use CONNECT_BY_ROOT expression in the WHERE clause (or, come to think of it, use a START WITH clause instead WHERE), but, for some reason, we cannot use CONNECT_BY_ROOT in a clause GROUP BY; We need to calculate CONNECT_BY_ROOT in a subquery, give it a name (like part_nbr) and Super GROUP OF this column in a query.

    This requires that there is that one node root. ORDER OF brothers and SŒURS means just that: children of a common parent will appear in the order, but the root nodes, which have no parents, may not be in order.

    Here's what I meant by using START WITH place WHERE:

    SELECT     CONNECT_BY_ROOT b.parent_part                         AS part_nbr
    ,     b.parent_part
    ,     b.child_part
    --,     SYS_CONNECT_BY_PATH(b.line_nbr,' ')                    AS seq
    FROM     bill_test1 b
    START WITH     b.parent_part     = 'ABC-1'
    CONNECT BY     parent_part     = PRIOR child_part
    ORDER SIBLINGS BY     b.line_nbr
    ;
    

    This should be much more effective, because it reduces the results before waste you your time by getting their descendants.
    With the help of a clause START WITH here is analogous to me sending you an email, saying "come to a meeting one my office at 03:00."
    By using a WHERE clause here is similar by sending me an e-mail to all members of society, saying: "come to a meeting one my office at 3:00" and then, as people get here, tell everyone except you could go back.

    Brothers and SŒURS ORDER BY was introduced in Oracle 9.

    Published by: Frank Kulash, December 9, 2010 14:39
    Added version with the START WITH clause

Maybe you are looking for

  • Problem with XServe and XServe RAID via Fibre Channel

    Hello everyone, I have a problem with my blended Xserve RAID. I see in RAID-Admin and configure it successfully (via Ethernet). Connect with our Xserve via Fibre Channel, but the XServe and XServe RAID do not detect each other. The fiber on the Xserv

  • Lenovo, yoga 3 pro hinge loose

    The central part of the hinge on my Lenovo Yoga 3 Pro, I've had for about 4 months, loose. It wouldn't really bother me much except that he is really strong and I cut myself on this subject. Is there a way to challenge me or what I can do?

  • How do you on what OS a key embedded BIOS is for?

    So the hard drive died, I got a new, but the stupid computer came with no COST, so I don't know what version of Windows is supposed to go about it. I know how to check what the product key is embedded (with RW everything), so is there a way to tell w

  • Movie Maker - corrupted with green flashing screen movie file

    After importing successfully via Firewire MiniDV camcorder movie in avi 'clean' format (tested by looking at a media player). I have started working on the edition in MovieMaker, the avi file appears corrupt with annoying intermittent green flashes.

  • Cannot get signal when you connect the TV to HDMI port.

    * Original title: HDMI Signal Hello. My nam is Kieu. I have a problem and and we hope you guys can helo me. I just bought a Gateway desktop all-in-one computer and tried to connect it to the TV via the HDMI port, but I could not get signal on my TV.