Skip to content
A "Cluster SQL*Plus" to query multiple databases in large environments
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Cluster SQL*Plus to query multiple Oracle databases in large environments


This BASH script functions as a wrapper for Oracle SQL*Plus to query multiple databases at once. It allows you to manage large environments with SQL*Plus commands and can be used to generate reports, automate queries over many databases or just to fiddle around.


The script can be used by either specifying the query to be run on the command line or use an SQL script as input.

The following example shows how to query multiple databases by specifying the query on the command line:

./  -q "SELECT username,account_status FROM dba_users WHERE account_status like '%LOCKED%';" -i sample/inventory.txt -p "tiger" -v

Here is another example that uses an SQL script as input:

./  -f sample/query.sql -i sample/inventory.txt -u "simon" -p "tiger" -v


Be careful when querying dynamic performance views such as "v$instance", as BASH will try to replace the "$instance" part. Instead, either escape the dollar sign or use single quotes:

./ -q "SELECT * FROM v\$instance;" -i sample/inventory.txt -p "tiger" -v


./ -q 'SELECT * FROM v$instance;' -i sample/inventory.txt -p "tiger" -v
You can’t perform that action at this time.