Create a directory at O/S Level
$ mkdir dump_dir (for dump directory)
$ mkdir log_dir (for log directory)
$ chmod 775 dump_dir log_dir
Connect sqlplus and execute:
Sql> Create directory datapump_dir as ‘/u01/dump_dir’;
Sql> Create directory datapump_log as ‘/u01/log_dir’;
Sql> grant read,write on directory datapump_dir to public; # to take expdp for any schema
Sql> grant read,write on directory datapump_log to public;
$ more expdp.sh
#!/bin/ksh
export ORACLE_HOME="/u01/app/oracle/product/10.2.0"
export ORACLE_SID="abc"
echo export started at `date` >> /u05/abc/export/dailyexpdp_abc.log
$ORACLE_HOME/bin/expdp system/password dumpfile=datapump_dir:abc-expdp-`date '+%Y%m%d'`.dmp logfile=datapump_log:abc-expdp-`date '+%Y%m%d'`.log schemas=aet3
echo export stopped at `date` >> /u05/abc/export/dailyexpdp_abc.log
echo tape archiving started at `date` >> /u05/abc/export/dailyexpdp_abc.log
tar Ecvf /dev/rmt/0 /u05/abc/export
echo tape archiving stopped at `date` >> /u05/abc/export/dailyexpdp_abc.log
$ crontab -l
50 23 * * 0,1,2,3,4,5,6 /u06/abc/scripts/expdp.sh
It will generate dumpfile datewise.
No comments:
Post a Comment