How to run sql query in more than one database at same time using Shell script
Instead of connecting to each and every db using sqlplus and run sql query just use below script. It will reduce manual intervention. for i in dbname1 dbname2 dbname3 dbname4 do sqlplus -s /@$i <<EOD>>file.txt select name from v\$database; SELECT DISTINCT grantee,granted_role from dba_role_privs where granted_role ='UPDATOR_ROLE'; EOD done cat file.txt