`
icbm
  • 浏览: 58881 次
社区版块
存档分类
最新评论

MySQL 5.6中备份及还原performance_schema配置

阅读更多
一、setup.txt文件,用于备份performance_schema的配置。该脚本生成还原performance_schema中的setup表的SQL语句。

-- 备份setup_instruments
select concat('update performance_schema.setup_instruments set enabled=''',enabled,''' where name=''',name,''';')
from performance_schema.setup_instruments where enabled='NO';

-- 备份setup_consumers
select concat('update performance_schema.setup_consumers set enabled=''',enabled,''' where name=''',name,''';')
from performance_schema.setup_consumers where enabled='NO';

-- commit
select 'commit;';



二、执行setup.txt文件,备份performance_schema的配置。
mysql -h localhost -P 3306 -u root -pmysql -D test -s < d:\atmp\backup_perf_setup.sql > d:\ATMP\restore_perf_setup.sql


三、开启所有的setup配置进行监控。
update performance_schema.setup_instruments set enabled='YES' where enabled='NO';
update performance_schema.setup_consumers set enabled='YES' where enabled='NO';
commit;


四、监控完成后,还原performance_schema的配置。
D:\software\mysql\mysql-5.6.14-win32\bin>mysql -h localhost -P 3306 -u root -pmysql -D test -s < d:\ATMP\restore_perf_setup.sql


五、清空performance_schema的监控表的记录。
SELECT CONCAT('truncate table performance_schema.',table_name,';')
FROM information_schema.TABLES
WHERE table_schema='performance_schema'
AND table_name NOT LIKE 'setup%'
AND table_name NOT LIKE '%instances'
AND table_name NOT LIKE '%attrs'
AND table_name NOT IN ('performance_timers', 'threads');

分享到:
评论

相关推荐

    简化版MySQL5.6.51解压即用

    记忆中MySQL5.6发布没有多久,就有大量的用户开始使用,可见其影响有多大。 按照Oracle的产品生命周期政策,MySQL5.6.51是5.6版本的最后一个维护版本,今后用户可以继续使用相关文档和支持信息,但是不会再出现修复...

    mysql 5.6 新特性

    DBA 和开发人员指南 MySQL 是当今最值得信赖和依靠的开源数据库平台。全球 10 大最热门、流量最高的网站中有...通过改进 Performance Schema 来更好地监测MySQL 提高安全性以确保应用程序部署安全无忧 以及其他重要增强

    MySQL 5.6 Reference Manual

    Table of Contents Preface, Notes, Licenses . . . . . . . . ....1. Licenses for Third-Party Components ....1.1. FindGTest.cmake License ....1.2. LPeg Library License ....1.3. LuaFileSystem Library License ....

    Mysql5.6启动内存占用过高解决方案

    最近把MySQL升级到了5.6版本,无意中在任务管理器发现... 经过实验测试,修改一下my.ini这个配置文件的配置选项是可以限制MySQL5.6内存占用过高这一问题的,具体修改选项如下: performance_schema_max_table_instance

    pstop-MySQL的顶级程序-Golang开发

    ps-top ps-top-MySQL的类似top的程序ps-top是从MySQL 5.6+的performance_schema数据库收集信息并使用此信息实时显示服务器负载的程序。 数据由表或f ps-top ps-top显示-MySQL的top-like程序ps-top是从MySQL 5.6+的...

    Webinar的MySQL高性能高可用资源集合

    MYSQL高可用高性能调优资源PPT: BackupRestoreWebinar_...Webinar_MySQL-5 6-Performance-Schema-Introduction.pdf Webinar_Query_Optimization-2_0.pdf what every dba needs to know about mysql security.pdf

    基于Go语言编写的类似 top 的 MySQL 程序.zip

    ps-top 是一个从 MySQL 5.6+ 的 performance_schema 数据库收集信息并使用这些信息实时显示服务器负载的程序。数据按表或文件名显示,指标还显示这是如何在选择、插入、更新或删除活动之间划分的。现在显示用户活动...

    ps-top:pstop-MySQL的顶级程序

    ps-top是一个程序,该程序从MySQL 5.6+的performance_schema数据库中收集信息,并使用该信息实时显示服务器负载。 数据以表或文件名显示,度量标准还显示如何在选择,插入,更新或删除活动之间进行拆分。 现在显示...

    Geoserver用户手册

    5.6 Tile Caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 5.7 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

Global site tag (gtag.js) - Google Analytics