Execute Query on Multiple Databases

This operation assumes that the same table exists on each database you connect to. Also the connections pos1 and pos2 should be already defined.

connect pos1,pos2
SELECT * FROM sakila.city;

Group connections into groups.

connection group production pos1,pos2
connect production
SELECT * FROM sakila.city;
Spool result to a file.
connect production exclude my3
spool /tmp/result.csv
SELECT * FROM sakila.city;
spool off