Home » Infrastructure » Windows » Export Database using DOS Batch File
Export Database using DOS Batch File [message #327566] Mon, 16 June 2008 23:13 Go to next message
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 #327568 is a reply to message #327566] Mon, 16 June 2008 23:22 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I hope you will post the script when you'll finally have it.

Regards
Michel
Re: Export Database using DOS Batch File [message #327583 is a reply to message #327566] Tue, 17 June 2008 00:06 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Script in this topic will partially solve your problems. For the rest, do some extra research and code it yourself. If you don't know how to do that, I'd suggest you to visit DOS batch scripting forum to gather additional information as THIS ("copy file over there, delete a file, ...") part of the job isn't related to Oracle.
Re: Export Database using DOS Batch File [message #328019 is a reply to message #327566] Wed, 18 June 2008 11:05 Go to previous messageGo to next message
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 #328040 is a reply to message #328019] Wed, 18 June 2008 12:30 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Penfold wrote on Wed, 18 June 2008 18:05
Trying to use the date is going to cause you a problem as the date is formated as 18/06/2008 so ...

Is it? Maybe on your system, but not on mine.
C:\>date
The current date is: sri 18.06.2008
Enter the new date: (dd-mm-yy)

C:\>
Or even
C:\>date
The current date is: sri 18-06-2008
Enter the new date: (dd-mm-yy)

C:\>
So it depends on regional settings which can be adjusted accordingly to your needs.
Re: Export Database using DOS Batch File [message #328168 is a reply to message #327566] Thu, 19 June 2008 03:43 Go to previous message
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,
Previous Topic: How can i execute Svrmgrl in a single line command in batch file
Next Topic: Oracle Communication Billing and Revenue Management Installation Problem
Goto Forum:
  


Current Time: Fri Mar 29 05:43:16 CDT 2024