Rename dmp file and log files with database name and date - then put dmp and log files in another directory
I created the sa.dat file and sa_export.sh to export just one table every day in the bbb directory. I have to do a daily export of the ccc table at 1 a.m. This is done through a cron job.
When the daily export is done, an export dump file and an export log file are created.
When the export shell script is executed through the CRON, a log file for the export shell script and a log for the cron job are created.
So the following four files are created when the cron job runs:
1. export dump file
2. export log file
3. export shell script log file
4. cron job log file
The export of the ccc tables will be done in several different databases.
1. All the above four files should be renamed with the date.
For example: dmp.date, export.log.date, exportshell.log.date, cron.log.date
2. ALL THE ABOVE FOUR FILES SHOULD ALSO BE RENAMED WITH THE DATABASE NAME ON WHICH
THE EXPORT IS DONE.
FOR EXAMPLE: dmp_DATABASENAME.dmp.DATE - should this be include the dat file?
TE - should this be included in the dat file?
3. The above four files should be created in another directory yyy and not in the directory where the dat and shell scripts are there.
I given the sa.dat file, sa_export.sh file, and the cron job below:
#Set ORACLE environment
export ORACLE_HOME ORACLE_SID PATH
$ORACLE_HOME/bin/exp username/password parfile=/bbb/as.dat
) > "$exportlogfile" 2>&1
#EXPORT ccc table every day
#00 1 * * * /bbb/sa_export.sh > /daily_cron.log
Please let me know how to code the above REQUIREMENTS.
I would like give this question 1000 points because it is difficult.