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

Comments

Popular posts from this blog

ORA-28086: The data redaction policy expression has an error

Useful OEM Queries to get Target details from OEM Repository

ORA-65139: Mismatch between XML metadata file and data file