1. Backup file name : dbname_dayofyear_bk_init.ora: e.x. dev10g_234_bk_init.ora
2. Backup folder: /home/oracle/scripts
3. /bin/date +%j : day (in number) of year
/bin/date +%w: day of week (0..6); 0 represents Sunday
#********Begin*****************
#/bin/ksh
#/home/oracle/scripts/backup_initfile.ksh
if [ $# -ne 1 ]
then
echo Usage Error. Please provide DBNames
echo Usage: Ex. ./backup_initfile.ksh dbname
exit
fi
export ORACLE_SID=$1
BACKUP_FOLDER=\'/home/oracle/scripts
BACKUP_FILENAME_tmp=${ORACLE_SID}_`/bin/date +%a /usr/bin/tr A-Z a-z`.trc
BACKUP_FILENAME=${ORACLE_SID}_`/bin/date +%j /usr/bin/tr A-Z a-z`_bk_init.ora\'
#!/bin/ksh
echo ""
echo ""
echo "GETTING INIT FILE"
echo ""
(sqlplus /nolog<
create pfile=$BACKUP_FOLDER/$BACKUP_FILENAME from spfile;
EOF
)
#********The End*****************
35 09 * * * /home/oracle/scripts/backup_initfile.ksh db_name