“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 db01 db02 db03 testdb
The script:
for DBSID in ${*-$(awk -F: '!/^#/ {print $1}' /tmp/dbs.cfg} do print " connect user/password@${DBSID} @script_to_run.sql exit " | sqlplus /nolog >> /tmp/output_test.log done
Na, na, na, na, na, na, na, na, na, na, na, na… DBAtman!