MySQL数据库巡检脚本说明

1、MySQL(Mariadb)数据库运行方式

只要有mysql客户端即可,使用MariaDB的客户端也可以,如下:

mysql -uroot -plhr -P3306 -s -f <  DB_MySQL_HC_lhr_v7.0.0.sql  > lhr_mysql_check.html

该脚本也适用于mariadb数据库

注意:

由于版本问题,如下的报错请忽略,不影响最终的结果:

C:\Users\lhrxxt>mysql -uroot -plhr -h192.168.1.35 -P3415 -s -f < D:\DB_MySQL_HC_lhr_v7.0.0.sql > d:\tmp.html
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1193 (HY000) at line 159: Unknown system variable 'show_compatibility_56'
ERROR 1146 (42S02) at line 205: Table 'performance_schema.global_variables' doesn't exist
ERROR 1193 (HY000) at line 370: Unknown system variable 'innodb_page_size'
ERROR 1146 (42S02) at line 509: Table 'performance_schema.global_variables' doesn't exist
ERROR 1146 (42S02) at line 546: Table 'performance_schema.hosts' doesn't exist
ERROR 1054 (42S22) at line 634: Unknown column 'a.type' in 'where clause'
ERROR 1054 (42S22) at line 662: Unknown column 'a.type' in 'where clause'
ERROR 1054 (42S22) at line 732: Unknown column 'trx_is_read_only' in 'field list'
ERROR 1146 (42S02) at line 811: Table 'performance_schema.metadata_locks' doesn't exist
ERROR 1146 (42S02) at line 872: Table 'performance_schema.metadata_locks' doesn't exist
ERROR 1146 (42S02) at line 905: Table 'sys.processlist' doesn't exist
ERROR 1146 (42S02) at line 919: Table 'sys.schema_table_lock_waits' doesn't exist
ERROR 1146 (42S02) at line 940: Table 'performance_schema.global_status' doesn't exist
ERROR 1146 (42S02) at line 979: Table 'performance_schema.events_stages_current' doesn't exist
ERROR 1146 (42S02) at line 995: Table 'performance_schema.events_statements_summary_by_digest' doesn't exist
ERROR 1146 (42S02) at line 1027: Table 'sys.session' doesn't exist
ERROR 1146 (42S02) at line 1040: Table 'sys.session' doesn't exist
ERROR 1146 (42S02) at line 1053: Table 'performance_schema.events_statements_summary_by_digest' doesn't exist
ERROR 1146 (42S02) at line 1080: Table 'sys.statement_analysis' doesn't exist
ERROR 1146 (42S02) at line 1096: Table 'performance_schema.events_statements_summary_by_digest' doesn't exist
ERROR 1146 (42S02) at line 1149: Table 'sys.statement_analysis' doesn't exist
ERROR 1146 (42S02) at line 1165: Table 'performance_schema.table_io_waits_summary_by_index_usage' doesn't exist
ERROR 1146 (42S02) at line 1187: Table 'performance_schema.events_statements_summary_by_digest' doesn't exist
ERROR 1146 (42S02) at line 1222: Table 'performance_schema.events_statements_summary_by_digest' doesn't exist
ERROR 1146 (42S02) at line 1276: Table 'sys.schema_unused_indexes' doesn't exist
ERROR 1146 (42S02) at line 1295: Table 'mysql.innodb_index_stats' doesn't exist
ERROR 1146 (42S02) at line 1349: Table 'performance_schema.global_variables' doesn't exist
ERROR 1146 (42S02) at line 1386: Table 'performance_schema.global_status' doesn't exist
ERROR 1054 (42S22) at line 1411: Unknown column 'a.PROCESSLIST_COMMAND' in 'where clause'
ERROR 1146 (42S02) at line 1470: Table 'performance_schema.replication_group_members' doesn't exist
ERROR 1146 (42S02) at line 1514: Table 'performance_schema.replication_connection_configuration' doesn't exist
ERROR 1146 (42S02) at line 1539: Table 'performance_schema.clone_status' doesn't exist
ERROR 1146 (42S02) at line 1550: Table 'performance_schema.clone_progress' doesn't exist
ERROR 1146 (42S02) at line 1619: Table 'performance_schema.global_status' doesn't exist

C:\Users\lhrxxt>mysql -uroot -plhr -h192.168.1.35 -P3416 -s -f < D:\DB_MySQL_HC_lhr_v7.0.0.sql > d:\tmp.html
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1193 (HY000) at line 159: Unknown system variable 'show_compatibility_56'
ERROR 1146 (42S02) at line 205: Table 'performance_schema.global_variables' doesn't exist
ERROR 1146 (42S02) at line 509: Table 'performance_schema.global_variables' doesn't exist
ERROR 1054 (42S22) at line 634: Unknown column 'HISTORY' in 'field list'
ERROR 1054 (42S22) at line 662: Unknown column 'HISTORY' in 'field list'
ERROR 1146 (42S02) at line 811: Table 'performance_schema.metadata_locks' doesn't exist
ERROR 1146 (42S02) at line 872: Table 'performance_schema.metadata_locks' doesn't exist
ERROR 1146 (42S02) at line 905: Table 'sys.processlist' doesn't exist
ERROR 1146 (42S02) at line 919: Table 'sys.schema_table_lock_waits' doesn't exist
ERROR 1146 (42S02) at line 940: Table 'performance_schema.global_status' doesn't exist
ERROR 1054 (42S22) at line 979: Unknown column 'WORK_COMPLETED' in 'field list'
ERROR 1146 (42S02) at line 995: Table 'sys.x$ps_digest_95th_percentile_by_avg_us' doesn't exist
ERROR 1146 (42S02) at line 1027: Table 'sys.session' doesn't exist
ERROR 1146 (42S02) at line 1040: Table 'sys.session' doesn't exist
ERROR 1305 (42000) at line 1053: FUNCTION sys.format_statement does not exist
ERROR 1146 (42S02) at line 1080: Table 'sys.statement_analysis' doesn't exist
ERROR 1305 (42000) at line 1096: FUNCTION sys.format_statement does not exist
ERROR 1146 (42S02) at line 1149: Table 'sys.statement_analysis' doesn't exist
ERROR 1305 (42000) at line 1165: FUNCTION sys.format_time does not exist
ERROR 1305 (42000) at line 1187: FUNCTION sys.format_statement does not exist
ERROR 1305 (42000) at line 1222: FUNCTION sys.format_statement does not exist
ERROR 1146 (42S02) at line 1276: Table 'sys.schema_unused_indexes' doesn't exist
ERROR 1146 (42S02) at line 1349: Table 'performance_schema.global_variables' doesn't exist
ERROR 1146 (42S02) at line 1386: Table 'performance_schema.global_status' doesn't exist
ERROR 1054 (42S22) at line 1411: Unknown column 'HISTORY' in 'field list'
ERROR 1146 (42S02) at line 1470: Table 'performance_schema.replication_group_members' doesn't exist
ERROR 1146 (42S02) at line 1514: Table 'performance_schema.replication_connection_configuration' doesn't exist
ERROR 1146 (42S02) at line 1539: Table 'performance_schema.clone_status' doesn't exist
ERROR 1146 (42S02) at line 1550: Table 'performance_schema.clone_progress' doesn't exist
ERROR 1146 (42S02) at line 1619: Table 'performance_schema.global_status' doesn't exist

C:\Users\lhrxxt>mysql -uroot -plhr -h192.168.1.35 -P3418 -s -f < D:\DB_MySQL_HC_lhr_v7.0.0.sql > d:\tmp.html
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1193 (HY000) at line 159: Unknown system variable 'show_compatibility_56'
ERROR 1109 (42S02) at line 214: Unknown table 'GLOBAL_VARIABLES' in information_schema
ERROR 1109 (42S02) at line 518: Unknown table 'GLOBAL_VARIABLES' in information_schema
ERROR 1109 (42S02) at line 699: Unknown table 'INNODB_LOCKS' in information_schema
ERROR 1109 (42S02) at line 719: Unknown table 'INNODB_LOCK_WAITS' in information_schema
ERROR 1109 (42S02) at line 747: Unknown table 'INNODB_LOCK_WAITS' in information_schema
ERROR 1109 (42S02) at line 949: Unknown table 'GLOBAL_STATUS' in information_schema
ERROR 1109 (42S02) at line 1358: Unknown table 'GLOBAL_VARIABLES' in information_schema
ERROR 1109 (42S02) at line 1395: Unknown table 'GLOBAL_STATUS' in information_schema
ERROR 1146 (42S02) at line 1539: Table 'performance_schema.clone_status' doesn't exist
ERROR 1146 (42S02) at line 1550: Table 'performance_schema.clone_progress' doesn't exist
ERROR 1109 (42S02) at line 1628: Unknown table 'GLOBAL_STATUS' in information_schema

C:\Users\lhrxxt> mysql -uroot -plhr -h192.168.1.35 -P3419 -s -f < DB_MySQL_HC_lhr_v7.0.0.sql > mariadb.html
ERROR 1193 (HY000) at line 159: Unknown system variable 'show_compatibility_56'
ERROR 1146 (42S02) at line 205: Table 'performance_schema.global_variables' doesn't exist
ERROR 1146 (42S02) at line 509: Table 'performance_schema.global_variables' doesn't exist
ERROR 1054 (42S22) at line 732: Unknown column 'trx_adaptive_hash_latched' in 'field list'
ERROR 1146 (42S02) at line 905: Table 'sys.processlist' doesn't exist
ERROR 1146 (42S02) at line 919: Table 'sys.schema_table_lock_waits' doesn't exist
ERROR 1146 (42S02) at line 995: Table 'sys.x$ps_digest_95th_percentile_by_avg_us' doesn't exist
ERROR 1146 (42S02) at line 1027: Table 'sys.session' doesn't exist
ERROR 1146 (42S02) at line 1040: Table 'sys.session' doesn't exist
ERROR 1305 (42000) at line 1053: FUNCTION sys.format_statement does not exist
ERROR 1146 (42S02) at line 1080: Table 'sys.statement_analysis' doesn't exist
ERROR 1305 (42000) at line 1096: FUNCTION sys.format_statement does not exist
ERROR 1146 (42S02) at line 1149: Table 'sys.statement_analysis' doesn't exist
ERROR 1305 (42000) at line 1165: FUNCTION sys.format_time does not exist
ERROR 1305 (42000) at line 1187: FUNCTION sys.format_statement does not exist
ERROR 1305 (42000) at line 1222: FUNCTION sys.format_statement does not exist
ERROR 1146 (42S02) at line 1276: Table 'sys.schema_unused_indexes' doesn't exist
ERROR 1146 (42S02) at line 1349: Table 'performance_schema.global_variables' doesn't exist
ERROR 1146 (42S02) at line 1470: Table 'performance_schema.replication_group_members' doesn't exist
ERROR 1146 (42S02) at line 1514: Table 'performance_schema.replication_connection_status' doesn't exist
ERROR 1146 (42S02) at line 1539: Table 'performance_schema.clone_status' doesn't exist
ERROR 1146 (42S02) at line 1550: Table 'performance_schema.clone_progress' doesn't exist

2、html巡检结果

这里只列出部分结果,完整示例请参考:MySQL数据库巡检结果示例

其它的详细内容可以参考:https://share.weiyun.com/FQY9zcm0

3、所有数据库类型巡检

请参考:https://www.dbaup.com/shujukuxunjianjiaoben.html

Copyright © 小麦苗 2024 修订时间: 2024-09-11 17:33:24

results matching ""

    No results matching ""