Order by on datafile name.

Hi All,
I am using 11GR2 and looking to find out a way , where in I able to extract the data files name in such a manner , where it lists data file in order of mount points. say data1 first and then so on..
Snippet from my data files output.
/db/ptmtrain/data1/system01.dbf
/db/ptmtrain/data2/sysaux01.dbf
/db/ptmtrain/data1/undotbs01.dbf
/db/ptmtrain/data3/tools01.dbf
/db/ptmtrain/data24/users01.dbf
/db/ptmtrain/data25/users02.dbf
/db/ptmtrain/data26/users03.dbf
/db/ptmtrain/data2/rbs01.dbf
/db/ptmtrain/data3/rbs02.dbf
/db/ptmtrain/data2/rbs03.dbf
/db/ptmtrain/data23/sans01.dbf
should be something like
/db/ptmtrain/data1/system01.dbf
/db/ptmtrain/data1/undotbs01.dbf
/db/ptmtrain/data2/sysaux01.dbf
/db/ptmtrain/data2/rbs03.dbf
/db/ptmtrain/data2/rbs01.dbf
/db/ptmtrain/data3/tools01.dbf
/db/ptmtrain/data3/rbs02.dbf
/db/ptmtrain/data23/sans01.dbf
/db/ptmtrain/data24/users01.dbf
/db/ptmtrain/data25/users02.dbf
/db/ptmtrain/data26/users03.dbf
Regards

As already explained just as suggested: thanks bencol (I'm on Company time right now, answers are provided instead of coffee breaks )
with
data_files as
(select '/db/ptmtrain/data1/system01.dbf' file_name from dual union all
select '/db/ptmtrain/data2/sysaux01.dbf' from dual union all
select '/db/ptmtrain/data1/undotbs01.dbf' from dual union all
select '/db/ptmtrain/data3/tools01.dbf' from dual union all
select '/db/ptmtrain/data24/users01.dbf' from dual union all
select '/db/ptmtrain/data25/users02.dbf' from dual union all
select '/db/ptmtrain/data26/users03.dbf' from dual union all
select '/db/ptmtrain/data2/rbs01.dbf' from dual union all
select '/db/ptmtrain/data3/rbs02.dbf' from dual union all
select '/db/ptmtrain/data2/rbs03.dbf' from dual union all
select '/db/ptmtrain/data23/sans01.dbf' from dual
select file_name,instr(file_name,'/',-1) one,substr(file_name,18,instr(file_name,'/',-1) - 18) two
  from data_files
order by to_number(substr(file_name,18,instr(file_name,'/',-1) - 18))
FILE_NAME
ONE
TWO
/db/ptmtrain/data1/system01.dbf
19
1
/db/ptmtrain/data1/undotbs01.dbf
19
1
/db/ptmtrain/data2/sysaux01.dbf
19
2
/db/ptmtrain/data2/rbs03.dbf
19
2
/db/ptmtrain/data2/rbs01.dbf
19
2
/db/ptmtrain/data3/tools01.dbf
19
3
/db/ptmtrain/data3/rbs02.dbf
19
3
/db/ptmtrain/data23/sans01.dbf
20
23
/db/ptmtrain/data24/users01.dbf
20
24
/db/ptmtrain/data25/users02.dbf
20
25
/db/ptmtrain/data26/users03.dbf
20
26
Regards
Etbin

Similar Messages

  • SQL Loader: refer datafile name in the control file

    Hi All:
    Database: 10GR2
    I have a table as following:
    test (
    filename varchar2(100),
    mydata varchar2(1000)
    I am using sql loader to populate data for this table. I also need store the datafile name to column test.filename as part of dataload. How to refer datafile name in the control file?
    Again, I am processing multiple files in a batch mode. I need store datafile name in filename column so that I can know which "mydata" come from which datafile.
    Thanks in advance!
    Kevin

    As Bravid says, you can't do that from within SQL*Loader, unless the control files are dynamically generated by a script and the filename included as the default value for that particular column as a hardcoded literal.
    It's easier if you use external tables as the table definition contains the "location" which is the list of filenames it is accessing, and the value can be queried as well as being dynamically changed (though if you're dynamically changing it, then you'll programatically know the filename anyway. hint hint!)
    ;)

  • RMAN - Using fileperset = 1 and want datafile name to appear in piece name

    Environment: 10.2.0.4 on HP-UX
    Hi guys,
    One of my many problems with Netbackup is the inablity to trace backups as they get duplicated around the environment
    For our FULL backups, our backup script uses filesperset = 1 which means every datafile is backed up into its own piece
    We use rman format parameters %s %U etc to label our pieces. What would really help us would be if we could have the datafile name appear in the name of the backup piece
    Is that possible?
    this is a sample extract of out script
    SEND 'NB_ORA_POLICY=Oracle_${DATABASE_NAME},NB_ORA_SCHED=${NB_ORA_SCHED}';
    #------ Backup Full Database
    backup incremental level 0
    database
    filesperset 1
    format 'Full_DB_${DATABASE_NAME}_Weekly_Datafiles_%s:%t:%p.rman_backup'
    include current controlfile
    tag Full_DB_NetBackup;
    (note: I may be missing something fundamental here and being stupid, it's been known)

    Never tried but you can try with this
    *%f - Specifies the absolute file number*.
    I just checked, it works. It wll give you file number not file name though.
    and also with
    *%N - You can have tablespace name with it*. This would be little more helpful.
    You can combine both to get the file number and tablespace name together. I got the output like this.
    FULL_DB_2::UNDOTBS1.RMAN
    This means file *2* of undo tablespace. I used this format string format 'E:\Full_DB_%f::%N.rman'
    Edited by: TSharma on Mar 5, 2013 11:57 AM

  • Get datafile name in database column using ctl file - SQLLDR

    I have a shell script(ksh) and calling control file using SQLLDR. I want to pass the datafile name in database table column. Can anyone give an example of this. Appreciate your response.
    --TV2703                                                                                                                                                                                                                                                                                                                                                                                                           

    Create the control file dynamically before you start SQL*Loader
    Something like
    echo LOAD DATA > load.ctl
    echo INTO TABLE dept >> load.ctl...
    Another option is to use external tables

  • How can i bulk rename music files in reverse order from artist - song name to songname - artist

    How can I bulk rename music files in reverse order from artist - song name to songname - artist.
    I actually dont need to rename the actual files.
    Its just i have a huge txt list of 100,000 music names that are listed as so..
    Artist - Song Name
    Artist - Song Name
    Artist - Song Name
    Artist - Song Name
    Artist - Song Name
    Artist - Song Name
    and i need this list to reverse it self so it is listed in the list as
    Song Name - Artist
    Song Name - Artist
    Song Name - Artist
    Song Name - Artist
    Song Name - Artist
    Song Name - Artist
    Song Name - Artist
    Im sure there is some kinda way to auto a mix of applescript/automator/terminal to do something like:  all char before the "-" replace with the chars after the "-".
    Please some one help me if you know how I can pull this off

    How can I bulk rename music files in reverse order from artist - song name to songname - artist.
    I actually dont need to rename the actual files.
    Its just i have a huge txt list of 100,000 music names that are listed as so.
    I wonder if we haven't misunderstood what you were asking for. Could it be that you have not a huge file, but just a huge list of names in many small files. If that's the case, you should rather use the following script instead of the previous one.
    Since this script does not rename the files, make a backup of your files before running it.
    set theFolder to choose folder -- the folder containing your text files
    tell application "Finder"
        set theNames to name of files of theFolder whose name extension is "txt"
    end tell
    set theTextFiles to {}
    set theFolderPath to POSIX path of theFolder
    repeat with thisName in theNames
        copy theFolderPath & thisName to the end of theTextFiles
    end repeat
    repeat with thisFile in theTextFiles
        set F1 to open for access thisFile
        set theText to read F1
        close access F1
        set theParagraphs to paragraphs of theText
        set bigList to (a reference to theParagraphs)
        set theNewParagraphs to {}
        set bigNewList to (a reference to theNewParagraphs)
        repeat with X in bigList
            set P to offset of " - " in X
            if P = 0 then
                set Y to X
            else
                set Y to text (P + 3) through -1 of X & " - " & text 1 through (P - 1) of X
            end if
            copy Y & return to the end of bigNewList
        end repeat
        set theNewText to text 1 through -2 of (bigNewList as text)
        set F2 to open for access thisFile with write permission
        set eof F2 to 0
        write theNewText to F2
        close access F2
    end repeat
    display dialog "Done!" buttons {"OK"} default button 1 with icon 1
    Message was edited by: Pierre L.

  • TS2512 i m trying to convert dpx files to mov in colour 1.5.3 but in file browser files are not seen in proper order for ex files names are 12345 it is coming as 23145 bcoz of which in output also its coming in wrong order

    i m trying to convert dpx files to mov in colour 1.5.3 but in file browser files are not seen in proper order for ex files names are 12345 it is coming as 23145 bcoz of which in output also its coming in wrong order

    1) What you downloaded should be a packed file (zip, tar.gz, etc) that needs to be unpacked into the directory of your choice.
    2) & 3) are answered by Ant's installation documentation (the page you're quoting from):
    http://ant.apache.org/manual/index.html

  • Indicator: automatic fixing of planned orders sap (SAP Filed name: PFREI)

    Hi Experts,
    Where can the Indicator: automatic fixing of planned orders sap (SAP Filed name: PFREI) be found in the material master?

    not directly controlled in the material master
    If planned orders are fixed is defined in customizing of MRP types (V438A-FXART)
    and the MRP type is entered in material master (MARC-DISMM)

  • Purchase Order Table's "Field Name required"

    Hi Experts,
    Can anybody tell me specific table names and filed names for "Invoice Quantity" and "Delivery Quantity" for Purchanse Orders?
    Thanks a lot.

    hi
    go to EKBE and  VBRP for GR Goods Receipt quantity and invoiced quantity
    and for Deliver quantity got to LIKP or LIPS
    hope this helps
    regards
    Aakash Banga

  • Report should have purchase order deliveryschedule &  goods reciptent name

    I want one T.code/Report/Table to  see the the purchase order delivery schedule and goods receipent name in two separte coloums ...Please let me know if any things is available ...
    Thanks for immediate reply.

    Hey
    I don't think there is a report out there that gives you this information. however you could use quickviewer- SQVI to generatea table join of EKET and MSEG.. That should help

  • Purchase Order print output - Company Name changed

    Hi experts,
    My plant name is changed  I want the new name to appear at the bottom of the Purchase Order above Authorized signatory field.
    Please suggest how to do.
    Regards,
    ( Rajneesh Gulati )

    hi,
    I agree with Jurgen's point ...But the street adress uneditable
    Go into SPRO-> Enterprise structure -> Definition -> Logistics-genaral -> Define copy, delete, check plant
    Inside this if you jus wanna change the name then you can go into the details of the plant and edit...but wanna change the address then need to copy the existing plant and make your own new plant...
    Or may try with ABAPer...
    Regards
    Priyanka.P
    AWARD IF HELPFULL

  • Question about Finder file listing order when sorting by "Name"

    I quite often add a suffix to some of my file names when I save them so that I can keep a complete history of changes. For example, I usually add "_000" at the end, and progress to "_001" through "_009". However after "_009" I don't increase the next digit to "_010" but instead, after "_009" comes "_00A" then "_00B" on to "_00Z" and then to "_010". I have been doing this for a while now (several years) and it has worked well for me.
    I have noticed in the finder window, when in "List" view a file ending in "_00A" is listed lexicographically before a file ending in "009" instead of the other way around.
    I think that this is due to my UNIX Locale being set to LANG="en_US.UTF-8"
    1. Is this a correct assumption?
    I would like it to be listed in POSIX order.
    2. Is there a way I can make just specific folders list file names in POSIX order?
    I was thinking of changing my Language to POSIX using the terminal command:
    $ export LANG=POSIX
    but this may have undesirable effects with the rest of Mac OS X.
    3. Is there a finder preference (plist item) I can change so this just changes the listing order to POSIX? (I have no problem if all Finder windows use this sort order for file names.)
    Thank you in advance.
    Jeff Cameron

    I don't know of a GUI way to change it or if you unix trick will work/do anything, but the Mac OS has always sorted that way, if I'm understanding you correctly. It looks at the entirety of the naming and puts 2 immediately after 1 instead of putting 10 there like Windows does (and Alpha comes before numeric).
    I don't think the unix underpinnings changed sort order, but I may be remembering wrong. It's been a long time since OS 9. That's why I don't think the LANG switch will work.

  • Is it posisble to use DB_FILE_NAME_CONVERT to rename datafile names

    Hi,
    I want to clone a database on the same server.
    My datafiles start with the name of the SID, for examplel: /u04/oradata/ORACP/ORACP_applic_data_01.dbf'
    I want to use "duplicate fom active database", but with the parameter DB_FILE_NAME_CONVERT i can only change the directory to clone the datafile to, but the datafile itself is not renamed.
    I am correct?
    Is the only way to solve this, to use SET NEWNAME for all the datafiles to clone?
    Any help is appreciated.
    Reagrds,
    Harry

    Harry;
    Turns out I have a better document :
    http://www.visi.com/~mseberg/rman/create_a_duplicate_database_on_the_same_host.html
    I understand your concern, as far as suggestions double check everything. Thinking RMAN won't overwrite a MOUNTED file.
    *"To restore a datafile, either mount the database, or keep it open and take the datafile to be restored offline."*
    Source - Database Backup and Recovery Advanced User's Guide.
    When NOFILENAMECHECK is used with the DUPLICATE command, RMAN does not validate the filenames during restoration. Last I heard you don't use NOFILENAMECHECK when using the same host.
    See - Restoring and Recovering Database Files - Database Backup and Recovery User's Guide 11g Release 2 (11.2) E10642-03
    Best Regards
    mseberg
    Edited by: mseberg on Jan 9, 2013 12:38 PM

  • Descending order for arrays by name

    Hi, thank you to all the people who previously helped me before....
    Is there a way to sort an array in decending order by name?
    I was trying to figure out what to do but this is what i have so far
    double [] Salary = new double [10];
    String [] Names = new String [10];
    int i, j;
    for ( i = 0; i < 10; i++)
    System.out.print(" Name is: " + Names);
    Names[i] = ReadInput.StringRead(); //asks user for Salry
    System.out.println(" Salary is: " + Salary[i] );
    Salary[i] = ReadInput.readDouble(); //asks user for Names
    for (j=0; j < 10; j++)
    System.out.println(Names[j] + ": " + Salary[j]);

    Smckee6452, thank you for helping me.....
    i think i am getting close, but the sorting part (descending by names)part of the code is not working too well
    did i miss something??
    public class Compare {
    public Compare() {
    double [] Salary = new double [10];
    String [] Names = new String [10];
    String nameTemp = new String();
    double salaryTemp = 0.0;
    for (int i = 0; i < 10; i++)
    System.out.print(" Name is: " + Names);
    Names[i] = ReadInput.StringRead(); //asks user for Salry
    System.out.println(" Salary is: " + Salary[i] );
    Salary[i] = ReadInput.readDouble(); //asks user for Names
    // for (int j=0; j < 10; j++)
    // System.out.println(Names[j] + ": " + Salary[j]);
    for (int i = 0; i < 9; i++)
    for ( int j = 1; j < 10; j++)
    {    //do compare and swapping in here
    nameTemp = Names[i];
    Names[i] = Names[j];
    Names[j] = nameTemp;
    salaryTemp = Salary[i];
    Salary[i] = Salary[j];
    Salary[j] = salaryTemp;
    System.out.print(nameTemp);
    System.out.println(salaryTemp);

  • Datafile name still there in dba_data_files

    Hi
    One of my friend called me to ask about an issue with Oracle 8i on Solaris. Actually he is trying to create one tablespace (say TEST1) but it gives an error about the datafile that its already part of the database.
    Now there is no entry in DBA_TABLESPACES against that tablespace. But in DBA_DATA_FILES & V$DATAFILE that file is still being shown. Physically that file is not there in the directory specified.
    I tried alter database datafile offline drop; Even thats not helping. What could be the reason behind such scenario. And any way out to solve the issue. One thing is to use a different file name but thats not possible. File name has to be the same.
    This issue seems to be resembling drop datafile
    Any ideas ?
    Update: drop tablespace TEST1; also gives tablespace doesnt exist
    Thanks
    Sidhu
    Corrected Spells :)

    Hi,
    >> I got the contents of the control file and this file is there in the list of datafiles. So the solution is to recreate the control file after removing this entry ?
    In my point of view, yes ... Otherwise, I strongly suggest you to take a full cold backup of your database before perform this task. In addition, contacting Oracle Support is not a bad idea.
    >>Just out of curiosity, what could be the reason for such a scenario ? Tried few things, I was not able to recreate it.
    Actually, I don't know ... Maybe the alert log file can answer your question ...
    Cheers
    Legatti

  • Sort order of alphanumeric file names in Finder

    File Name Sorting
    I often using dates for file names - for letters and for photos in particular, with a format something like yymmdd, e.g., today's date, December 27, would be 071227. Occasionally I may use 20071227. If I have the year and month but do not have a specific date, the file name might look like 0712xx. The sort sequence of files in the various Finder views does not seem to be what I would expect, based on standard computer alphanumeric sorting rules. Here is what I am finding - three files beginning with file names 0708xx, 070212 and 070521 will appear in the Finder list as follows:
    0708xx
    070212
    070521
    whereas I would expect the proper sort order to be:
    070212
    070521
    0708xx
    If I change "xx" to "00" then the sort order is strictly numerical, i.e.,
    070212
    070521
    070800
    No one can explain why the files sort per the first list above, if I use the "xx" convention for the date. Is there a Leopard bug, or is the sort order based on an algorithm I am unfamiliar with.

    Tom's comprehensive article provides the answer but is perhaps a bit much for those looking for a simple, easy to remember rule. The brief one at File System Overview: Sorting Rules may be useful in this respect:
    "Digit sub-strings are sorted by numeric value rather than as characters."
    IOW, much like a human would naturally do, the Finder considers numeric expressions as potentially multi-character entities.
    Except ... just like humans, it seems not to know what to do with leading zeros. Try this:
    Create a new folder & add to it 4 sub-folders named as follows (all "0" characters are zeros):
    2
    2aa
    02
    02aa
    Note that in list view, Leopard sorts them by name as follows:
    02
    2
    02aa
    2aa
    But, try selecting them in order by hitting the tab key repeatedly, which should move you down the list one item after the other ... but doesn't.

Maybe you are looking for