Write Windows batch script to load the data for AUL (MyDUL)

Links: http://www.dbatools.net/experience/aul_win_batch_load.html

    When recovery with AUL (MyDUL) in text mode (default mode), it will generate three files for each table (Recovery Example), then we need to execute the SQL file to create the table, and then load the data by Oracle SQL loader with the control files generated. When on Linux/Unix, we can easily write some shell script to do it in one batch, but on Windows, most people do not know how to write a batch command for this task.

    For better service quality and user experience, I write one DOS batch script (loadall.bat) for this task.

@echo off
if "A%1"=="A" goto exit_1

for /F %%i in ('dir /b /w *.sql') do sqlplus %1 @%%i
for /F %%i in ('dir /b /w *.ctl') do sqlldr %1 control=%%i
goto exit_0

:exit_1
@echo Usage:
@echo      loadall username/password@tns

:exit_0

    When you finish the recovery, and want to load the data to schema "test" on target database (tnsname "temp").

loadall test/test@temp

    After the batch finish, check the SQL loader log file for any error. If no error then the recovery is completed.

Post a comment

« Previous | Main | Next »

Powered by
Movable Type 3.36