oracle备份数据库数据及导入数据库

1.oracle数据库备份和导入 bat 脚本

scott oracle数据库用户名称  123456 数据库scott用户下的密码
192.168.124.8 本电脑IP
orcl 为oracle库
file=D:\BACKUP\database-back-up_%date:~0,4%%date:~5,2%%date:~8,2%.dmp   文件存放的位置以及名称
log=D:\BACKUP\database-back-up_%date:~0,4%%date:~5,2%%date:~8,2%.log   日志文件存放的位置以及名称

备份导出的脚本命令如下:

@echo off
exp scott/123456@192.168.124.8:1521/orcl file=D:\BACKUP\database-back-up_%date:~0,4%%date:~5,2%%date:~8,2%.dmp log=D:\BACKUP\database-back-up_%date:~0,4%%date:~5,2%%date:~8,2%.log
winrar a -agYYYY-MM-DD -DF -m5 D:\BACKUP\database-back-up.rar D:\BACKUP\*.dmp D:\BACKUP\*.log
forfiles /p "D:\BACKUP" /s /m *.rar /d -30 /c "cmd /c del @path" 
@exit

2.备份数据导入脚本(cmd DOS窗口执行)

imp scott/123456@localhost:1521/orcl full=y file=D:\BACKUP\database-back-up_20211203.dmp

posted @ 2021-12-03 16:33  [奋斗]  阅读(417)  评论(0编辑  收藏  举报