oracle 数据库备份 cmd 命令 - lihfei89

时间:2024-02-22 19:29:48

oracle 数据库备份 cmd 命令

语句:exp SDE/SDE@IP:1521/orcl FILE=C:\数据库备份\sde%date:~0,4%%date:~5,2%%date:~8,2%.dmp  COMPRESS=y direct=y log=C:\数据库备份\log\sde%date:~0,4%%date:~5,2%%date:~8,2%.log

在这里主要要保证C盘下有数据库备份和数据库备份下有log文件加 才能保证导出成功

 

如果想定期备份数据库 就需要将上述命令放在在bat文件中,并且通过windows任务计划的方式定期备份数据库

bat文件内容:IP为你数据库安装的IP地址

@echo off
exp DJXT/DJXT@IP:1521/orcl FILE=C:\数据库备份\djxt%date:~0,4%%date:~5,2%%date:~8,2%.dmp COMPRESS=y direct=y log=C:\数据库备份\log\djxt%date:~0,4%%date:~5,2%%date:~8,2%.log
exp SDE/SDE@IP:1521/orcl FILE=C:\数据库备份\sde%date:~0,4%%date:~5,2%%date:~8,2%.dmp COMPRESS=y direct=y log=C:\数据库备份\log\sde%date:~0,4%%date:~5,2%%date:~8,2%.log
forfiles /p "C:\数据库备份" /s /m *.* /d -30 /c "cmd /c del @path"
forfiles /p "C:\数据库备份\log" /s /m *.* /d -30 /c "cmd /c del @path"
exit