troubleshooting Question

Adding a date to a file name in a bat file so that every day will be a different name

Avatar of LindaC
LindaCFlag for Puerto Rico asked on
Windows BatchWindows Server 2003
5 Comments1 Solution300 ViewsLast Modified:
I want to execute an oracle export but the name of the dump file I want to add the day-month-and year so that each day the dump file be created with a different name.
Don't worry about disk space because I have another script which removes dump files older than 4 days:
This is the script that Iám using:

set ORACLE_SID=OEM10G
set a=exp_oem10g_%DATE:.=%
set b=oem10g_%DATE:.=%
E:\oracle\product\10.2.0\db_1\BIN\expdp.exe backup_user/backup_user dumpfile=dpump_dir1:%b%.dmp filesize=0 content=all logfile=dpump_log1:%a%.log full=y
date /t >> E:\oracle\Dba\logs\%a%.log
c:
cd \progra~1\tivoli\tsm\baclient
dsmc incremental E:\oracle\Dba\exports\%b%.dmp >> E:\oracle\Dba\logs\%a%.log
date /t >> E:\oracle\Dba\logs\%a%.log
exit

The logfile it is written as exp_oem10g_Tue (type File) and the dump file is not written because it is like this:

What I want is that the dumpfile it is written as oem10g_2-27-07.dmp  and the logfile as exp_oem10g_2-27-0.log --------------> The date of today

Incremental backup of volume 'E:\oracle\Dba\exports\oem10g_Tue'

Incremental backup of volume '02/27/2007.dmp' ----------->

Incremental backup of volume '02/27/2007.log'----------> This is supposed to be the log file
Tue 02/27/2007

ASKER CERTIFIED SOLUTION
Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 5 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 5 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004