Windows Server下Oracle數據庫自動備份批處理腳本

@echo off數據庫


REM ###########################################################oracle

REM # Windows Server下Oracle數據庫自動備份批處理腳本ide

REM ###########################################################操作系統


REM 取當前系統時間,可能因操做系統不一樣而取值不同it

set CURDATE=%date:~0,4%%date:~5,2%%date:~8,2%class

set CURTIME=%time:~0,2%date


REM 小時數若是小於10,則在前面補0file

if "%CURTIME%"==" 0" set CURTIME=00密碼

if "%CURTIME%"==" 1" set CURTIME=01im

if "%CURTIME%"==" 2" set CURTIME=02

if "%CURTIME%"==" 3" set CURTIME=03

if "%CURTIME%"==" 4" set CURTIME=04

if "%CURTIME%"==" 5" set CURTIME=05

if "%CURTIME%"==" 6" set CURTIME=06

if "%CURTIME%"==" 7" set CURTIME=07

if "%CURTIME%"==" 8" set CURTIME=08

if "%CURTIME%"==" 9" set CURTIME=09


set CURTIME=%CURTIME%%time:~3,2%%time:~6,2%


REM 設置全部者、用戶名和密碼

set OWNER=username


set USER=username


set PASSWORD=password

set PREFIX=%OWNER%


REM 建立備份用目錄,目錄結構爲backup/YYYYMMDD/



set CURDIR=E:\oraclebackup\

set FILENAME=%CURDIR%\%PREFIX%_%CURDATE%_%CURTIME%.DMP

set EXPLOG=%CURDIR%\%PREFIX%_%CURDATE%_%CURTIME%_log.log


REM 調用ORACLE的exp命令導出用戶數據

exp %USER%/%PASSWORD%@rasvdb file=%FILENAME% log=%EXPLOG% owner=%OWNER% grants=n



exit 

相關文章
相關標籤/搜索