Hello
I need create a script to loop through the etc/oratab file to get the instance names, then login and execute the package header and package body and apply grants. I want to skip any instances that have "lab" in the instance name. I'm very new to Unix.
Am I on the right track?
How would I be able to exclude the instances I don't want the script to run against?
#!/bin/sh
set -x
sids=`/bin/cut -d':' -f1 /etc/oratab`
for SID in $sids
do
ORACLE_SID=$sid
. /usr/local/bin/oraenv
if [grep -v lab $sid]; then
${ORACLE_HOME}/bin/sqlplus -s "/ as sysdba" << EOF
spool $1.log
echo $sids
#@C:\Assignments\Scripts\EMS.Pkg_SynkFixes.sql;
#show errors;
#@C:\Assignments\Scripts\EMS.pkg_SynkFixesbody.sql;
#show errors;
#create public synonym pkg_SynkFixes for EMS.pkg_SynkFixes;
#grant execute on EMS.pkg_SynkFixes to emsuserrole;
spool off
fi
exit;
EOF
done