Posts

Showing posts with the label Wrapper script to run sql statements

Wrapper script to run sql statements

Wrapper script to run any sql statement in all databases hosted on that server runsql.sh #!/bin/bash echo " <___________enter your title here___________> " export ORAENV_ASK='NO' for ORACLE_SID in  <___________enter all SIDs, space seporated___________> do export ORACLE_SID . oraenv > /dev/null echo " =============== $ORACLE_SID : ===============" sqlplus -s / as sysdba @<___________enter your .sql file___________>  #it runs as sysdba, change login details as per your requirement. echo " =============================== Completed for the database $ORACLE_SID. " read -p "Press Enter to continue or Ctrl+c to exit ..." done unset ORAENV_ASK