zoukankan      html  css  js  c++  java
  • mysql 数据库备 及移动当天数据到历史表里 window下可用

    1 数据移动到历史表中,同时删除当天数据

    test-move-record.bat

    c:
    
    cd C:FQ_ManageServermysqlback
    
    
    mysql.exe  -h 10.71.1.236 -u"root" -p"" test --execute="replace into test_history select * from test;delete from test ;commit;select count(1),now() as date ,'move' from test_history;" >>C:FQ_ManageServermysqlbackhistory.txt
    
    echo ---------------move end----------------- >>C:FQ_ManageServermysqlbackhistory.txt
    exit
    

      

    结果
    
    count(1)	date	move
    4	2017-06-14 13:30:39	move
    ---------------move end----------------- 
    

     

    2 备份数据且把数据移动到历史表中

    start_backup.bat

    c:
    
    cd C:FQ_ManageServermysqlback
    
    mysqldump -h 10.71.1.236 -uroot -p test>C:FQ_ManageServermysqlbackdbbackupDB_backup_test%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%%time:~9,2%
    start test-move-record.bat
    
    echo ---------------backup end-----------------  >>C:FQ_ManageServermysqlbackhistory.txt
    

      

    3 从历史表中恢复数据 和上面类似

    test-recovery-record.bat

     

    1 c:
    2 
    3 cd C:FQ_ManageServermysqlback
    4 
    5 
    6 mysql.exe  -h 10.71.1.236 -u"root" -p"" test --execute="replace into test select * from test_history ;commit;select count(1),now() as date, 'recovery' from test;" >>C:FQ_ManageServermysqlbackhistory.txt
    7 
    8 echo ---------------recovery end----------------- >>C:FQ_ManageServermysqlbackhistory.txt

    4 缺少从备份数据库中恢复功能

  • 相关阅读:
    321list,元组,range**数字是不可迭代的!
    320作业
    320基础数据类型初始
    319作业
    316作业
    319 Python基础之格式化输出、逻辑运算符、编码、in not in、while else、
    windows查看端口占用指令
    2016年学习计划
    刷算法的时候有没有必要自写测试用例?
    我们为什么不能只用O记号来谈论算法?
  • 原文地址:https://www.cnblogs.com/a9999/p/7008386.html
Copyright © 2011-2022 走看看