Saturday, 20 July 2013
Tuesday, 16 July 2013
Run Some SQL On All Databases On Server
for ORACLE_SID in $( ps -ef|grep [p]mon|awk -F'_' '{ print $3 }' )
do
export ORACLE_SID
ORAENV_ASK=NO
. oraenv
echo "$ORACLE_SID"
sqlplus -s / as sysdba <<EOF
<your SQL here>
EOF
done
e.g. Recompile invalid objects in all databases
for ORACLE_SID in $( ps -ef|grep [p]mon|awk -F'_' '{ print $3 }' )
do
export ORACLE_SID
ORAENV_ASK=NO
. oraenv
echo "$ORACLE_SID"
sqlplus -s / as sysdba <<EOF
@?/rdbms/admin/utlrp parallel 4;
EOF
done
Subscribe to:
Posts (Atom)