Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:14:27

0001 #!/bin/sh
0002 
0003 workdir=`dirname $0`
0004 cd $workdir
0005 
0006 if [ "c${CMSSW_RELEASE_BASE}" == "c" ]; then
0007     echo -e "\nSetting scramv1 runtime"
0008     cd /afs/cern.ch/cms/sw/slc4_ia32_gcc345/cms/cmssw/CMSSW_1_6_0
0009     eval `scramv1 runtime -sh`
0010     cd -
0011 fi
0012 export TNS_ADMIN=/afs/cern.ch/project/oracle/admin
0013 #path=/afs/cern.ch/cms/DB/conddb/*.xml
0014 path=./conddb/*.xml
0015 
0016 sqlite3 dbfile.db < CreateSqliteTable.sql
0017 
0018 #grep -i "connection name"  $path | grep -i '\(strip\)\|\(pixel\)' | awk  -F"\"" '{print $2}' | grep -v frontier | grep -v AUDIT_TEST | sort | uniq 
0019 
0020 
0021 #get connection string
0022 for connection in `grep -i "connection name"  $path | grep -i '\(strip\)\|\(pixel\)' | awk  -F"\"" '{print $2}' | grep -vi frontier | grep -vi AUDIT_TEST | sort | uniq `
0023   do
0024   #echo -e "\n$connection"
0025 
0026   user=(`grep -A3 "$connection\"" $path | grep -v "connection name" | awk '$0~/name=\"user\"/{print $0}' | awk -F ' <parameter name="user" value=' '{print $2}' | awk -F'\"' '{print $2}' `)
0027 
0028  pass=(`grep -A3 "$connection\"" $path  | grep -v "connection name" | awk '$0~/name=\"password\"/{print $0}' | awk -F ' <parameter name="password" value=' '{print $2}' | awk -F'\"' '{print $2}' `)
0029 
0030  type=`echo $connection | awk -F":" '{print $1}'`
0031  db=`echo $connection | awk -F"/" '{print $3}' `
0032  account=`echo $connection | awk -F"/" '{print $4}' `
0033 
0034  i=0
0035  while [ $i -lt ${#user[@]} ];
0036    do
0037    auser=${user[$i]}
0038    apass=${pass[$i]}
0039  #echo $auser  $apass $type $db $account
0040    echo -e "\n $auser @ $db"
0041    #echo "echo \"select name from $account.metadata;\" |  sqlplus -S $auser/$apass@$db "
0042  
0043    result=`echo "select name from $account.metadata;" | sqlplus -S $auser/$apass@$db | grep "\([a-Z]\)\|\([0-9]\)" | grep -v "rows selected" | grep -v '^NAME$'`
0044    #echo $result
0045    if [ `echo $result | grep -c "ERROR.*ORA-"` -eq 0 ]; then
0046        for tag in `echo $result | tr " " "\n"`
0047          do
0048        #echo $tag
0049          echo "INSERT INTO DBtags values('$db' , '$account' , '$tag');" | sqlite3 dbfile.db
0050        done
0051        i=10000000
0052    else
0053        echo $result | tr "\t" "\n" 
0054        let i=$i+1
0055    fi
0056  done
0057 
0058 done
0059 
0060 ./QuerySqlite.sh strip
0061 ./QuerySqlite.sh pixel