oracle备份脚本(以日期命名文件夹)
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:\backup\data
set logdir=D:\backup\log
echo 开始执行备份
exp '%username%/%password%@%instanse%' owner=%username% BUFFER=64000 file='%datadir%\bq_%backupdate%.dmp' log='%logdir%\bq_%backupdate%.log'
WINRAR a -df -m5 "%datadir%\bq_%backupdate%.rar" "%datadir%\bq_%backupdate%.*"
echo 备份成功!
echo 删除过期备份文件
forfiles.exe /p "D:\backup\data" /m *.rar /d -7 /c "cmd /c del @path"
forfiles.exe /p "D:\backup\log" /m *.log /d -7 /c "cmd /c del @path"
echo 删除成功
2.导入(全库导入)
imp root/12345678@orcl file=D:\backup\data\back.dmp full=y ignore=y log=D:\backup\log\imp.log
imp root/12345678@ip地址:端口号/orcl file='XXX.dmp' full=y