Daily Backup Schema using Export utility

Till now i used to take my backups using EXP utility on the scheduled basis.

But the main issue was when backup script execute it overwrite existing backups and this way i have only last backup available. If i need the backups before last backup then i have to manually copy my DMP file to some other place before backup script overwrite last backup.

To solve this issue i did little trick i have windows 2003 server on my server.

I made a .bat file in which i write my EXP command and put it in to the scheduler of oracle 10g.

set gog=%date%
set gog2=%gog: =-%
set gog=%gog2%
set gog2=%gog:/=-%
set gog=%gog2%
Exp test/test FILE=C:\3AMNEO"%gog%".DMP LOG=C:\3AMNEO"%gog%".LOG

This script will generate .DMP file like



log file like


i.e. data and day is appended with the .DMP and .LOG file every day.

this solve overwrite issue.

Let's understand how this works.

C:\Documents and Settings\umesh>echo %date%
Wed 10/08/2008

C:\Documents and Settings\umesh>set gog=%date%

C:\Documents and Settings\umesh>echo %gog%
Wed 10/08/2008

C:\Documents and Settings\umesh>set gog2= %gog: =-%

C:\Documents and Settings\umesh>echo %gog2%

C:\Documents and Settings\umesh>set gog=%gog2:/=-%

C:\Documents and Settings\umesh>echo %gog%

Now the question is why i use this trick can we work like ?

Exp test/test FILE=C:\3AMNEO"%date%".DMP LOG=C:\3AMNEO"%date%".LOG

The answer is NO


When date append with dmp file the space after day like Wed 10/08/2008 is treated as new parameter and it doesn't work
so i need to do this work.

Umesh Sharma

No comments:

Post a Comment