1.备份脚本
@ECHO OFF
set username=root
set password="12345678"
set instanse=orcl
set backupdate=%date:~0,4%%date:~5,2%%date:~8,2%
set datadir=D:ackupdata
set logdir=D:ackuplog
echo 开始执行备份
exp '%username%/%password%@%instanse%' owner=%username% BUFFER=64000 file='%datadir%q_%backupdate%.dmp' log='%logdir%q_%backupdate%.log'
WINRAR a -df -m5 "%datadir%q_%backupdate%.rar" "%datadir%q_%backupdate%.*"
echo 备份成功!
echo 删除过期备份文件
forfiles.exe /p "D:ackupdata" /m *.rar /d -7 /c "cmd /c del @path"
forfiles.exe /p "D:ackuplog" /m *.log /d -7 /c "cmd /c del @path"
echo 删除成功
2.导入(全库导入)
imp root/12345678@orcl file=D:ackupdataack.dmp full=y ignore=y log=D:ackuplogimp.log
imp root/12345678@ip地址:端口号/orcl file='XXX.dmp' full=y