Daily Backup Schema using an Export utility
Till now, I used to take my backups using EXP utility on a scheduled basis.
But the main issue was when the backup script executes it to overwrite existing backups and this way I have only the last backup available. If I need the backups before the last backup, then I have to manually copy my DMP file to some other place before the backup script overwrites the last backup.
To solve this issue I did a 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 into 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
3AMNEOWed-10-08-2008.DMP
and
log file like
3AMNEOWed-10-08-2008.LOG
i.e. data and day is appended with the .DMP and .LOG file every day.
This solves the overwrite issue.
Let’s understand how this works.
C:\Documents and Settings\dbametrix>echo %date%
Wed 10/08/2008
C:\Documents and Settings\dbametrix>set gog=%date%
C:\Documents and Settings\dbametrix>echo %gog%
Wed 10/08/2008
C:\Documents and Settings\dbametrix>set gog2= %gog: =-%
C:\Documents and Settings\dbametrix>echo %gog2%
Wed-10/08/2008
C:\Documents and Settings\dbametrix>set gog=%gog2:/=-%
C:\Documents and Settings\dbametrix>echo %gog%
Wed-10-08-2008
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
Reason:
When the date appends with dump file space after a day like Wed 10/08/2008 is treated as a new parameter, and it doesn’t work, so I need to do this work.
When you want to make a strong Oracle DBA career then you should be aware of database services and other database technology. Without having knowledge of Oracle internals, Oracle performance tuning, and skill of Oracle database troubleshooting you can’t be an Oracle DBA expert. This expert DBA Team club blog always provides you latest technology news and database news to keep yourself up to date. You should need to be aware of Cloud database technology like DBaaS. All Oracle DBA tips are available in a single unique resource at our orageek. Meanwhile, we are also providing some sql tutorials for Oracle DBA. This is the part of Dbametrix Group and you would enjoy more advanced topics from our partner resource.