# We set the SID of the oracle database
export ORACLE_SID=BICEC
# We define the log filename
logfile=mv_datafiles_test_iris.log
# shutdown the database before moving the files
echo "Shutting down the database ==> `date`" >> $logile
sqlplus "/ as sysdba" <<fin
shutdown immediate
fin
echo "Base arretee... `date`" >> $logfile
# Now we can move the files on OS level
echo "Moving datafiles..." >> $logfile
mv old_1 new_1
mv old_2 new_2
...
...
mv old_n new_n
# echo "We mount the database and rename the files on database level `date`" >> $logfile
sqlplus "/ as sysdba" <<eof
STARTUP MOUNT
ALTER DATABASE RENAME FILE 'old_1' TO 'new_1';
ALTER DATABASE RENAME FILE 'old_2' TO 'new_2';
...
...
ALTER DATABASE RENAME FILE 'old_n' TO 'new_n';
ALTER DATABASE OPEN;
eof
echo "fertig... `date`" >> $logfile
No comments:
Post a Comment