echo `date +%c` >> $LOG_FILE
echo "Database BACKUP starting." >> $LOG_FILE
ORACLE_HOME=/u01/app/oracle/product/10.2; export ORACLE_HOME
ORACLE_SID=SEED; export ORACLE_SID
PATH="$PATH:$ORACLE_HOME/bin"
sqlplus '/as sysdba' << EOF
shutdown immediate
exit EOF
if [ $? -eq 0 ]
then
echo "Database shut down." >> $LOG_FILE
echo "Previous Backup is being removed." >> $LOG_FILE
touch /u03/backups/abu/junk/ rm /u03/backups/abu/*
echo "Cold backup being performed." >> $LOG_FILE
cp -p -f -v /u01/oracle/admin/SEED/* /u03/backups/abu/nightly_backup/
cp -p -f -v /u02/oradata/SEED/* /u03/backups/abu/nightly_backup/
cp -p -f -v /u03/oradata/SEED/* /u03/backups/abu/nightly_backup/
echo "Cold backup of archive logs being performed." >> $LOG_FILE
mv -f -v /u01/app/oracle/product/10.2/dbs/arch/* /u03/backups/abu/nightly_backup/
echo "Restarting Database" >> $LOG_FILE
ORACLE_SID=SEED; export ORACLE_SID
$ORACLE_HOME/bin/sqlplus '/as sysdba' << EOF
startup
exit
EOF
if [ $? -eq 0 ]
then
echo "Database started up." >> $LOG_FILE
else
echo "Database will NOT start up." >> $LOG_FILE
fi
echo `date +%c` >> $LOG_FILE
echo "Database BACKUP has completed." >> $LOG_FILE
Quote:
Originally Posted by
manna
I ran the following script and it saying that sqlplus command not found. Please give me suggestions.
echo `date +%c` >> $LOG_FILE
echo "Database BACKUP starting." >> $LOG_FILE
OORACLE_HOME=/u01/app/oracle/product/10.2; export ORACLE_HOME
ORACLE_SID=SEED; export ORACLE_SID
PATH="$PATH:$ORACLE_HOME/bin"
sqlplus '/as sysdba' << EOF
startup
exit EOF
if [ $? -eq 0 ]
then
echo "Database shut down." >> $LOG_FILE
echo "Previous Backup is being removed." >> $LOG_FILE
touch /u03/backups/abu/junk/ rm /u03/backups/abu/*
echo "Cold backup being performed." >> $LOG_FILE
cp -p -f -v /u01/oracle/admin/SEED/* /u03/backups/abu/nightly_backup/
cp -p -f -v /u02/oradata/SEED/* /u03/backups/abu/nightly_backup/
cp -p -f -v /u03/oradata/SEED/* /u03/backups/abu/nightly_backup/
echo "Cold backup of archive logs being performed." >> $LOG_FILE
mv -f -v /u01/app/oracle/product/10.2/dbs/arch/* /u03/backups/abu/nightly_backup/
echo "Restarting Database" >> $LOG_FILE
ORACLE_SID=SEED; export ORACLE_SID
$ORACLE_HOME/bin/sqlplus '/as sysdba' << EOF
startup
exit
EOF
if [ $? -eq 0 ]
then
echo "Database started up." >> $LOG_FILE
else
echo "Database will NOT start up." >> $LOG_FILE
fi
echo `date +%c` >> $LOG_FILE
echo "Database BACKUP has completed." >> $LOG_FILE