Overwrite .dmp file

Trying to set up expdp job to back up schema daily overwriting each time.
I get Oracle error messages:

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-31641: unable to create dump file "/export/home/oracle/backups/datapump/paebprd_expfull.dmp"
ORA-27038: created file already exists
Additional information: 1

Is there any way to simply overwrite the file if it exists?
xoxomosAsked:
Who is Participating?
 
sathyagiriConnect With a Mentor Commented:
If you're using expdp then I guess the only way is to make sure the file doesn't exist. In case of exp this issue wouldn't be there
0
 
actonwangCommented:
unfoturnately , you can not overwrite  it automatically:

see:


////////////////////////////////
Restrictions

If there are preexisting files that match the resulting filenames, an error is generated. The existing dump files will not be overwritten.


from:
http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10825/dp_export.htm#sthref55
0
 
actonwangCommented:
you need to remove or move the file if it exisits before you do data pump export.

acton
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
sathyagiriCommented:
Are you using a shell script or batch file to do this expdp?
0
 
actonwangCommented:
you could use sth like this to do it before you do expdp:


f [ -f filename ];then
rm -fr filename
else
expdp
fi
0
 
sathyagiriCommented:
If so, just add logic to either remove or rename the file

In case of shell script

if [ -f filename ]; then
mv filename1 filename2
fi
0
 
xoxomosAuthor Commented:
export ORACLE_SID=paebprd
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1


$ORACLE_HOME/bin/expdp system/xoxomos directory=datadir1 dumpfile=paebprd_expfull_$dt.dmp logfile=paebprd_e
xpfull full=y
~
0
All Courses

From novice to tech pro — start learning today.