zoukankan      html  css  js  c++  java
  • 数据库备份计划带删除

    数据库备份计划带删除


    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

  • 相关阅读:
    改变Prompt默认路径,Change Default Visual Studio Command Prompt Location
    msbuild,Build failed with Error MSB3073 exited with code 1
    the filename directory name or volume label syntax is incorrect
    常用sql语句记录
    EF中多表公共字段,以及设置EntityBase使所有实体类继承自定义类
    一种在MVC3框架里面设置模板页的方法,不使用_ViewStart
    Java内存模型
    Effective Java(1)-创建和销毁对象
    WireShark 查看UDP码流的丢包率
    拖延心理学读后感
  • 原文地址:https://www.cnblogs.com/Jeely/p/10997686.html
Copyright © 2011-2022 走看看