Link to home
Start Free TrialLog in
Avatar of xoxomos
xoxomos

asked on

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?
ASKER CERTIFIED SOLUTION
Avatar of sathyagiri
sathyagiri
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Acton Wang
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
you need to remove or move the file if it exisits before you do data pump export.

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


f [ -f filename ];then
rm -fr filename
else
expdp
fi
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
Avatar of xoxomos
xoxomos

ASKER

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
~