windows in backup database script

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/qq_34401027/article/details/85235262

rem ------------------------------------------------- --------------------------
automatic backup scripts rem windows environment Oracle database.
rem this batch can be set to automatically perform the windows Task Scheduler.
OFF @echo
@echo ============================================= ===
automatic backup @echo windows environment under the Oracle database script
@echo Description: when you start a backup, you need to configure the following variables
@echo 1, BACKUP_DIR specify the directory to which you want to back up
Oracle user name @echo 2, ORACLE_USERNAME used to specify a backup
! echo 3, Oracle password ORACLE_PASSWORD designated backup used
@echo 4, ORACLE_DB designated backup using Oracle connection name
@echo 5, BACK_OPTION backup option, may be empty, can be full = y, may owner = a user, b users, etc. etc ....
@echo 6, RAR_CMD specify command-line compression RAR tools directory
@echo ============================== ==================
rem The following variables according to the actual situation configuration ------> Note: This script must be placed in E: \ backup directory under
the SET BACKUP_DIR = D: \ oraclebak \ epmfdmee
the SET ORACLE_USERNAME = epmfdmee
the SET ORACLE_PASSWORD = fcseye
the SET ORACLE_DB = orcl
the SET = OWNER = epmfdmee BACK_OPTION
SET RAR_CMD = "C: \ Program Files \ WinRAR \ rar.exe"
REM for / F "tokens = 1,2" %% A in ( 'DATE / T') = do %% A SET TODAY
set TODAY =% DATE: ~ 0,4 %% DATE: ~ 5,2 %% DATE: ~ 8,2 %% TIME: ~ 0,2 %% TIME: ~ 3,2 %% TIME: ~ 6,2 %
SET = THISDATETIME% DATE: ~ 0,4 %% DATE: DATE %% ~ 5,2: 8,2 %% the TIME ~: ~ %% the TIME 0,2: 3,2- %% the TIME ~: ~. 6, % 2
echo% THISDATETIME%
SET = 2018_12_08 TODAY
SET BACK_NAME ORACLE_DB% =% _% _ THISDATETIME%%% ORACLE_USERNAME
SET BACK_FULL_NAME BACKUP_DIR% =% \%% BACK_NAME

rem start the backup
exp% ORACLE_USERNAME% /% ORACLE_PASSWORD%@10.200.1.13: 1521 / ORACLE_DB%%%% BACK_OPTION File = "% BACK_FULL_NAME% .dmp" log = "% BACK_FULL_NAME% exp.log"
rem and delete the original file compression
 A -df RAR_CMD%% "% BACK_FULL_NAME% back.rar" "% BACK_FULL_NAME% .dmp" "% BACK_FULL_NAME% exp.log"
------------------ delete rem history file -------
FORFILES / m * -d .rar -7 / C "cmd / del C / F @path"

Guess you like

Origin blog.csdn.net/qq_34401027/article/details/85235262