By DBnixUser
Hi,
I am doing something basic, but I am missing something. Im trying to read the contents of a file and taking those values and connecting to a database. However, it only connect to one (or reads in) value and then exists.
Here is what it looks like:
listname.txt
Code:
db1
db2
db3
Script:
Code:
dbcontent=/usr/home/listname.txt
echo "Enter userid"
read USERID
echo "Enter passwd:"
stty -echo
read -s PASSWD
stty echo
while read dbname;
do
#Connect to SQLPlus
sqlplus -S test/test123@$dbname
select ora_database_name from dual;
prompt my name is $USERID and my password is $PASSWD;
exit;
EOF
done < $dbcontent
It doesn’t read all the lines (loop through) just exits after one run.
I am also trying to have it connect to each database (in the list).