Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 







Run Oracle export script from Windows DOS

Oracle Database Tips by Donald BurlesonApril 28, 2015

Question:  How do I run a export from DOS?  I;m on a Windows bos and I want a script to invoke a data pump export on Windows.

Answer:  Running a Data Pump Export from Windows is easy.  Data Pump Export was first available in Oracle 10g and is used to replace the old export/import utilities.  See chapter xx for more information about Data Pump. Below is a very nice utility script that Jeff Hunter, Oracle Guru, wrote called oracle_export.bat.  This is a script for exporting data from Windows.
A key learning point here is that he builds the exp parfile arguments into a DOS variable called %PARFILE% by echoing the settings to a file using the >> append command:
c:> exp=%PARFILE%:
REM +--------------------------------------------------------------------------+
REM | VALIDATE COMMAND-LINE PARAMETERS                                         |
REM +--------------------------------------------------------------------------+

if (%1)==() goto USAGE
if (%2)==() goto USAGE
if (%3)==() goto USAGE

REM +--------------------------------------------------------------------------+
REM | VALIDATE ENVIRONMENT VARIABLES                                           |
REM +--------------------------------------------------------------------------+

REM set ORABACKUP=C:\oracle\orabackup\JEFFDB\export
REM set ORALOG=C:\oracle\custom\oracle\log
REM set ORATMP=C:\oracle\custom\oracle\temp

if (%ORALOG%)==() goto ENV_VARIABLES
if (%ORATMP%)==() goto ENV_VARIABLES

REM +--------------------------------------------------------------------------+
REM | DECLARE ALL GLOBAL VARIABLES.                                            |
REM +--------------------------------------------------------------------------+

set FILENAME=export_backup_online_full_9i
set TNS_ALIAS=%3%

REM +--------------------------------------------------------------------------+
REM | REMOVE OLD LOG AND PARAMETER FILE(S).                                    |
REM +--------------------------------------------------------------------------+

del /q %PARFILE%
del /q %LOGFILE%

REM +--------------------------------------------------------------------------+
REM | WRITE EXPORT PARAMETER FILE.                                             |
REM +--------------------------------------------------------------------------+

echo buffer=50000000 >> %PARFILE%
echo file=%DUMPFILE% >> %PARFILE%
echo compress=n >> %PARFILE%
echo grants=y >> %PARFILE%
echo indexes=y >> %PARFILE%
echo direct=no >> %PARFILE%
echo log=%LOGFILE% >> %PARFILE%
echo rows=y >> %PARFILE%
echo consistent=y >> %PARFILE%
echo full=y >> %PARFILE%
REM echo owner=(SCOTT) >> %PARFILE%
REM echo tables=(EMP, DEPT) >> %PARFILE%
echo triggers=y >> %PARFILE%
echo statistics=none >> %PARFILE%
echo constraints=y >> %PARFILE%

REM +--------------------------------------------------------------------------+
REM | MOVE OLD EXPORT (DUMP) FILE.                                             |
REM +--------------------------------------------------------------------------+

del /q %DUMPFILE%.backup
move %DUMPFILE% %DUMPFILE%.backup

REM +--------------------------------------------------------------------------+
REM | PERFORM EXPORT.                                                          |
REM +--------------------------------------------------------------------------+

exp parfile=%PARFILE%

REM +--------------------------------------------------------------------------+
REM | SCAN THE EXPORT LOGFILE FOR ERRORS.                                      |
REM +--------------------------------------------------------------------------+

echo ...
echo Analyzing log file for EXP- errors...
findstr /I /C:"EXP-" %LOGFILE%
if errorlevel 0 if not errorlevel 1 echo EXP- Errors:  %FILENAME% %TNS_ALIAS% %COMPUTERNAME% %DATE% %TIME% %LOGFILE%

echo ...
echo Analyzing log file for ORA- errors...
findstr /I /C:"ORA-" %LOGFILE%
if errorlevel 0 if not errorlevel 1 echo ORA- Errors:  %FILENAME% %TNS_ALIAS% %COMPUTERNAME% %DATE% %TIME% %LOGFILE%

echo ...
echo Analyzing log file for warnings...
findstr /I /C:"Export terminated successfully with warnings" %LOGFILE%
if errorlevel 0 if not errorlevel 1 echo WARNING: %FILENAME% %TNS_ALIAS% %COMPUTERNAME% %DATE% %TIME% %LOGFILE%

echo ...
echo Analyzing log file for errors...
findstr /I /C:"Export terminated unsuccessfully" %LOGFILE%
if errorlevel 0 if not errorlevel 1 echo ERROR: %FILENAME% %TNS_ALIAS% %COMPUTERNAME% %DATE% %TIME% %LOGFILE%

echo ...
echo Filename      : %FILENAME%
echo Database      : %TNS_ALIAS%
echo Hostname      : %COMPUTERNAME%
echo Date          : %DATE%
echo Time          : %TIME%
echo EXP Log File  : %LOGFILE%

Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.



Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.



Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster