Oracle自动备份脚本

 

@echo off
REM ###########################################################
REM # 应用监控系统数据库自动备份批处理脚本
REM ###########################################################
REM 取当前系统时间,可能因操作系统不同而取值不一样
set CURDATE=%date:~0,4%%date:~5,2%%date:~8,2%
set CURMON=%date:~0,4%%date:~5,2%
set CURTIME=%time:~0,2%

REM 小时数如果小于10,则在前面补0
if "%CURTIME%"==" 0" set CURTIME=00
if "%CURTIME%"==" 1" set CURTIME=01
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=YYJK
set USER=YYJK
set PASSWORD=YYJK

REM 创建备份用目录,目录结构为oraclebak/YYYYMMDD/
if not exist "oraclebak" mkdir oraclebak
cd oraclebak
if not exist "%CURMON%" mkdir %CURMON%
set FILENAME=%CURMON%/%OWNER%_%CURDATE%_%CURTIME%.DMP
set EXPLOG=%CURMON%/%OWNER%_%CURDATE%_%CURTIME%_log.log

REM 调用ORACLE的exp命令导出用户数据
REM exp %USER%/%PASSWORD%@%OWNER% file=%FILENAME% log=%EXPLOG% owner=%USER% grants=n
exp %USER%/%PASSWORD%@%OWNER% file=%FILENAME% log=%EXPLOG% tables=(TBCCONTEMP,TBCLISTTEMP,TBCMENU,TBCMENUHELP,TBCTEMP,TBSBROWSERNAME,TBSHTTPREQUEST,TBSLOGINLOG,TBSMENU,TBSROLE,TBSROLEMENU,TBSROLEUSER,TBSUSER,YYJK_APP_CONFIG,YYJK_APP_CONN_CONF,YYJK_APP_DB_CONF,YYJK_APP_SERV_CONF,YYJK_SYS_CONFIG,YYJK_SYS_CODE,YYJK_SYS_JJRQDZB,YYJK_SYS_SERIAL,YYJK_ALERT_CONFIG) 

exit

 

你可能感兴趣的:(oracle)