数据库备份计划带删除
echo 开始备份数据库
if not exist d:db_bakfiles md d:db_bakfiles
if not exist d:db_baklogs md d:db_baklogs
set var=%date:~0,4%%date:~5,2%%date:~8,2%
exp mtss/mtss@192.168.0.183/orcl file=d:db_bakfiles\%var%.dmp log=d:db_baklogsms_%var%.log owner=(mtss)
echo 删除过久的备份记录
forfiles /p "d:db_bak" /s /m *.dmp /d -60 /c "cmd /c del @path"
forfiles /p "d:db_bak" /s /m *.log /d -60 /c "cmd /c del @path"
exit
echo 开始备份数据库
if not exist d:db_bakfiles md d:db_bakfiles
if not exist d:db_baklogs md d:db_baklogs
set var=%date:~0,4%%date:~5,2%%date:~8,2%
exp mtss/mtss@192.168.0.182/orcl file=d:db_bakfiles182bak%var%.dmp log=d:db_baklogsms_182bak%var%.log
echo 删除过久的备份记录
forfiles /p "d:db_bak" /s /m *.dmp /d -30 /c "cmd /c del @path"
forfiles /p "d:db_bak" /s /m *.log /d -30 /c "cmd /c del @path"
exit
drop user mtss cascade;
create user mtss identified by mtss
temporary tablespace mtss_temp;
grant connect,resource,dba to mtss;
exit;
sqlplus system/sa@orcl as sysdba @huifu.sql
set var=%date:~0,4%%date:~5,2%%date:~8,2%
imp mtss/mtss@192.168.0.183/orcl file=d:db_bakfiles182bak%var%.dmp log=d:db_baklogsms_182imp%var%.log full=y statistics=none
echo 开始备份数据库
if not exist d:db_bakfiles md d:db_bakfiles
if not exist d:db_baklogs md d:db_baklogs
set var=%date:~0,4%%date:~5,2%%date:~8,2%
exp mtss/mtss@192.168.0.183/orcl file=d:db_bakfiles\%var%.dmp log=d:db_baklogsms_%var%.log owner=(mtss)
echo 删除过久的备份记录
forfiles /p "d:db_bak" /s /m *.dmp /d -60 /c "cmd /c del @path"
forfiles /p "d:db_bak" /s /m *.log /d -60 /c "cmd /c del @path"
exit
echo 开始备份数据库
if not exist d:db_bakfiles md d:db_bakfiles
if not exist d:db_baklogs md d:db_baklogs
set var=%date:~0,4%%date:~5,2%%date:~8,2%
exp mtss/mtss@192.168.0.182/orcl file=d:db_bakfiles182bak%var%.dmp log=d:db_baklogsms_182bak%var%.log
echo 删除过久的备份记录
forfiles /p "d:db_bak" /s /m *.dmp /d -30 /c "cmd /c del @path"
forfiles /p "d:db_bak" /s /m *.log /d -30 /c "cmd /c del @path"
exit
drop user mtss cascade;
create user mtss identified by mtss
temporary tablespace mtss_temp;
grant connect,resource,dba to mtss;
exit;
sqlplus system/sa@orcl as sysdba @huifu.sql
set var=%date:~0,4%%date:~5,2%%date:~8,2%
imp mtss/mtss@192.168.0.183/orcl file=d:db_bakfiles182bak%var%.dmp log=d:db_baklogsms_182imp%var%.log full=y statistics=none