#!/bin/bash
FILE="${1}"
while read line; do
REMOTESERVER=`echo ${line} | cut -d"," -f1`
REMOTEUSER=`echo ${line} | cut -d"," -f2`
REMOTEPASS=`echo ${line} | cut -d"," -f3`
DBUSER=`echo ${line} | cut -d"," -f4`
DBPASS=`echo ${line} | cut -d"," -f5`
DBNAME=`echo ${line} | cut -d"," -f6`
output=`sshpass -p \'$REMOTEPASS\' ssh -o StrictHostKeyChecking=no -T $REMOTEUSER@$REMOTESERVER
sleep 5
sqlplus -s "$DBUSER/$DBPASS@$DBNAME " <<EOF
set heading off feedback off verify off
select Instance_name,host_name,version,startup_time,status from v\\$instance;
exit
EOF
echo $output >> dboutput.txt