×
Create a new article
Write your page title here:
We currently have 3,185 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,185Articles

    Concord/getNmsDeletedElements

    this is a nice basic script that uses oracle's sql to get element names that have an nms State of deleted

    more getNmsDeletedElements.pl
    #!/bin/perl
    use strict;
    use warnings;
    # simple script that outputs the names of elements that have an nmsState of Deleted
    # ie it will find elements that have been turned off for the Alcatel import module
    # the data in nmsStats is numeric 1 = active, 2 = deleted, 0 = ? 
    # i have not find the place in the munual yet with this infomation so this is just a guess
    
    my $oraUser="user name here";
    my $oraPassword="password here";
    my $oraPath="path to sqlplus command here"; # eg "/oracle/bin"
    my $nmsState="2" || die "Missing args $!"; # get required nmsState
    my $number="0";
    
    if ($nmsState !~ /0|1|2/) {die "not a valid nmsState";}
    
    my $elements = qx{$oraPath/sqlplus -S $oraUser/$oraPassword <<EOF
    set pages 100 lines 1000 head off
    SELECT NAME from NH_ELEMENT where NMS_STATE='$nmsState';
    exit
    EOF };
    #print $elements; #works to here.
    
    foreach my $segment (split(/\n/,$elements)) {
       next if $segment =~ /^$/;
       next if $segment =~ /no rows selected/;
       if ($segment =~ /\d[0-10] rows selected/) {$number=$1;}
       print "$segment\n";
    }
      print $number;
    

    Back to Concord Index

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.