ORACLE database automatic backup timer scheduled task windows

Why no doubt enter oracle database installation directory will be able to directly back up, it might be because the default installation oracle c drive, the docs direct command can operate it, do not believe you can use sqlplus try.

A total of three steps:

 

A. Establish a .bat batch file

 

 

II. Add the following batch command

OFF @echo
echo ============================================== ==
automatic backup scripts echo Windows environment, Oracle database by author Huang Zedong
echo 1. name backup files using the current date.
echo 2. automatically delete backups seven days ago.
================================================ echo
: : remove the current time "YYYYMMDD" format.
=% DATE BackupDate the SET: ~ 0,4 %% DATE: ~ 5,2 %% DATE: ~ 8,2%
:: set a user name, password, and to back up the database.
the USER = HZD the SET
the SET PASSWORD = HZD
the SET DATABASE = ORCL
:: Create a backup directory.
not exist IF "E: \ 1.oracle_backup \ the Data" mkdir E: \ 1.oracle_backup \ the Data
IF not exist "E: \ 1.oracle_backup \ log" mkdir E: \ 1.oracle_backup \ log
the SET DATADIR = E: \ 1.oracle_backup \ the Data
the SET LOGDIR = E: \ 1.oracle_backup \ log
exp %USER%/%PASSWORD%@%DATABASE% file=%DATADIR%\data_%BACKUPDATE%.dmp log=%LOGDIR%\log_%BACKUPDATE%.log
::删除7天前的备份。
forfiles /p "%DATADIR%" /s /m *.* /d -7 /c "cmd /c del @path"
forfiles /p "%LOGDIR%" /s /m *.* /d -7 /c "cmd /c del @path"


GOTO END
create a Task Scheduler (this is a comment without also OK)
% Procedure:

  Start -> All Programs -> Accessories -> System Tools -> Task Scheduler -> Actions -> Create Basic Task

  -> Enter the task name "oracle_backup" (custom task name), select a day to perform this task, the next step

  -> start time of 12:00 pm, the start date 2012-7-11, the next step -> (Launcher) Next

  -> Find just written backup.bat file> Next> in your browser to complete
: END
PAUSE

III. Add Scheduled Task

  Start -> All Programs -> Accessories -> System Tools -> Task Scheduler -> Actions -> Create Basic Task

  -> Enter the task name "oracle_backup" (custom task name), select a day to perform this task, the next step

  -> start time of 12:00 pm, the start date 2012-7-11, the next step -> (Launcher) Next

  -> Find backup.bat file just written while browsing> Next> Finish

 

 

Guess you like

Origin www.cnblogs.com/huangzedong/p/11877318.html
Recommended