I have a generic script used for duplicating databases ('refreshing' test from prod) on demand. It has been working just fine for at least a couple of years now. Recently I built some vm's with VitrualBox and using the same script on those machines. When the duplicate finishes with no reported problems, but "SELECT * from dba_temp_files"returns ORA-01187. There are all kinds of reports of this behavior on the web, and everyone proposes the same post-duplicate fix of recreating the temp file. But I'd like to understand what causes the issue in the first place and what I should do with my script to prevent it. It's particularly curious when the same script works just fine on other systems.
echo ======================================================================|tee -a $runlog
echo Starting $ORACLE_SID instance NOMOUNT at `date`|tee -a $runlog
echo
$ORACLE_HOME/bin/sqlplus /nolog << EOF5 |tee -a $runlog
connect / as sysdba
#--create spfile from pfile='/backup/$devsid/initdwstg.ora';
startup force nomount;
exit
EOF5
#cd /backup/$ORACLE_SID
rman_ctl=$ORACLE_BASE/admin/${ORACLE_SID}/refresh_${ORACLE_SID}.rmctl
echo "connect catalog ${rmanusr}/${rmanpw}@${rmandb}" > $rman_ctl
echo "connect target sys/${prddbpw}@${prddb}" >> $rman_ctl
echo "connect auxiliary /" >> $rman_ctl
#echo "show all;" >> $rman_ctl
echo "run {" >> $rman_ctl
echo "set until scn ${ckptscn};" >> $rman_ctl
echo "duplicate target database to ${ORACLE_SID};" >> $rman_ctl
echo "}" >> $rman_ctl
echo ======================================================================|tee -a $runlog
echo Beginning rman DUPLICATE operation at `date` |tee -a $runlog
echo
$ORACLE_HOME/bin/rman < $rman_ctl |tee -a $runlog