« Print current Oracle character set | Home | Find the files not in use in Unix »

Process all databases in Sybase

#!/usr/bin/ksh
echo "Started..."

print -u2 -n "Enter password:"
stty -echo
read PASS
stty echo
print

rm -f databases.lst
isql -U sa -S $DSQUERY -w 999<<EOF | awk '/DBLABEL/ { print $2 }' > databases.lst
$PASS
select 'DBLABEL' "XXX", name from master..sysdatabases
go
exit
EOF

for DB in $(cat databases.lst) ; do

print -u2 "Processing $DB ..."
isql -U sa -S $DSQUERY -w 999 -D $DB <<EOF
$PASS

-- some commands here
go

exit
EOF
done

print -u2 "Done."

Topics: Sybase, Unix Shell | Submitter: checkthis

Comments

You must be logged in to post a comment.

Keep on coding