Need help pulling information data store multiple vCenters VM

Thanks to the magic of Google and trial and error, I was able to develop the script below. The metric of the final I want to put the name of the data store the virtual computer is on and I can't for the life of understand me how do.

$myCol = @)

$TimeStamp = get-Date-format YYYY - MM - DD

Game-PowerCLIConfiguration - multiple DefaultVIServerMode - confirm: $true | Out-Null

$vcenters = @)

"Server1."

"Server2."

"server3"

"server4.

);

Connect-VIServer-Server $vcenters - username username-password password

ForEach ($Cluster Get-cluster)

{

ForEach ($vmhost in ($cluster |)) Get - VM))

{

$VMView = $VMhost | Get-View

$VMSummary = "" | Select Date VMName, NOMCLUSTER, MemorySizeGB, LogicalCPUs, ProvisionedSpaceGB, ResourcePool, DataStore

$VMSummary.Date = $timestamp

$VMSummary.VMName = $VMhost.Name

$VMSummary.ClusterName = $Cluster.Name

$VMSummary.MemorySizeGB = [math]: round ($VMHost.memorymb/1024, 2)

$VMSummary.LogicalCPUs = $VMHost.numcpu

$VMSummary.ResourcePool = $VMHost.ResourcePool

$VMSummary.ProvisionedSpaceGB = [math]: round ($vmhost. ProvisionedSpaceGB, 2)

$myCol += $VMSummary

}

}

$myCol | Sort VMName | Export-CSV C:\VM-$timestamp.csv

Any help would be appreciated.

Thank you!

Looks like you may be using an old PowerCLI version.

Make one

Get-PowerCliVersion

What did he say?

Upgrade to 5.5 R1

Tags: VMware

Similar Questions

  • Need help an existing data store is no longer to go in

    I have a data store that no longer exists on my SAN.  It still appears in the inventory as being inactive.  I can't remove it.  When I try to get the following:

    Call 'HostDatastoreSystem.RemoveDatastore' of object "datastoreSystem-121"on vCenter Server 'VCENTERSERVER2.onebane.com' failed."
    Operation failed, the diagnostic report: unable to query live VMFS volume State. : no such file or directory

    In addition, an of my hosts shows that it is always connected to what is interesting because the LUN has disappeared.  No VM appear on the virtual computers tab.

    Is there a way to force this LUN of stocks?

    Thank you very much!

    I've not seen instructions either - I just connect via ssh as root
    Then I use winscp and navigate to/etc/vmware
    There you can right click on esx.conf and change it.

    Helped me once to solve a similar problem.

    You will find a section starting with
    LUN/storage.

    Each logic unit number has two lines... I just removed the two lines for you LUN in question.

    First, create a backup of the file

  • Need help with the data storage store, local array and network connections

    Need help with my ESXi 4.1 installation

    My hardware:

    I built a server with an Asus P6T whitebox, i7 920, 12 Gig RAM, NIC, Intel Pro1000 PT Quad, 3ware 9650SE-12ML with 8 1.5 TB SATA green in a raid 6 array gives me about 8 + TB with a spare drive all housed within a NORCO RPC-4220 4U Rackmount Server chassis.  I also have a 500 GB SATA drive which will hold the ESXi and virtual machines.

    The network includes a firewall, Netgear Prosafe FVS336G, GS724Tv of Netgear ProSafe 24 port Gigabit Managed Switch on a dhcp cable modem internet service provider.

    I also have 2 old NetGear SC101T NAS disks (4to) I want to connect to the system how some - at a later date have... data on them and want to transfer to the new storage array. I always looking into the question of whether they will work with ESXi 4.1, or I might have to only access it through Windows XP.

    My Situation:

    I have already installed ESXi 4.1 and vsphere client with no problems and it is connected to a dhcp cable internet service.  I've set up host via a dynamic DNS service name give me a static hostname on the internet.  I installed three machines to virtual OS successfully at the moment and now want to first start by creating a multimedia storage server which will use some of this new 8 TB array, then separate data storage for use with a web server small overhead storage and a backup.  It is a domestic installation.

    Help with the data store and network:

    I was doing some reading, because I'm new to this, and it looks like I'll probably want to set up my table via ESXi as a nfs disk format.  Now, the data store is usually in another physical box from what I understand, but I put my readers and ESXi all in the same box.  I'm not sure that the best way to put in place with grouped network cards, but I want to make this work.

    I understand that in ESXi 4.1 using iSCSi LUN must be less than 2 TB, but nfs - I should be able to add a bigger partition then 2 TB (for my multimedia) in nfs, right? or should I still add it separately as a separate 2 TB drives and then extend them to get the biggest space.

    Any suggestions or direct resources showing examples on how to actually add some parts of the table as data warehouses separate nfs.  I know that to go to the configuration tab, and then select Add to storage, and then select nfs. I have not my picture, but it's here that I don't know what to do because ESXi 4.1 system already has an address, should I put the same thing to the new data store array also (will it work?), and what should I use for the name of the folder and the store of data... just do something to the top.  I thought to later install Openfiler (for a multimedia storage using this table server) as a virtual machine, use the table with esxi so that I can access the same storage space with widows and linux-based systems.

    I also know I have to find a way to better use my quad nic card... put in place of virtual switches, grouping, etc HELP?

    Any direction, assistance, similar facilities to sample, suggestions or resources that would help would be great. I did a lot of hunting, but still a little confused on how to best to put in place.

    You must think of VMDK files of large databases with records of random size guest go read some data (a DLL or an INI file), maybe write some data back, then go read other data. Some files are tiny, but certain DLLs are several megabytes. It's random i/o all and heavy on the search time. IO Opsys is small random operations that are often sequential (go read data, write data, go read other data,...) so that deadlines are critical to the overall performance. That's why people say OPS are / s of reference and forget the MBs flow. The only time where you bulk transfers are when you read media (ISO files).

    Well, now forget all this. Actually the disk activity will depend on the specific applications (database? mail server? machines compiler?), but the above is true for boots, and whenever applications are idle. You should see the profile to know.

    RAID 10 is faster (and often more reliable) than RAID 5 or RAID-6 except in certain specific cases. In General RAID 10 is ideal for many random writes, since the calculation of parity for RAID-5 and - 6 adds to the overall latency between command and response - latency is cumulative if a little slow here and a little slow it adds up to a lot of overall slow synchronous especially with e/s on a network. OTOH RAID-5 and -6 can produce faster readings due to the number of heads, so you can use it for virtual machines that transfer bulk. Test. You may find that you need several different types subdashboards for best results.

    You said 3ware, they have some good grades on their site, but don't believe it. With my 9650 that I found myself with only a couple of their recommendations-, I put the (simple) table for allocation size 256 k, nr_requests at 2 x the queue_depth and use the planner date limit. I had the habit for the Ext4 file system formatted with stride and stripe-width synced to the table and used the options large_files with fewer inodes (do not use the huge_files option unless you plan to have single VMDK files in the terabyte range). Use a cache of great reading in advance.

    Virtual machines use VMDK files in all cases except raw iSCSI LUN that they treat native disks. VMDK is easier to manage - you can make a backup by copying the file, you can move it to a PC and load it into another flavour of VMware, etc. There could be some features iSCSI to your San as a transparent migration but nothing for me. NFS has less chatter of Protocol if latency lower times to complete an operation. NFS is good to read and write a block of data, that's all it boils down to.

    UPS is good, but it won't help if something inside the machine explodes (UPS does nothing if the PC power supply goes down). If the RAID card has an option for a battery backup module, so it can contain some writings in memory and may end up the disk i/o after replacing the power supply. 3ware also limits the types of caching available if help is not installed, and you get just the right numbers with the module.

  • Need to rename a data store.

    Dear team,

    I have a SAN Lun mapped to one of the esx host, sure I created a data store, now we are planing to make a naming convention appropriate to a data store g exisitn, I need to rename a data store. is it possible to rename a data store where the VM production? It will affect running virtual machines that are stored on this data store. ????

    concerning

    Mr. VMware

    You can rename no problem with no impact to your infrastructure.  It is simply an object name in vCenter

  • I need a few persistent data store help of Pentecost

    Hi, I have a problem, try to store persistent data, I m using Eclipse 3.4.2 and BlackBerry plugin, as I check my work with the correct laboratory and my code hasn´t issues only a warning I see on the laboratory code it s normal, but when I try to run the Simulator I get this:

    "Eception exception: lack of measurement of the resource.

    and this is the code

    package com.rim.someguy;
    
    //Import section
    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.*;
    import net.rim.device.api.system.*;
    import net.rim.device.api.util.*;
    import net.rim.device.api.i18n.ResourceBundle;
    import java.util.*;
    
    public class measure extends UiApplication implements measureResource{
    
        //Variables for user interface fields
        private EditField numMeasureDev;
        private AutoTextEditField observation;
        private EditField lecture;
        private ObjectChoiceField choice;
        private EditField date;
    
        //Persistent data
        private static Vector data;
        private static PersistentObject store;
    
        //Resource bundle variable
        private static ResourceBundle _res;
    
        //MAIN
    
        public static void main(String[] args){
            measure app = new measure();
            app.enterEventDispatcher();
        }
    
        //Save Menu
        private MenuItem saveItem = new MenuItem(_res, SAVE, 110, 10){
            public void run(){
                StoreInfo nfo = new StoreInfo();
                nfo.setElement(StoreInfo.NUM, numMeasureDev.getText());
                nfo.setElement(StoreInfo.LEC, lecture.getText());
                nfo.setElement(StoreInfo.DAT, date.getText());
                nfo.setElement(StoreInfo.SEL, _res.getString(choice.getIndex()));
                nfo.setElement(StoreInfo.OB, observation.getText());
                data.addElement(nfo);
    
                //Storing data
                synchronized(store){
                    store.setContents(data);
                    store.commit();
                }
                Dialog.inform(_res.getString(APP_SUCCESS));
                numMeasureDev.setText(null);
                lecture.setText(null);
                date.setText(null);
                choice.setLabel(null);
                observation.setText(null);
            }
        };
    
        //Get Menu
        private MenuItem getItem = new MenuItem(_res, GET, 110, 10){
    
            protected int index;
    
            public void run(){
                synchronized(store){
                    data = (Vector) store.getContents();
                    LabelField label = new LabelField();
                    label.setText("Selecciona el dato a mostrar: ");
                    BasicEditField bef = new BasicEditField();
                    index = Integer.parseInt(bef.getText());
                    if (!data.isEmpty()){
                        StoreInfo nfo = (StoreInfo) data.elementAt(index);
                        numMeasureDev.setText(nfo.getElement(StoreInfo.NUM));
                        lecture.setText(nfo.getElement(StoreInfo.LEC));
                        date.setText(nfo.getElement(StoreInfo.DAT));
                        choice.getIndex();
                        observation.setText(nfo.getElement(StoreInfo.OB));
                    }
                }
            }
        };
    
        //Persistent Object
        static{
            //Resource Bundle
            _res = ResourceBundle.getBundle("measure");
    
            //Get the reference to PersistentObject and set value to Vector if is empty
            store = PersistentStore.getPersistentObject(0xdec6a67096f833cL);
            //key is a hash
            synchronized(store){
                if (store.getContents() == null){
                    store.setContents(new Vector());
                    store.commit();
                }
            }
        }
    
        //Class created for a persistent object StoreInfo
        private final static class StoreInfo implements Persistable{
    
            //Data for elements
            private Vector elements;
    
            //Fields
            public static final int NUM = 0;
            public static final int LEC = 1;
            public static final int SEL = 2;
            public static final int OB = 3;
            public static final int DAT = 4; 
    
            //in StoreInfo, add a new empty Vector with capacity of 4 elements and persist
            public StoreInfo(){
                elements = new Vector(5);
                for(int i = 0; i < elements.capacity(); ++i){
                    elements.addElement(new String(""));
                }
            }
    
            //Retrieve Vector element
            public String getElement(int id){
                return (String) elements.elementAt(id);
            }
    
            //Set Vector Element
            public void setElement(int id, String value){
                elements.setElementAt(value, id);
            }
        }
    
        //Measure constructor declaration
        public measure(){
    
            //Create a main screen
            MainScreen mainS = new MainScreen();
            mainS.setTitle(_res.getString(APPLICATION_TITLE));
            numMeasureDev = new EditField(_res.getString(TEXT1),"",
                    Integer.MAX_VALUE, EditField.FILTER_NUMERIC);
            lecture = new AutoTextEditField(_res.getString(TEXT5),"",
                    Integer.MAX_VALUE, EditField.FILTER_NUMERIC);
            date = new EditField(_res.getString(TEXT6),"");
            choice = new ObjectChoiceField(_res.getString(TEXT2),_res.getStringArray(OPTION));
            observation = new AutoTextEditField(_res.getString(TEXT3),"");
    
            //Adding elements to Screen
            mainS.add(numMeasureDev);
            mainS.add(lecture);
            mainS.add(date);
            mainS.add(choice);
            mainS.add(observation);
    
            //Adding menuItems to menu
            mainS.addMenuItem(saveItem);
            mainS.addMenuItem(getItem);
    
            //Push all elements to screen
            pushScreen(mainS);
        }
    }
    

    If anyone knows what I m hurt you showme how please!

    Two thoughts:

    1. If you have changed somehow the object type that you want to keep, you must remove the Simulator files before running again.
    2. How about you provide a clue as to where the class cast exception that happens? You are more likely to help in this way.
  • Help with the data store migration script

    Hey everybody,

    I am currently responsible for the migration of disks in new storage. Each virtual computer might have multiple disks on different data warehouses. The script I'm working on that will check the VM for the disks located on a certain store of data, then if necessary to migrate the disk to the new data store. However, I'm lost. I hope I'm at least on the right track. Any help is very appreciated.

    Thank you!

    $csv = import-Csv-Path "e:\scripts\hunter\vantage_qadev.csv".

    foreach ($ent in ($csv))

    {

    $ds = get-Datastore ' QADEV_OS_HUS127 * ' | Sort descending FreeSpaceGB | Select-Object - 1 first

    $vmname = get-VM-name $ent.vmnames

    $vmds = $vmname | Get-hard drive | Select file name

    If ($vmds - eq "* QADEVOS_VSP986 *") {Get - VM $ent.vmnames |} Get-hard drive | Moving-hard drive - Datastore $ds}

    Else {Write-Host "Migration without any preconditions"}

    }

    That's what I did to make it work. The fact it's supposed to I would say...

    $csv = Import-Csv -way "e:\scripts\hunter\vantage_prod.csv".

    foreach ($ent in ($csv))

    {

    $ds = Get-Datastore ' DST_PROD_OS_HUS127 * ' | Sorting FreeSpaceGB -down | Select-Object -First 1

    Foreach ($HardDisk in (Get-VM -name $ent.vmnames |)) (( Get - hard drive))

    {

    $vm = Get-VM -name $ent.vmnames

    $hds = Get - hard drive -VM $vm

    $lunname = Get-VM -name $ent.vmnames | Get - hard drive | Select-Object -Property @{N = "Datastore"; E = {$harddisk. FileName.Split("]") [0]. TrimStart("[")}}

    If ($lunname - like "* DM_PROD_OS_VSP986 *") {Get-VM -name $ent.vmnames |} Get - hard drive | Moving - hard drive { -Data store $ds -confirm: $false}

    else {Write-Host $ent.vmnames ' not migrated '}

    }

    }

    What is a better way to do it?

  • VMFS partition table corruption? Need help to retrieve data

    My House ESXi 5.1 was installed on HP Microserver G7. Hypervisor on USB-flash, datastore on Adaptec 3405.

    After some problems of power electro Microserver is will not start and I have chosen to build the new server on Microserver Gen8. I moved Adaptec and disks in the new box, installed new ESXi 5.5 U1 (HP image) on USB and after reboot did not store data :-(.

    After some research, I found that ESXi is not see any partition table on this raid array:


    partedUtil getptbl /vmfs/devices/disks/mpx.vmhba2:C0:T0:L0

    unknown

    728422 255 63 11702108160

    BUT! I tried to start the server of linux liveCD with vmfs-tools 0.2.5 installed partition mounted with vmfs-fuse and able to see the data! But cannot copy all important vmdk (see below).

    debugvmfs is also show me some useful information:

    Volume Version: 14

    Version: 54

    Label: STORE

    Mode: public

    UUID: 4f2ac538-58c181cf-arms-441ea13ee615

    Creation date: 2012-02-02 23:17:44

    Block size: 1 MiB

    Subblock size: 8 KiB

    Size of header of the FDC: 64 KiB

    County of FDC Bitmap: 64

    and it's very strange

    debugvmfs/dev/sda1 see the lvm.extent [0]

    Device: / dev/sda1

    UUID: 4f2ac4da-8de4b166-a-441ea13ee615 848

    LUN: 0

    Version: 5

    Name:

    Size: 459.99 GiB

    NUM. Segments: 22319

    First Segment: 0

    Last Segment: 22318


    because I don't know that I don't create scopes.


    Also, there are two vmdk files on more than 256 GB data store and it cannot copy because of the limitation of vmdk-tools :-(.


    I tried to do a magic (like this - partedUtil setptbl "/ vmfs/devices/disks/mpx.vmhba2:C0:T0:L0" GPT "1 2048 11702099429 AA31E02A400F11DB9590000C2911D1B8 0""), but without success;-(.)


    All the suggestions, guys?

    Finally!

    Found that was an "Intel VT - d" enabled in the BIOS. After disable it everything is cool.

    It looks like Adaptec 3405 working wrong with it. Will try to change it to P222.

  • need help for calculation date

    I need help with this:

    I added successfully a document level script to add the date printed in my document

    this.getField("DatePrinted").value = util.printd ("mm/dd/yy", new Date());

    I now need to fill in a field named "Date" with a date that is 14 days after the date of DatePrinted.

    and I'm lost.

    Can anyone help?

    Get the current date/time

    var d = new Date();

    Add 14 days

    d.setDate (d.getDate () + 14);

    Set a field value

    getField("Deadline").value = util.printd ("mm/dd/yy", d);

    That last part may need to be changed depending on where you place the script. If it's the same script at the document level, the whole thing can be:

    Get the current date/time

    var d = new Date();

    Set a field value

    getField("DatePrinted").value = util.printd ("mm/dd/yy", d);

    Add 14 days

    d.setDate (d.getDate () + 14);

    Set another value of field

    getField("Deadline").value = util.printd ("mm/dd/yy", d);

  • need help on filling data dynamically from list of choice while the page is loading

    Hi all

    I need to dynamically fill data in the picklist (drop-down list on the component) during the loading of the page itself, can you please a little help on this. I mean for the values of the component < f: selectItems > < af:selectOneChoice > must be filled dynamically, so that loading page. I will be grateful if you can provide examples of code.


    Thanks in advance



    Concerning
    Ashok E

    Hello

    the problem with your code is that it is not af:selectItem but f: selectItems


    *

    Frank

  • Need help with the date of Validation Urgent

    Hello

    We need help in the Validation Date.

    We have 2 fields of Date on the form the Start Date, End Date

    The requirement is: End Date (cannot be more than 30 years as of the start date).

    I wrote after the script on the exit eventof the End Date . But the problem is its calculation of 30 years from the current Date not from the Start Date

    var

    tDate = util.scand (' mm/dd/yyyy', new Date());

    var

    M = tDate.getMonth ();

    var

    D = tDate.getDate ();

    var

    Y = tDate.getFullYear ();

    var

    SRes = util.printd("yyyy-mm-dd", new Date((Y+30), M,D) );

    App.Alert (SRes)

    If

    (SRes < = this.rawValue)

    {

    App.Alert ("cannot be greater than 30 years from the start date")

    () xfa.host.setFocus

    ce );

    }

    can someone help me please

    Kind regards

    Jay

    Hello

    You need to get the LCD field javascript and calculate & compare with the future date in date javascript.

    Try the following script.

    var sDate = StartDate.rawValue;
    var wkStartDate = util.scand ("yyyy-mm-dd", sDate);

    nYear var = wkStartDate.getFullYear ();
    nMonth var = wkStartDate.getMonth ();
    nJour var = wkStartDate.getDate ();

    var wkFutureDate = new Date (+ 30 nYear, nMonth, nJour);

    sDate = EndDate.rawValue;
    var wkEndDate = util.scand ("yyyy-mm-dd", sDate);

    If (wkEndDate.getTime () > wkFutureDate.getTime ()) {}
    xfa.host.messageBox ("cannot be more than 30 years from the start date");
    xfa.host.setFocus (this);
    }

  • Need help with coversion date

    Hello

    I have a date format that is varchar2 and value is as on 2009-03 - 31.i need to convert to date and it must be as on 31 March 09

    I get as error 0RA-01981... Please help me in this
    SQL> select to_date('2009-03-31','yyyy-mm-dd') xc from dual ;
    
    XC
    ------------------------------
    31-MAR-09
    

    For your http://ora-01981.ora-code.com/ error

    SS

  • Need help to recover data from registry to update to Windows 8.1

    So I'm quite a pickle here. I need to update my computer Windows 8.1 but the installer of Windows 8.1 (app) do not like it when you have made changes to the registry.

    I'm running an SSD 128 GB as my main boot (c :)) drive
    Along with that I am running a 2 TB HDD as my main storage to store any (e)
    To make this work I had to change the locations of the registry for Program Files and Program FIles (x 86) file, so that my SSD would not fill.
    But while doing this, I've never done a backup of the original registry to restore to the.
    I really need 8.1 Windows for Visual Studio.
    Sidenote. I built this PC by myself
    Data sheet:
    Core i7 3870
    ASUS P9X79 motherboard
    EVGA GeForce GTX 670
    Boot drive for the SSD 128 GB
    Storage of 2 TB drive
    Windows 8

    (You can help hope)

    Hello

    Microsoft does not recommend changing the registry entries of Program files and the data folder drive C: as it has very high chances of failure. This is why it is not recommended to take this path, unless the changes are cancelled.

    To cancel the changes you have made, you must refer to the guide or the steps you followed to move the location of the program files and revert the changes exactly in the order given earlier.

    If you have made changes recently, you can restore the computer before changes to the registry and check if it helps.

    How to restore, refresh or reset your PC

    http://Windows.Microsoft.com/en-us/Windows-8/restore-refresh-reset-PC

    Important: System Restore will return all your files non-system as documents, email, music, etc., to a previous state. These files of types are completely affected by the restoration of the system. If it was your intention with this tool to recover a deleted file to non-system, try using a file instead of system restore recovery program.

    Hope this information helps. If you have any questions, please let us know.

  • Need help with vSphere data script, packaging and sending it to the data warehouse

    Greetings PowerCLI gurus.


    Everyone can offer suggestions on a script which can query vSphere and pull on the following fields of the virtual computer:

    NameStateStatusHostSpace in useSpace used

    Format in a file in the CSV format and send the file to an FTP server?

    Much respect to all, thanks a lot in advance.

    Hello-

    Happy to help you.

    OK, well, if this database is accessible through a UNC path, you might make a copy directly using Copy-Item.  If you use different credentials, you can encrypt and store in an XML file.  HAL Rottenberg wrote to do http://halr9000.com/article/531.

    Or, if this pension data is something that supports the secure copy (scp) or secure FTP (SFTP), those who would be good options.  Again, you can store the alternative credentials in an encrypted in an XML file format and use them as needed.

    Certainly, there is a balance to be struck between security and ease of use.  It may be such that the transmitted data are not considered sensitive to all, and clear data transfers are acceptable.  Probably still a good idea to take measures to protect the credentials at least.

  • need help with xml data

    Hi all

    need your spiritual help once more!
    I have a table 'product' as below:

    create table product)
    product_id number (2),
    product_info varchar (4000));

    Select * from product:
    product_id product_info
    1 < ticketing > < product = 'TV' > < productservice = "shipping" > < / productservice > < / product = 'TV' > < / ticket >

    I need to get the column product_info information in a new table with 2 columns product and productservice product_details. as in: -.
    Select * from product_details:
    product_id product productservice
    1 expedition TV

    any suggestions on how to do it.
    PS-> for a product it can be several services and there may be several products for a ticket.

    Your XML file is not well formed at all (so many errors in there).

    However, if you had a valid XML code, you could do something like that...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 1 as product_id, '' as product_info from dual union all
      2             select 2, '' from dual)
      3  --
      4  -- end of test data
      5  --
      6  select t.product_id, x.*
      7  from t
      8      ,xmltable('/ticketing/product'
      9                passing xmltype(t.product_info)
     10                columns product varchar2(10) path '/product/@name'
     11                       ,service varchar2(15) path '/product/productservice/@name'
     12*              ) x
    SQL> /
    
    PRODUCT_ID PRODUCT    SERVICE
    ---------- ---------- ---------------
             1 TV         shipping
             2 VCR        delivered
    
  • Need help pulling a name string

    Hello I'm on Oracle 11 GR 1 material and have a strings of data like these:

    SMITH, KAY C. RN, FNP
    WESTON, DEBRA, L
    ASH, CHRISTOPHER, J., PA - C
    EYEBROWS, CATHERINE J MSN NOCD
    ASH, MICHELLE
    NASH, BOB MC T MD
    BROWN-JONES, LARRY RN

    I need to enter these:
    LAST_NAME
    FIRST NAME
    MI
    CODE (the first one)

    So, if we where to watch again the data after it is pulled apart, I would like to see this:
     
    LAST_NAME     FIRST_NAME     MI    CODE 
    SMITH         KAY            C     RN 
    WESTTON       DEBRA          L       
    ASH           CHRISTOPHER    J     PA-C 
    BROW          CATHERINE      J     MSN 
    ASH           MICHELLE 
    That's what I have (this code will be executed on an external Table with 1.5mil lines):
     
    select 
        substr('SMITH, KAY C. RN, FNP',1,instr('SMITH, KAY C. RN, FNP',',')-1) as LAST_NAME, 
        regexp_substr(SMITH, KAY C. RN, FNP', '[^, ]+ ') as FIRST_NAME 
    from dual; 
    I don't know how to get the rest.

    Thanks for any help

    Published by: Sky13 on September 23, 2011 12:04
    I added a few samples more

    Hello

    Look at the data and try to find some patterns. You will not be able to get everything right, but you may be able to make the most of them.
    I would look for things:
    There always at least 1 comma in the chain? Are you sure that what comes before the (first) comma is always a name?
    When there are 2 commas, codes never come before the 2nd comma?
    Codes always come after the names?
    What parts are sometimes missing? How many times they lack?
    Never just 1 character codes?
    Some codes occur very frequently?
    Is this practice to create a table of the most common codes, or even all the codes?

    It will be much easier in PL/SQL.
    You can write a procedure which takes 1 IN argument (the plain text) and 5 on arguemnts:
    (1) first name
    (2) first name
    (3) other initial
    (4) code
    (5) a number indicating what is the probability that the results are correct. For example, 100 may indicate a very simple string, such as "Dyer, Mary. You can print the with the lowest number for some person to review manually.

    Good luck!

Maybe you are looking for

  • Satellite Pro P100: Lines from screen to screen

    Hello people wonder if you can help me... actually wonder if I'm in the right forum... I think it's a problem of monitor not a software problem...As of late I have vertical lines that appear on my screen... very thin and in pretty colors, light blue,

  • Keyboard and BIOS update issue on Satellite L505-13V

    Hello, I have two problems with my laptop. First is related to the keyboard. It started a few days ago, the laptop has wound down due to low battery, when I turned on it again once, I received a bad operation of the keyboard.The main problem is that

  • Display image gif from the Internet in labview

    Hello I want to display a gif of the Internet and display them in the labview. How can I do this? for example: http://icons-ak.wxug.com/i/c/k/nt_cloudy.gif I couldn't find any vi for gif images in the "palette of graphical Format.

  • Router Befw11s4 - WARNING long post

    I bought a router of v.4 befw11s4 a couple of years back.  I remember spending hours with tech support to make it work, and even after that I got it working it never worked very well.  The router would reset continually itself, which would require me

  • Help: stop Windows Firewall-Savior popping

    Hello.I had just dried my brain by Windows Firewall-Savior poppings, I had tried to stop his approach, no way and I had experienced with the uninstall, it simply does not work there.How can I? I haveGod ~ ~ !Help me, please...