Shellscripts, SQPlus

Run Script for a List of Databases

Holy big list of databases, DBAtman!“”
How to run same script for a list of databases quickly?

In my case I have same password/user in all databases, but in case you haven’t you can make an internal loop with a similar awk command to retrieve users and passwords from a file.

The list:

$: cat /tmp/dbs.cfg

The script:

for DBSID in ${*-$(awk -F: '!/^#/ {print $1}' /tmp/dbs.cfg}
    print "
        connect user/password@${DBSID}
        exit " |
    sqlplus /nolog >> /tmp/output_test.log

Na, na, na, na, na, na, na, na, na, na, na, na… DBAtman!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s