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

test-move-record.bat

c:

cd C:\FQ_ManageServer\mysqlback

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_ManageServer\mysqlback\history.txt

echo ---------------move end----------------- >>C:\FQ_ManageServer\mysqlback\history.txt
exit

  

结果

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

 

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

start_backup.bat

c:

cd C:\FQ_ManageServer\mysqlback

mysqldump -h 10.71.1.236 -uroot -p test>C:\FQ_ManageServer\mysqlback\dbbackup\DB_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_ManageServer\mysqlback\history.txt

  

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

test-recovery-record.bat

 

 c:

 cd C:\FQ_ManageServer\mysqlback

 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_ManageServer\mysqlback\history.txt

 echo ---------------recovery end----------------- >>C:\FQ_ManageServer\mysqlback\history.txt

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

mysql 数据库备 及移动当天数据到历史表里 window下可用的更多相关文章

  1. 利用PHP实现登录与注册功能以及使用PHP读取mysql数据库——以表格形式显示数据

    登录界面 <body><form action="login1.php" method="post"><div>用户名:&l ...

  2. MySQL数据库导入或者同步大量数据时数据丢失解决方案

    相信大家都经常遇到这样的情况,我们在编码的过程中经常需要在调试代码的时候切换到本地的数据库上做修改调试,如果当测试数据库的数据在几十万或者上百万数据的时候,我们无论是通过恢复备份/导入SQL的方式来把 ...

  3. Delphi7连接MySql数据库-DBGrid控件显示数据

    一个简单的Delphi7小程序,使用MySql数据库做简单查询,用DBGrid控件显示结果,实现过程如下: (1)在MySql中新建demouser表,插入记录用于测试. (2)在Delphi7中新建 ...

  4. 使用JDBC在MySQL数据库中快速批量插入数据

    使用JDBC连接MySQL数据库进行数据插入的时候,特别是大批量数据连续插入(10W+),如何提高效率呢? 在JDBC编程接口中Statement 有两个方法特别值得注意: void addBatch ...

  5. MySQL数据库----IDE工具介绍及数据备份

    一.IDE工具介绍 生产环境还是推荐使用mysql命令行,但为了方便我们测试,可以使用IDE工具 下载链接:https://pan.baidu.com/s/1bpo5mqj 二.MySQL数据备份 # ...

  6. mysql 数据库查询最后两条数据

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/u011925175/article/details/24186917  有一个mysql数据库的 ...

  7. MySQL数据库(7)_MySQL 数据备份与还原

    一.数据备份 1.使用mysqldump命令备份 mysqldump命令将数据库中的数据备份成一个文本文件.表的结构和表中的数据将存储在生成的文本文件中. mysqldump命令的工作原理很简单.它先 ...

  8. 如何在MySQl数据库中给已有的数据表添加自增ID?

    由于使用MySQL数据库还没有多久的缘故,在搭建后台往数据库导入数据的时候发现新增的表单是没有自增id的,因次就有了上面这个问题. 解决方法 1.给某一张表先增加一个字段,这里我们就以node_tab ...

  9. Java程序向MySql数据库中插入的中文数据变成了问号

    找到mysql的安装目录,修改my.ini文件 (1)如何找到my.ini文件 如果my.ini文件不在MySQL的安装目录下,可能放在隐藏目录,要先去找到ProgramData,(这里要先打开显示隐 ...

随机推荐

  1. .net 非阻塞事件获取返回异步回调结果

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  2. ubuntu设置自动休眠

    ubuntu16.04默认是永不休眠的,有时候忘了关机,那就惨了,一会用到没电为止. 设置方法: 进入“系统设置”->"安全与隐私"->"电源设置" ...

  3. android.util.DisplayMetrics-获取当前屏幕尺寸信息

    方法有两种一: DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMet ...

  4. C++11时间操作

    C++11提供了chrono库,这个库可以处理和时间相关的一些事情.这个库里面主要有3个类:时间间隔Duration.时钟Clocks和时间点Time point. Duration template ...

  5. 小马哥课堂-统计学-z分数

    Standard score(z-分数) The standard score is the signed number of standard deviations by which the val ...

  6. Fly (From Wikipedia)

    True flies are insects of the order Diptera, the name being derived from the Greek δι- di- "two ...

  7. jQuery 实战读书笔记之第六章:事件本质

    理解浏览器事件模型 understandEventModel.html 代码: <!DOCTYPE HTML> <html> <head> <title> ...

  8. 使用ASM获得JAVA类方法参数名

    在Java1.8之后,可以通过反射API java.lang.reflect.Executable.getParameters来获取到方法参数的元信息,(在使用编译器时加上-parameters参数, ...

  9. python笔记-基础入门

    Python 特点 1.易于学习:Python有相对较少的关键字,结构简单,和一个明确定义的语法,学习起来更加简单. 2.易于阅读:Python代码定义的更清晰. 3.易于维护:Python的成功在于 ...

  10. 对Linux命令进一步学习

    root@wuheng-virtual-machine:/home/wuheng# ls -ltotal 44drwxr-xr-x 2 wuheng wuheng 4096 Mar  3 01:30 ...