Home » Infrastructure » Windows » DateTime as DMP File Name (9i, 9.0.1.1, XP)
DateTime as DMP File Name [message #661236] Sat, 11 March 2017 13:30 Go to next message
billgates
Messages: 17
Registered: March 2017
Junior Member
Hi

I am using a batch file to export my entire database for backup. The command line in batch file is as follows

EXP SYSTEM/mypassword FULL=Y FILE=backup.dmp

Here the file backup process creates names backup.dmp
I want the current date and time to be the name of the file instead of backup.dmp
e.g DDMONRRRR_HHMI 10MAR2017_1230

Is it possible? If yes what will be the code of batch file
Re: DateTime as DMP File Name [message #661238 is a reply to message #661236] Sat, 11 March 2017 14:09 Go to previous messageGo to next message
Michel Cadot
Messages: 65255
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

C:\>echo %date%
11/03/2017

C:\>echo %time%
21:08:09,32
Now add these variables as you want in your file name.
There are several ways to get substrings in DOS, if you don't know them, search on the web or ask on a Windows forum.
There are also several examples in this site.

Re: DateTime as DMP File Name [message #661240 is a reply to message #661238] Sat, 11 March 2017 14:23 Go to previous messageGo to next message
billgates
Messages: 17
Registered: March 2017
Junior Member
thanks for the reply. the batch file has just the following code as I mentioned earlier
EXP SYSTEM/mypassword FULL=Y FILE=backup.dmp
this way it creates the backup file with the name BACKUP.DMP , What do i change or add in this batch file that it performs all the same as earlier but names the produced file as date & time with format mask something like this DDMONRRRR_HHMI 10MAR2017_1230.

I know there are a lot of complicated codes out there but Im not much of a cmd guy. So it would be a huge favor if you provide me with the exact code.
Re: DateTime as DMP File Name [message #661241 is a reply to message #661240] Sat, 11 March 2017 14:34 Go to previous messageGo to next message
Michel Cadot
Messages: 65255
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
What do i change or add in this batch file
Use the variables I gave you in the name file.

Quote:
Im not much of a cmd guy
And this not a cmd forum but an Oracle one.
Did you search in this part of the forum, there are examples, pick the one that best fits your need or ask on a Microsoft forum.
For example a simple search on "date time in file name" will return you this topic:
How to put current date and time in dump file using expdp utility in windows

Re: DateTime as DMP File Name [message #661242 is a reply to message #661240] Sat, 11 March 2017 14:34 Go to previous messageGo to next message
BlackSwan
Messages: 25751
Registered: January 2009
Location: SoCal
Senior Member
C:\Users\SB920>echo %date%_%time%
Sat 03/11/2017_12:33:59.79

It is NOT rocket science
Re: DateTime as DMP File Name [message #661246 is a reply to message #661242] Sun, 12 March 2017 01:09 Go to previous message
Michel Cadot
Messages: 65255
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

This is why I told him to investigate and is shown in details in the topic I pointed him to.

Previous Topic: Automatically start Oracle instance after booting
Next Topic: problem in interface of customized application
Goto Forum:
  


Current Time: Sat Dec 16 03:30:03 CST 2017

Total time taken to generate the page: 0.02062 seconds