#!/usr/local/bin/perl # ## reppattern - Script to display ALL patterns in a RepServer Domain, including reptable true yes/no, autocorrection and warnings if theres a # mismatch between repdefs/subscriptions and setreptable. # # -IMPORTANT - Before start to use this program, please make sure to check and fix # # Vishi - Dec 23 2009, Large Table Name support and FIXED bug in "WARNING .. reptable true but no matching repdef WARNING reptable true" ## Vishi - Nov 10 2007, trvishi@yahoo.com # Please do drop in a mail for any feedback or to report any bugs which you might see # # # # -For Usage, please go to the bottom of the screen, or just type reppattern.pl # -I have used isql to keep things simpler instead of db libraries. Make sure its in the path when you run it # require "/usr/perl5/5.8.4/lib/getopts.pl"; # # You should find this in the web if you dont have it. # Buffering select(STDERR); $| = 1; # make unbuffered select(STDOUT); $| = 1; # make unbuffered ## # Global Vairables ## $QUERYSTR="isql -w20000 -b "; ## # Get command line args ## do Getopts ('P:p:U:u:R:T:D:d:S:X:M'); if(defined( $opt_P )) { $reppass = $opt_P; } if(defined( $opt_p )) { $asepass = $opt_p; } if(defined( $opt_U )) { $repuser = $opt_U; } if(defined( $opt_u )) { $aseuser = $opt_u; } if(defined( $opt_R )) { $repserver = $opt_R; } if(defined( $opt_T )) { $table = $opt_T; } if(defined( $opt_D )) { $db = $opt_D; } if(defined( $opt_S )) { $ds = $opt_S; } if(defined( $opt_X )) { $rs = $opt_X; } if(defined( $opt_M )) { $reptable = 1; }else { $reptable =0; } if( !defined( $repserver )) { &usage; } if( !defined( $repuser )) { $repuser = "sa"; } if( !defined( $aseuser )) { $aseuser = "sa"; } ## # get the repserver password if we need it ## while( !defined( $reppass ) || ! $reppass ) { system 'stty', '-echo'; print "Password for $repserver / $repuser : "; chop( $reppass = ); print "\n"; } ## # get ase user password if not provided in command line ## while( !defined( $asepass ) || ! $asepass ) { system 'stty', '-echo'; print "Password for $aseserver / $aseuser : "; chop( $asepass = ); print "\n"; } if( defined( $table ) || defined($ds) || defined ($db) || defined($rs) ) { print "\n FILTERS Used -> Object: $table , DataServer: $ds, Database: $db, RepServer: $rs\n"; } if ( !defined $table ) { $table='NOTDEFINED' } ########################################################### # Main ############################################################ ## # Step 1. Get RSSD of the given repserver # Step 2. Find the IDServer # Step 3. Get RSSD of IDServer # Step 4. Get List of RepServers from IDServer # Step 5. Foreach Repserver in IDServer, get unique primdb / repdb # Step 6. Consolidate output ## ## # Step 1. Get RSSD of the given repserver ## #print "Step 1. Get RSSD of the given repserver $repserver \n"; system 'stty', 'echo'; $sql_command = $QUERYSTR . " -U " . $repuser . " -S" . $repserver . " < $reppattern.pl -R REPSERVER To display Table level information --> $reppattern.pl -R REPSERVER -T 'table_patt' To display All tables --> $reppattern.pl -R REPSERVER -T '' EOF exit 1; }