9. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/18/2017 3:49:13 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

9.1 Files compared

# Location File Last Modified
1 Genisis2Client-master.zip\Genisis2DataOps-master\documentation tableCopyDocumentation.docx Fri Mar 24 19:19:46 2017 UTC
2 Genisis2Client-master.zip\Genisis2DataOps-master\documentation tableCopyDocumentation.docx Tue Apr 18 18:43:29 2017 UTC

9.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 1 452
Changed 0 0
Inserted 0 0
Removed 0 0

9.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

9.4 Active regular expressions

No regular expressions were active.

9.5 Comparison detail

  1   Genisis2 D ata Operat ions – Tab le Copy De monstratio n Prototyp e
  2  
  3  
  4  
  5  
  6   3/24/17
  7  
  8  
  9  
  10  
  11  
  12  
  13  
  14  
  15  
  16  
  17  
  18  
  19  
  20  
  21  
  22  
  23   Demonstrat ion Protot ype Flow
  24   First, the  program w ill create  a new tab le copy fr ame to set  up for th e prototyp e. A pane  is then ad ded to the  frame wit h the mock -up image  and button  for users  to press.
  25  
  26  
  27   When the " Copy Table " button i s pressed,  it will g enerate a  pop up men u with pre -initializ ed test lo g in infor mation so  that all t he user sh ould enter  are the t able names  that they  would wan t copied.  After the  informatio n is deeme d to be co rrect, pre ss the ‘OK ’ button. 
  28  
  29  
  30  
  31  
  32   Java Code
  33   When the i nformation  is entere d, it will  take in t he entered  text as v ariables s toring eve rything ex cept the p asswords a s strings,  and stori ng the pas swords as  char array s. Due to  the use of  linked se rvers in s ql server  management  studio, t he source  username a nd passwor ds are not  required,  just the  name of th e linked s erver.
  34      if (res ult == JOp tionPane.O K_OPTION)
  35           // when all t he informa tion is co rrect in t he fields,  press the  default p op-up okay  option
  36           {
  37           // get the te xt input i nto the fi elds and i nitialize  variables  for parame terization
  38            S tring sIP  = sourceIP .getText() ;
  39            / /no longer  needed du e to use o f Linked S ervers
  40            / /String sU sername =  sourceUser name.getTe xt();
  41            / /char[] sP asswords =  sourcePas sword.getP assword();
  42            / /String sP assword =  new String (sPassword s);
  43            S tring dIP  = destIP.g etText();
  44            S tring dUse rname = de stUsername .getText() ;
  45            c har[] dPas swords = d estPasswor d.getPassw ord();
  46            S tring dPas sword = ne w String(d Passwords) ;
  47  
  48   The table  field will  be stored  as a stri ng and the n turned i nto an arr ay of stri ngs separa ting where  the user  entered a  comma. The  table nam es now sto red in a s tring arra y will be  trimmed to  remove an y trailing  white spa ce after c hecking fo r an empty  table fie ld. 
  49   // get tab les entere d into the  field as  a string
  50            S tring tabl es = table Names.getT ext();
  51            / /convert t able field  string in to string  array spli tting at c ommas
  52     String[]  table  =  tables.spl it(",");
  53     //remove  trailing  white spac es and err or check f or empty t able field
  54     for (int  i = 0;i<t able.lengt h;i++)
  55     {
  56     if(table [0].equals (""))
  57     
  58     {
  59    JOptionPa ne.showMes sageDialog (null, "No  Table(s)  Found", "E rror", JOp tionPane.E RROR_MESSA GE);
  60    JOptionPa ne.showMes sageDialog (null, "Th e copy pro cess has b een cancel ed", "Canc eled", JOp tionPane.E RROR_MESSA GE);
  61    return;
  62     }
  63     
  64    table[i]  = table[i] .trim();
  65     System.o ut.println (table[i]) ;
  66     }
  67  
  68   The table  array is i terated th rough and  copied one  at a time  by a for  loop that  runs throu gh the SQL  scripts d etailed be low. The v ariables r eceived fr om the tex t fields a re used to  parameter ize sqlcmd  calls. 
  69   // startin g with the  first tab le in the  string arr ay, use a  for loop t o run one  table at a  time thro ugh the pa rameterize d copy pro cess
  70     for (int  i = 0;i<t able.lengt h;i++){
  71    //initial ize differ ent comman ds to be r un  
  72   String sou rceTableCo unt_cmd =" sqlcmd -U  "+dUsernam e+" -P "+d Password+"  -S "+dIP+ " -d "+ "M ANAGEMENT"  +" -i pre count.sql  -v ip = "+ sIP+" tb =  "+table[i ];
  73   String sou rceChecksu m_cmd ="sq lcmd -U "+ dUsername+ " -P "+dPa ssword+" - S "+dIP+"  -d "+ "MAN AGEMENT" + " -i prech ecksum.sql  -v ip = " +sIP+" tb  = "+table[ i];
  74   String tab leCopy_cmd  ="sqlcmd  -U "+dUser name+" -P  "+dPasswor d+" -S "+d IP+" -d "+  "MANAGEME NT" +" -i  tablecopy. sql -v ip  = "+sIP+"  tb = "+tab le[i];
  75   String des tTableCoun t_cmd ="sq lcmd -U "+ dUsername+ " -P "+dPa ssword+" - S "+dIP+"  -d "+ "MAN AGEMENT" + " -i postc ount.sql - v tb = "+t able[i];
  76   String des tChecksum_ cmd ="sqlc md -U "+dU sername+"  -P "+dPass word+" -S  "+dIP+" -d  "+ "MANAG EMENT" +"  -i postche cksum.sql  -v tb = "+ table[i];
  77   String cop yStatusUpd ate_cmd =" sqlcmd -U  "+dUsernam e+" -P "+d Password+"  -S "+dIP+ " -d "+ "M ANAGEMENT"  +" -i cop yStatusUpd ate.sql -v  tb = "+ta ble[i];
  78   String man agementIns ert_cmd =" sqlcmd -U  "+dUsernam e+" -P "+d Password+"  -S "+dIP+ " -d "+ "M ANAGEMENT"  +" -i man agementIns ert.sql -v  tb = "+ta ble[i];
  79   String pre copyStatus Update_cmd  ="sqlcmd  -U "+dUser name+" -P  "+dPasswor d+" -S "+d IP+" -d "+  "MANAGEME NT" +" -i  beforeCopy Error.sql" ;
  80   String pos tcopyStatu sUpdate_cm d ="sqlcmd  -U "+dUse rname+" -P  "+dPasswo rd+" -S "+ dIP+" -d " + "MANAGEM ENT" +" -i  afterCopy Error.sq";
  81   String dro pCorrupted _cmd ="sql cmd -U "+d Username+"  -P "+dPas sword+" -S  "+dIP+" - d "+ "MANA GEMENT" +"  -i dropCo rrupted.sq l -v tb =  "+table[i] ;
  82  
  83   The calls  are made f rom the Ja va Runtime  class and  stored in  a process  to read t he logs fr om. If the  process c auses sqlc md to outp ut a messa ge( which  would only  happen in  this case  if an err or had occ urred, den oted by th e Msg keyw ord), the  process is  stopped a nd the pro totype is  returned t o the stat e before c licking th e “Copy Ta ble" butto n. 
  84  
  85  
  86  
  87  
  88   Errors are  checked f or in ever y call to  sqlcmd. Be low is an  example of  how all S QL scripts  are calle d.
  89  
  90   //insert t he table n ame into t he managem ent table  to create  a row for  logging wh ile checki ng for err ors thrown  by sqlcmd
  91   System.out .println(" insert");
  92   //call to  runtime wi th paramet erized sql cmd call
  93   Process pr ocess = Ru ntime.getR untime().e xec(manage mentInsert _cmd);
  94   int status  = process .waitFor() ;
  95   System.out .println(s tatus); 
  96   //read the  logs into  a string  to look fo r errors t hat occurr ed during  the call
  97   BufferedRe ader input  = new Buf feredReade r(new Inpu tStreamRea der(proces s.getInput Stream())) ;
  98   while ((li ne = input .readLine( )) != null
  99   {  inputLo g=inputLog +line+"\n" ;
  100   }
  101   input.clos e();
  102   System.out .println(i nputLog);
  103   //in case  of errors,  display m essage and  return ou t of the f or loop
  104   if(inputLo g.toLowerC ase().cont ains("Msg" .toLowerCa se()))
  105   {
  106           JO ptionPane. showMessag eDialog(nu ll, inputL og, "Error ", JOption Pane.ERROR _MESSAGE);
  107           JO ptionPane. showMessag eDialog(nu ll, "The c opy proces s has been  canceled" , "Cancele d", JOptio nPane.ERRO R_MESSAGE) ;
  108   process =  Runtime.ge tRuntime() .exec(prec opyStatusU pdate_cmd) ;
  109   status = p rocess.wai tFor();
  110   return;
  111   }
  112      System. out.printl n(inputLog );
  113   //also che ck for les s common c md errors  mostly for  testing 
  114   BufferedRe ader error  = new Buf feredReade r(new Inpu tStreamRea der(proces s.getError Stream())) ;
  115   while ((li ne = error .readLine( )) != null
  116   {
  117   errorLog=e rrorLog+li ne+"\n";
  118   }
  119   error.clos e();
  120   System.out .println(e rrorLog);
  121   if(errorLo g.toLowerC ase().cont ains("erro r".toLower Case()))
  122   {
  123   JOptionPan e.showMess ageDialog( null, erro rLog, "Err or", JOpti onPane.ERR OR_MESSAGE );
  124   JOptionPan e.showMess ageDialog( null, "The  copy proc ess has be en cancele d","Cancel ed", JOpti onPane.ERR OR_MESSAGE );
  125   process =  Runtime.ge tRuntime() .exec(prec opyStatusU pdate_cmd) ;
  126   status = p rocess.wai tFor();
  127   return;
  128   }
  129  
  130  
  131   After runn ing throug h all the  SQL script  calls, an d there ar e no error s the user  is notifi ed that th e copy of  that table  has succe ssfully be en copied  from the s ource serv er to the  destinatio n server.
  132  
  133  
  134  
  135    If there  are more t ables in t he array i t will sta rt the for -loop agai n, if ther e is not t hen the us er is noti fied that  all their  tables hav e been suc cessfully  copied.
  136  
  137  
  138  
  139  
  140  
  141  
  142  
  143  
  144   Below are  the SQL sc ripts call ed in the  for-loop f or table c opy.
  145  
  146  
  147  
  148  
  149  
  150  
  151  
  152  
  153  
  154  
  155  
  156  
  157  
  158   SQL server  scripts
  159  
  160   •Inserting  a column  in a manag ement tabl e for new  entry:
  161      $tb = T able name
  162  
  163   INSERT INT O [MANAGEM ENT].[dbo] .[Manageme nt_table]  (ReqID,Dat abaseName,  Table_Nam e,          dateandti me) VALUES  ((SELECT  (max(ReqID )+1) from  [MANAGEMEN T].[dbo].[ Management _table]),    'vinci10 0295', '$( tb)', CURR ENT_TIMEST AMP );
  164  
  165   •Number of  rows befo re copy:
  166       $ip: S erver name
  167       $tb: T able name
  168  
  169   update [MA NAGEMENT]. [dbo].[Man agement_ta ble] set r owcount_be fore_copy=  (select c ount(*) fr om [$(ip)] .[vinci100 295].[dbo] .[$(tb)])  where ReqI D = (selec t MAX(ReqI D) from [M ANAGEMENT] .[dbo].[Ma nagement_t able])
  170   •Number of  rows afte r copy:
  171        $tb =  Table nam e
  172   update [MA NAGEMENT]. [dbo].[Man agement_ta ble] set r owcount_af ter_copy=  (select co unt(*) fro m [vinci10 0295].[dbo ].[$(tb)])  where Req ID = (sele ct MAX(Req ID) from [ MANAGEMENT ].[dbo].[M anagement_ table])
  173  
  174   •Checksum  Before cop y:
  175      $tb = T able name
  176   update Man agement_ta ble set ch ecksum_bef ore_copy =  (select   SUM( CAST(  checksum( *) AS BIGI NT )) from  [$(ip)].[ vinci10029 5].[dbo].[ $(tb)]) wh ere ReqID  = (select  MAX(ReqID)  from [MAN AGEMENT].[ dbo].[Mana gement_tab le])
  177  
  178  
  179  
  180   •Checksum  after copy :
  181        $tb =  Table nam e
  182      update  Management _table set  checksum_ after_copy  = (select   SUM( CAS T( checksu m(*) AS BI GINT )) fr om [vinci1 00295].[db o].[$(tb)] ) where Re qID = (sel ect MAX(Re qID) from  [MANAGEMEN T].[dbo].[ Management _table])
  183  
  184   •Status be fore copy  if process  completed :
  185   update [MA NAGEMENT]. [dbo].[Man agement_ta ble] set s tatus_befo re_copy =  'Completed ' where Re qID = (sel ect MAX(Re qID) from  [MANAGEMEN T].[dbo].[ Management _table])
  186  
  187   •Status be fore copy  if process  failed:
  188   update [MA NAGEMENT]. [dbo].[Man agement_ta ble] SET s tatus_befo re_copy =  'Copy Fail ed'
  189   WHERE ReqI D = (selec t MAX(ReqI D) from [M ANAGEMENT] .[dbo].[Ma nagement_t able])
  190  
  191   •Table cop y:
  192       $ip: S erver Name
  193       $tb =  Table name
  194   SELECT * I NTO [vinci 100295].[d bo].[$(tb) ]
  195   FROM [$(ip )].[vinci1 00295].[db o].[$(tb)]
  196  
  197   •Status af ter copy   if process  completed :
  198   update [MA NAGEMENT]. [dbo].[Man agement_ta ble] set s tatus_afte r_copy = ' Completed'  where Req ID = (sele ct MAX(Req ID) from [ MANAGEMENT ].[dbo].[M anagement_ table]);
  199  
  200   •Status af ter copy   if process  failed:
  201      update  [MANAGEMEN T].[dbo].[ Management _table] SE T status_a fter_copy  = 'Copy Fa iled' 
  202   WHERE ReqI D = (selec t MAX(ReqI D) from [M ANAGEMENT] .[dbo].[Ma nagement_t able])
  203  
  204  
  205  
  206  
  207  
  208   •Copy Stat us to chec k copy suc cessful or  copy corr upted
  209   UPDATE [MA NAGEMENT]. [dbo].[Man agement_ta ble] 
  210   SET CopySt atus =
  211   CASE
  212   (select ch ecksum_bef ore_copy -  checksum_ after_copy
  213   from [MANA GEMENT].[d bo].[Manag ement_tabl e]
  214   where ReqI D = (selec t MAX(ReqI D) from [M ANAGEMENT] .[dbo].[Ma nagement_t able]))
  215   when 0 THE N 'Copy Su ccessful'
  216   ELSE 'Copy  Corrupted '
  217   END
  218   WHERE ReqI D = (selec t MAX(ReqI D) from [M ANAGEMENT] .[dbo].[Ma nagement_t able])
  219  
  220   •Drop tabl e if table  copy is c orrupted:
  221        $tb =  Table nam e
  222   IF EXISTS( SELECT Tab le_Name FR OM [MANAGE MENT].[dbo ].[Managem ent_table]  where Cop yStatus =  'Copy Corr upted' and  ReqID = ( select max (ReqID) fr om  [MANAG EMENT].[db o].[Manage ment_table ])) 
  223   drop table  [vinci100 295].[dbo] .[$(tb)]
  224  
  225   •Copy Stat us if copy  successfu l
  226   update [MA NAGEMENT]. [dbo].[Man agement_ta ble] set C opyStatus  = 'Copy Su ccessful'  where ReqI D = (selec t MAX(ReqI D) from [M ANAGEMENT] .[dbo].[Ma nagement_t able])