Script to run EXPDP [message #676024] |
Tue, 07 May 2019 10:42 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](//www.gravatar.com/avatar/78f7197b94751b3984eed5347df30f9a?s=64&d=mm&r=g) |
SimonD
Messages: 2 Registered: May 2019
|
Junior Member |
|
|
Hi
First off I'm not a DBA.
But learning on the job so to speak.
I would like to run a script which exports (using expdp.exe command) our schema 'companyname'.
I need it to have 2 -3 days of retention 'companyname.dmp' in a specific folder.
Currently we have a script which does this:
EXPDP test/test dumpfile=companyname.dmp DIRECTORY=c:\test ORABACK SCHEMAS=companyname Logfile=companyname
However I want to automate this process plus provided redundancy backups.
Yes I know there is RMAN however this is just an internal test server.
Any help mush appreciated
|
|
|
|
|
Re: Script to run EXPDP [message #676027 is a reply to message #676024] |
Tue, 07 May 2019 11:03 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
John Watson
Messages: 8964 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
You could schedule a Windows shell script (CMD or Powershell) to generate the file names and remove files after a few days. This is a Linux example, I don't have a Windows example to hand but it is straightforward to convert:
#!/bin/bash
. $HOME/.bash_profile
export NLS_DATE_FORMAT=yyyy-mm-dd:hh24:mi:ss
export ORAENV_ASK=NO
export PATH=/u01/app/oracle/product/18.3.0/dbhome_1/bin:$PATH
export SID=cdbprod
find /u02/cdbprod/dump -mtime +6 |xargs rm -vf
for SERVICE in DEV1 DEV2 UAT
do
expdp system/oracle@$SERVICE directory=dailydump dumpfile=$SERVICE-`date +%Y-%m-%d`.dmp full=y flashback_time=systimestamp logfile=$SERVICE.log
done
|
|
|
|
|
Re: Script to run EXPDP [message #676036 is a reply to message #676029] |
Wed, 08 May 2019 03:04 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
To be clear that's not a legal name because datapump needs the name of an oracle directory object, which is a pointer to a real directory on the file server, rather than the name of an actual directory on the file server.
That'll work with exp but not expdp.
[Updated on: Wed, 08 May 2019 03:14] Report message to a moderator
|
|
|
Re: Script to run EXPDP [message #676042 is a reply to message #676024] |
Wed, 08 May 2019 06:25 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](//www.gravatar.com/avatar/d29f577f753cb4b873212fd5ed0da4cd?s=64&d=mm&r=g) |
EdStevens
Messages: 1376 Registered: September 2013
|
Senior Member |
|
|
SimonD wrote on Tue, 07 May 2019 10:42Hi
<snip>
Currently we have a script which does this:
EXPDP test/test dumpfile=companyname.dmp DIRECTORY=c:\test ORABACK SCHEMAS=companyname Logfile=companyname
<snip>
No, you don't have a script that does that. As has already been pointed out, the usage of the DIRECTORY parameter will no work with expdp. And what is that ORABACK between the DIRECTORY and the SCHEMAS parameter?
Actually, aside from getting your expdp command to work (have you read the documentation?) your question has nothing to do with Oracle. It is simply about writing a windows command file and using the Windows scheduler to execute the command file.
|
|
|