Gather Dictionary Stats...
NOTE: Gathering Dictionary Stats should be peformed 24 hours before the upgrade.sqlplus / as sysdba
EXECUTE dbms_stats.gather_dictionary_stats;
exit
You should address all issues reported by preupgrade.jar before continuing.
Set the ${NEWVER} variable equal to the directory name appearing after /u01/app/oracle/product/ in the new ORACLE_HOME.
NOTE: If you have just installed the new ORACLE_HOME, then this variable is likely already set.export NEWVER=122010
Or...
export NEWVER=122010ORCL
Set the ${CURVER} variable equal to the directory name appearing after /u01/app/oracle/product/ in the old ORACLE_HOME...
export CURVER=$(echo $ORACLE_HOME | cut -f6 -d/)
Copy the password file..
cp $ORACLE_HOME/dbs/orapw* /u01/app/oracle/product/${NEWVER}/dbs
Copy the network config files and update them to reflect new ORACLE_HOME...
export ONA=$ORACLE_HOME/network/admin
export NNA=/u01/app/oracle/product/${NEWVER}/network/admin
cat ${ONA}/listener.ora | sed -e"s/${CURVER}/${NEWVER}/g" >${NNA}/listener.ora
cat ${ONA}/sqlnet.ora | sed -e"s/${CURVER}/${NEWVER}/g" >${NNA}/sqlnet.ora
Check tnsnames.ora manually
Copy externaljob.ora...
Run this as 'oracle'...
echo cp $ORACLE_HOME/rdbms/admin/externaljob.ora /u01/app/oracle/product/${NEWVER}/rdbms/admin/externaljob.ora
...then cut & paste the output to run as 'root'.
Purge the Recyclebin and create a Guaranteed Restore Point...
PURGE DBA_RECYCLEBIN;
CREATE RESTORE POINT beforeUpgrade GUARANTEE FLASHBACK DATABASE;
Ensure environment variables are changed to point to the NEW (12.2) oracle home
export OLD_HOME=$(cat /etc/oratab | grep ${ORACLE_SID} | cut -f2 -d: )
echo ${OLD_HOME}
echo ${ORACLE_HOME}
if [ ${OLD_HOME} = ${ORACLE_HOME} ]
then
echo ERROR
else
echo Ready
fi
dbua -silent -sid ${ORACLE_SID} -oracleHome ${OLD_HOME} \
-recompile_invalid_objects true \
-upgradeTimezone true -emConfiguration NONE -upgrade_parallelism 1