Oracle expdp command executed in a command file not honoring %U instead using _U without a sequence

dba.stackexchange https://dba.stackexchange.com/questions/247226

  •  07-02-2021
  •  | 
  •  

Question

I have generated a bunch of expdp commands and stored them in a .cmd file. When I execute one of the commands by copy and paste into a command prompt, it works fine. If I try to execute the whole .cmd file, it also works great.

I need to use PARALLEL and %U, so I have added that to the commands. Again, I run it manually in the command prompt and it works great and honors the %U by creating multiple .dmp files with a sequence number. But when executing the whole .cmd file with the PARALLEL and %U, it does not honor the %U and just creates one .dmp file with _U. How can I fix this so it will create the multiple dmp files?

Here is an example of one of my commands that executes fine when copied and pasted into a command prompt but does not work right when executed as a file.

expdp TEST/PWD@ORCL schemas=TEST directory=EXPORT_DIR parallel=4 REUSE_DUMPFILES=Y dumpfile=TEST_20190906_%U.dmp logfile=TEST_20190906_expdp.log

Was it helpful?

Solution

You can escape the % sign to stop Windows swallowing it before Oracle gets a chance to see it:

... dumpfile=TEST_20190906_%%U.dmp ...

As a quick test, in a .cmd file:

@echo expdp ... dumpfile=TEST_20190906_%U.dmp logfile=TEST_20190906_expdp.log
@echo expdp ... dumpfile=TEST_20190906_%%U.dmp logfile=TEST_20190906_expdp.log

then running that from a command prompt shows:

expdp ... dumpfile=TEST_20190906_U.dmp logfile=TEST_20190906_expdp.log
expdp ... dumpfile=TEST_20190906_%U.dmp logfile=TEST_20190906_expdp.log
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top