Export Database using DOS Batch File [message #327566] |
Mon, 16 June 2008 23:13 |
Manoj.Gupta.91
Messages: 239 Registered: March 2008 Location: Delhi
|
Senior Member |
|
|
Hi All,
I'm new to DOS Batch Files as well as Export utility.
I want to export my full database on daily basis at a fixed time.
1. The generated export file (.dmp) should be like Abc_16-06-2008.dmp
2. The script must delete .dmp files older than three days.
3. The .dmp file must be created in specified drive let us say E:\
4. The newly generated .dmp file must be copied to some another computer in the network.
Any help is appreciated
Thanks & Regards
Manoj
|
|
|
|
|
Re: Export Database using DOS Batch File [message #328019 is a reply to message #327566] |
Wed, 18 June 2008 11:05 |
Penfold
Messages: 112 Registered: June 2005
|
Senior Member |
|
|
Hi,
Trying to use the date is going to cause you a problem as the date is formated as 18/06/2008 so if you try an use %date% in the batch file an error is thrown up as it can't create the dmp file.
If the dmp is done same time each day you could just use the following: -
@ECHO OFF
CLS
E:\
:: Delete oldest Backup & Rename previous ones.
DEL *.OL3
RENAME *.OL2 *.OL3
RENAME *.OL1 *.OL2
RENAME *.DMP *.OL1
:: Export DB using the EXP Utiltiy.
C:\Oracle\Ora10\bin\exp system/password file=E:\ABC.dmp owner=owner statistics=none
EXIT
You could even take this futher and write some results to a log/trace file.
echo: >>backuplog.txt
echo ***************** Backup Started ***************** >>backuplog.txt
echo: >>backuplog.txt
echo Backup started at %time% on %date% >>backuplog.txt
echo Export started at %time% >>backuplog.txt
echo Export completed at %time% >>backuplog.txt
Hope that helps?
Regards
|
|
|
|
Re: Export Database using DOS Batch File [message #328168 is a reply to message #327566] |
Thu, 19 June 2008 03:43 |
Penfold
Messages: 112 Registered: June 2005
|
Senior Member |
|
|
Hi,
You're right, I just checked the Regional Settings and my short date is formatted to dd/mm/yyyy,so depending on how this is formatted would then allow for %date% to be used in the batch file to form part of the file name.
Regards,
|
|
|