
字数 2951,阅读大约需 15 分钟
该套数据库巡检脚本多数为纯SQL脚本开发,如下所示:

1、可以巡检
Oracle、MySQL(包括Mariadb)、SQL Server、PostgreSQL、Greenplum、OceanBase、TiDB、openGauss、DB2、达梦、人大金仓(KES+KADB)、万里GreatDB、TDSQL_for_PG(原 TBase)、MogDB、OushuDB、PolarDB_for_PG、神通、南大通用GBase 8a+8c、StarRocks、YMatrix、YashanDB等21种数据库,也可以巡检Linux操作系统(后续会免费逐步增加MongoDB、Redis等数据库) 2、脚本为绿色版、免安装、纯SQL文本 3、跨平台,只要有sqlplus(Oracle)、mysql(MySQL、Mariadb、TiDB、OceanBase、万里GreatDB、南大通用GBase 8a、StarRocks)、sqlcmd(SSMS、Navicat皆可)、psql(PG、Greenplum、openGauss、人大金仓KES+KADB、TBase、MogDB、OushuDB、PolarDB_for_PG、南大通用GBase 8c、YMatrix)、gsql(openGauss、GaussDB、MogDB、南大通用GBase 8c)、disql(国产达梦)、db2(DB2数据库)、obclient(OceanBase)、ksql(人大金仓KES)、isql(神舟通用)、gccli(南大通用GBase 8a)、yasql(崖山数据库)环境即可运行脚本 4、脚本内容可视化,可以看到脚本内容,因此可供学习数据库使用 5、兼容Oracle 10g、11g、12c、18c、19c、21c、23ai等高版本Oracle数据库 6、对Oracle 10g、11g、12c、18c、19c、21c、23ai等版本分别提供了只读版(只对数据库查询,不做DDL和DML操作) 7、MySQL最低支持5.5版本,小于5.5版本未进行测试 8、SQL Server最低支持2005版本 9、增删监控项非常方便,只需要提供相关SQL即可 10、一次购买,所有脚本终身免费升级 11、检查内容非常全面 12、针对每种数据库,只有1个SQL脚本,不存在嵌套调用脚本等其它问题 13、最终生成html文件格式的健康检查结果 14、Oracle数据库对巡检结果进行过滤,列出了数据库有问题的内容 15、对OS的信息提供了收集(单独脚本) 16、对Oracle、MySQL、SQL Server、PG、GreenPlum提供英文版
只要有mysql客户端即可,使用MariaDB的客户端也可以,如下:
mysql -uroot -plhr -P3306 -h 192.168.8.8 -s -f < DB_MySQL_HC_lhr_v7.0.0.sql > lhr_mysql_check.html该脚本也适用于mariadb数据库。
由于版本问题,如下的报错请忽略,不影响最终的结果:
C:\Users\lhrxxt>mysql -uroot -plhr -h192.168.8.8-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: Unknownsystem 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.8.8-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: Unknownsystem 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: Unknowncolumn'HISTORY'in'field list'
ERROR 1054 (42S22) at line 662: Unknowncolumn'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.8.8-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: Unknownsystem variable 'show_compatibility_56'
ERROR 1109 (42S02) at line 214: Unknowntable'GLOBAL_VARIABLES'in information_schema
ERROR 1109 (42S02) at line 518: Unknowntable'GLOBAL_VARIABLES'in information_schema
ERROR 1109 (42S02) at line 699: Unknowntable'INNODB_LOCKS'in information_schema
ERROR 1109 (42S02) at line 719: Unknowntable'INNODB_LOCK_WAITS'in information_schema
ERROR 1109 (42S02) at line 747: Unknowntable'INNODB_LOCK_WAITS'in information_schema
ERROR 1109 (42S02) at line 949: Unknowntable'GLOBAL_STATUS'in information_schema
ERROR 1109 (42S02) at line 1358: Unknowntable'GLOBAL_VARIABLES'in information_schema
ERROR 1109 (42S02) at line 1395: Unknowntable'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: Unknowntable'GLOBAL_STATUS'in information_schema
C:\Users\lhrxxt> mysql -uroot -plhr -h192.168.8.8-P3419 -s -f < DB_MySQL_HC_lhr_v7.0.0.sql> mariadb.html
ERROR 1193 (HY000) at line 159: Unknownsystem 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: Unknowncolumn'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
C:\Users\lhr>mysql -uroot -plhr -h192.168.8.8 -P3420 -s -f < DB_MySQL_HC_lhr_v7.0.0.sql > lhr_mysql_check.html
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1193 (HY000) at line 158: Unknown system variable 'show_compatibility_56'
ERROR 1109 (42S02) at line 213: Unknown table 'GLOBAL_VARIABLES' in information_schema
ERROR 1109 (42S02) at line 521: Unknown table 'GLOBAL_VARIABLES' in information_schema
ERROR 1109 (42S02) at line 701: Unknown table 'INNODB_LOCKS' in information_schema
ERROR 1109 (42S02) at line 721: Unknown table 'INNODB_LOCK_WAITS' in information_schema
ERROR 1109 (42S02) at line 749: Unknown table 'INNODB_LOCK_WAITS' in information_schema
ERROR 1109 (42S02) at line 951: Unknown table 'GLOBAL_STATUS' in information_schema
ERROR 1109 (42S02) at line 1362: Unknown table 'GLOBAL_VARIABLES' in information_schema
ERROR 1109 (42S02) at line 1399: Unknown table 'GLOBAL_STATUS' in information_schema
ERROR 1064 (42000) at line 1464: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'slave hosts' at line 1
ERROR 1064 (42000) at line 1504: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'master status' at line 1
ERROR 1064 (42000) at line 1518: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'slave status' at line 1
ERROR 1146 (42S02) at line 1553: Table 'performance_schema.clone_status' doesn't exist
ERROR 1146 (42S02) at line 1564: Table'performance_schema.clone_progress' doesn't exist
ERROR 1109 (42S02) at line 1642: Unknown table 'GLOBAL_STATUS' in information_schema
这里只列出部分结果,其它的详细内容可以参考:https://share.weiyun.com/FQY9zcm0




英文版界面:

其它不再列举。
请参考:https://www.dbaup.com/shujukuxunjianjiaoben.html