• mysqldump对于DB进行逻辑备份的时候,是否会备份视图呢?


    需求描述:

      今天在mysql备份的书的内容,提到了mysqldump在备份数据库的时候,不会备份视图

      所以,就做了个实验测试下,发现,是能够备份视图的,在此记录下.

    环境描述:

      Mysql版本:5.5.57-log

    操作过程:

    1.对某个DB进行备份,库中包含视图v_test01

    [mysql@redhat6 mysql_backup]$ mysqldump -uroot -p --single-transaction --master-data --databases top_server > TopServerDB.sql
    Enter password: 

    2.查看备份出来的SQL文件是否包含view相关信息

    [mysql@redhat6 mysql_backup]$ grep "v_test01" TopServerDB.sql 
    -- Temporary table structure for view `v_test01`
    DROP TABLE IF EXISTS `v_test01`;
    /*!50001 DROP VIEW IF EXISTS `v_test01`*/;
    /*!50001 CREATE TABLE `v_test01` (
    -- Final view structure for view `v_test01`
    /*!50001 DROP TABLE IF EXISTS `v_test01`*/;
    /*!50001 DROP VIEW IF EXISTS `v_test01`*/;
    /*!50001 VIEW `v_test01` AS select `goods_share_order`.`id` AS `id`,`goods_share_order`.`share_num` AS `share_num`,`goods_share_order`.`contack_user` AS `contack_user`,`goods_share_order`.`contact_tel` AS `contact_tel`,`goods_share_order`.`share_date` AS `share_date`,`goods_share_order`.`share_deptid` AS `share_deptid`,`goods_share_order`.`goods_desc` AS `goods_desc`,`goods_share_order`.`goods_memo` AS `goods_memo`,`goods_share_order`.`creat_time` AS `creat_time`,`goods_share_order`.`update_time` AS `update_time`,`goods_share_order`.`operate_user` AS `operate_user`,`goods_share_order`.`refuse_num` AS `refuse_num`,`goods_share_order`.`total_num` AS `total_num`,`goods_share_order`.`dept_id` AS `dept_id`,`goods_share_order`.`share_status` AS `share_status`,`goods_share_order`.`user_id` AS `user_id`,`goods_share_order`.`remark` AS `remark` from `goods_share_order` */;

    备注:说明备份出来的包括视图的信息,与书上说的内容不符合,可能是版本的区别.

    3.将DB进行还原,在navicat中查看是否有视图

    备注:视图已经被还原回来了.说明这个mysql版本是能够备份视图的.

    文档创建时间:2018年4月17日17:14:25

  • 相关阅读:
    Spring事务传播机制
    关于MyBatis-Like的模糊查询,">"、"<"等需转义字符描述
    MyBatis中if
    报错(持续.....)
    爬虫报错(持续.....)
    django的timezone问题
    dispatch
    django + uwsgi + nginx 实现高并发环境部署 及 报错处理
    虚拟机问题(持续更新.......)
    Tornado
  • 原文地址:https://www.cnblogs.com/chuanzhang053/p/8868068.html
Copyright © 2020-2023  润新知