1C:\Users\lhrxxt>mysql -uroot -plhr -h192.168.1.35 -P3415 -s -f < D:\DB_MySQL_HC_lhr_v7.0.0.sql > d:\tmp.html 2mysql: [Warning] Using a password on the command line interface can be insecure. 3ERROR 1193 (HY000) at line 159: Unknown system variable 'show_compatibility_56' 4ERROR 1146 (42S02) at line 205: Table 'performance_schema.global_variables' doesn't exist 5ERROR 1193 (HY000) at line 370: Unknown system variable 'innodb_page_size' 6ERROR 1146 (42S02) at line 509: Table 'performance_schema.global_variables' doesn't exist 7ERROR 1146 (42S02) at line 546: Table 'performance_schema.hosts' doesn't exist 8ERROR 1054 (42S22) at line 634: Unknown column 'a.type' in 'where clause' 9ERROR 1054 (42S22) at line 662: Unknown column 'a.type' in 'where clause' 10ERROR 1054 (42S22) at line 732: Unknown column 'trx_is_read_only' in 'field list' 11ERROR 1146 (42S02) at line 811: Table 'performance_schema.metadata_locks' doesn't exist 12ERROR 1146 (42S02) at line 872: Table 'performance_schema.metadata_locks' doesn't exist 13ERROR 1146 (42S02) at line 905: Table 'sys.processlist' doesn't exist 14ERROR 1146 (42S02) at line 919: Table 'sys.schema_table_lock_waits' doesn't exist 15ERROR 1146 (42S02) at line 940: Table 'performance_schema.global_status' doesn't exist 16ERROR 1146 (42S02) at line 979: Table 'performance_schema.events_stages_current' doesn't exist 17ERROR 1146 (42S02) at line 995: Table 'performance_schema.events_statements_summary_by_digest' doesn't exist 18ERROR 1146 (42S02) at line 1027: Table 'sys.session' doesn't exist 19ERROR 1146 (42S02) at line 1040: Table 'sys.session' doesn't exist 20ERROR 1146 (42S02) at line 1053: Table 'performance_schema.events_statements_summary_by_digest' doesn't exist 21ERROR 1146 (42S02) at line 1080: Table 'sys.statement_analysis' doesn't exist 22ERROR 1146 (42S02) at line 1096: Table 'performance_schema.events_statements_summary_by_digest' doesn't exist 23ERROR 1146 (42S02) at line 1149: Table 'sys.statement_analysis' doesn't exist 24ERROR 1146 (42S02) at line 1165: Table 'performance_schema.table_io_waits_summary_by_index_usage' doesn't exist 25ERROR 1146 (42S02) at line 1187: Table 'performance_schema.events_statements_summary_by_digest' doesn't exist 26ERROR 1146 (42S02) at line 1222: Table 'performance_schema.events_statements_summary_by_digest' doesn't exist 27ERROR 1146 (42S02) at line 1276: Table 'sys.schema_unused_indexes' doesn't exist 28ERROR 1146 (42S02) at line 1295: Table 'mysql.innodb_index_stats' doesn't exist 29ERROR 1146 (42S02) at line 1349: Table 'performance_schema.global_variables' doesn't exist 30ERROR 1146 (42S02) at line 1386: Table 'performance_schema.global_status' doesn't exist 31ERROR 1054 (42S22) at line 1411: Unknown column 'a.PROCESSLIST_COMMAND' in 'where clause' 32ERROR 1146 (42S02) at line 1470: Table 'performance_schema.replication_group_members' doesn't exist 33ERROR 1146 (42S02) at line 1514: Table 'performance_schema.replication_connection_configuration' doesn't exist 34ERROR 1146 (42S02) at line 1539: Table 'performance_schema.clone_status' doesn't exist 35ERROR 1146 (42S02) at line 1550: Table 'performance_schema.clone_progress' doesn't exist 36ERROR 1146 (42S02) at line 1619: Table 'performance_schema.global_status' doesn't exist 37 38C:\Users\lhrxxt>mysql -uroot -plhr -h192.168.1.35 -P3416 -s -f < D:\DB_MySQL_HC_lhr_v7.0.0.sql > d:\tmp.html 39mysql: [Warning] Using a password on the command line interface can be insecure. 40ERROR 1193 (HY000) at line 159: Unknown system variable 'show_compatibility_56' 41ERROR 1146 (42S02) at line 205: Table 'performance_schema.global_variables' doesn't exist 42ERROR 1146 (42S02) at line 509: Table 'performance_schema.global_variables' doesn't exist 43ERROR 1054 (42S22) at line 634: Unknown column 'HISTORY' in 'field list' 44ERROR 1054 (42S22) at line 662: Unknown column 'HISTORY' in 'field list' 45ERROR 1146 (42S02) at line 811: Table 'performance_schema.metadata_locks' doesn't exist 46ERROR 1146 (42S02) at line 872: Table 'performance_schema.metadata_locks' doesn't exist 47ERROR 1146 (42S02) at line 905: Table 'sys.processlist' doesn't exist 48ERROR 1146 (42S02) at line 919: Table 'sys.schema_table_lock_waits' doesn't exist 49ERROR 1146 (42S02) at line 940: Table 'performance_schema.global_status' doesn't exist 50ERROR 1054 (42S22) at line 979: Unknown column 'WORK_COMPLETED' in 'field list' 51ERROR 1146 (42S02) at line 995: Table 'sys.x$ps_digest_95th_percentile_by_avg_us' doesn't exist 52ERROR 1146 (42S02) at line 1027: Table 'sys.session' doesn't exist 53ERROR 1146 (42S02) at line 1040: Table 'sys.session' doesn't exist 54ERROR 1305 (42000) at line 1053: FUNCTION sys.format_statement does not exist 55ERROR 1146 (42S02) at line 1080: Table 'sys.statement_analysis' doesn't exist 56ERROR 1305 (42000) at line 1096: FUNCTION sys.format_statement does not exist 57ERROR 1146 (42S02) at line 1149: Table 'sys.statement_analysis' doesn't exist 58ERROR 1305 (42000) at line 1165: FUNCTION sys.format_time does not exist 59ERROR 1305 (42000) at line 1187: FUNCTION sys.format_statement does not exist 60ERROR 1305 (42000) at line 1222: FUNCTION sys.format_statement does not exist 61ERROR 1146 (42S02) at line 1276: Table 'sys.schema_unused_indexes' doesn't exist 62ERROR 1146 (42S02) at line 1349: Table 'performance_schema.global_variables' doesn't exist 63ERROR 1146 (42S02) at line 1386: Table 'performance_schema.global_status' doesn't exist 64ERROR 1054 (42S22) at line 1411: Unknown column 'HISTORY' in 'field list' 65ERROR 1146 (42S02) at line 1470: Table 'performance_schema.replication_group_members' doesn't exist 66ERROR 1146 (42S02) at line 1514: Table 'performance_schema.replication_connection_configuration' doesn't exist 67ERROR 1146 (42S02) at line 1539: Table 'performance_schema.clone_status' doesn't exist 68ERROR 1146 (42S02) at line 1550: Table 'performance_schema.clone_progress' doesn't exist 69ERROR 1146 (42S02) at line 1619: Table 'performance_schema.global_status' doesn't exist 70 71C:\Users\lhrxxt>mysql -uroot -plhr -h192.168.1.35 -P3418 -s -f < D:\DB_MySQL_HC_lhr_v7.0.0.sql > d:\tmp.html 72mysql: [Warning] Using a password on the command line interface can be insecure. 73ERROR 1193 (HY000) at line 159: Unknown system variable 'show_compatibility_56' 74ERROR 1109 (42S02) at line 214: Unknown table 'GLOBAL_VARIABLES' in information_schema 75ERROR 1109 (42S02) at line 518: Unknown table 'GLOBAL_VARIABLES' in information_schema 76ERROR 1109 (42S02) at line 699: Unknown table 'INNODB_LOCKS' in information_schema 77ERROR 1109 (42S02) at line 719: Unknown table 'INNODB_LOCK_WAITS' in information_schema 78ERROR 1109 (42S02) at line 747: Unknown table 'INNODB_LOCK_WAITS' in information_schema 79ERROR 1109 (42S02) at line 949: Unknown table 'GLOBAL_STATUS' in information_schema 80ERROR 1109 (42S02) at line 1358: Unknown table 'GLOBAL_VARIABLES' in information_schema 81ERROR 1109 (42S02) at line 1395: Unknown table 'GLOBAL_STATUS' in information_schema 82ERROR 1146 (42S02) at line 1539: Table 'performance_schema.clone_status' doesn't exist 83ERROR 1146 (42S02) at line 1550: Table 'performance_schema.clone_progress' doesn't exist 84ERROR 1109 (42S02) at line 1628: Unknown table 'GLOBAL_STATUS' in information_schema 85 86C:\Users\lhrxxt> mysql -uroot -plhr -h192.168.1.35 -P3419 -s -f < DB_MySQL_HC_lhr_v7.0.0.sql > mariadb.html 87ERROR 1193 (HY000) at line 159: Unknown system variable 'show_compatibility_56' 88ERROR 1146 (42S02) at line 205: Table 'performance_schema.global_variables' doesn't exist 89ERROR 1146 (42S02) at line 509: Table 'performance_schema.global_variables' doesn't exist 90ERROR 1054 (42S22) at line 732: Unknown column 'trx_adaptive_hash_latched' in 'field list' 91ERROR 1146 (42S02) at line 905: Table 'sys.processlist' doesn't exist 92ERROR 1146 (42S02) at line 919: Table 'sys.schema_table_lock_waits' doesn't exist 93ERROR 1146 (42S02) at line 995: Table 'sys.x$ps_digest_95th_percentile_by_avg_us' doesn't exist 94ERROR 1146 (42S02) at line 1027: Table 'sys.session' doesn't exist 95ERROR 1146 (42S02) at line 1040: Table 'sys.session' doesn't exist 96ERROR 1305 (42000) at line 1053: FUNCTION sys.format_statement does not exist 97ERROR 1146 (42S02) at line 1080: Table 'sys.statement_analysis' doesn't exist 98ERROR 1305 (42000) at line 1096: FUNCTION sys.format_statement does not exist 99ERROR 1146 (42S02) at line 1149: Table 'sys.statement_analysis' doesn't exist 100ERROR 1305 (42000) at line 1165: FUNCTION sys.format_time does not exist 101ERROR 1305 (42000) at line 1187: FUNCTION sys.format_statement does not exist 102ERROR 1305 (42000) at line 1222: FUNCTION sys.format_statement does not exist 103ERROR 1146 (42S02) at line 1276: Table 'sys.schema_unused_indexes' doesn't exist 104ERROR 1146 (42S02) at line 1349: Table 'performance_schema.global_variables' doesn't exist 105ERROR 1146 (42S02) at line 1470: Table 'performance_schema.replication_group_members' doesn't exist 106ERROR 1146 (42S02) at line 1514: Table 'performance_schema.replication_connection_status' doesn't exist 107ERROR 1146 (42S02) at line 1539: Table 'performance_schema.clone_status' doesn't exist 108ERROR 1146 (42S02) at line 1550: Table 'performance_schema.clone_progress' doesn't exist
2、巡检内容“WAL日志切换频率(需要手动修改脚本路径)”部分的“/pg13/pgdata/pg_wal ”路径需要手动修改为自己环境真实的路径,否则会报错:ERROR: absolute path not allowed
注意:
由于用户环境的版本或插件问题,如下的报错请忽略,不影响最终的结果:
1[pg94@lhrpgall ~]$ psql -W -H -f DB_PG_HC_lhr_v7.0.0.sql > d:\lhr_PG_check.html 2Password: 3psql:DB_PG_HC_lhr_v7.0.0.sql:291: ERROR: column p.prokind does not exist 4LINE 2: CASE p.prokind 5 ^ 6psql:DB_PG_HC_lhr_v7.0.0.sql:359: ERROR: column "total_exec_time" does not exist 7LINE 3: round(total_exec_time::numeric, 2) AS total_time, 8 ^ 9psql:DB_PG_HC_lhr_v7.0.0.sql:368: ERROR: column "mean_time" does not exist 10LINE 4: round(mean_time::numeric, 2) AS mean_time, 11 ^ 12psql:DB_PG_HC_lhr_v7.0.0.sql:385: ERROR: column "total_exec_time" does not exist 13LINE 3: round(total_exec_time::numeric, 2) AS total_time, 14 ^ 15psql:DB_PG_HC_lhr_v7.0.0.sql:401: ERROR: pg_stat_statements must be loaded via shared_preload_libraries 16 17psql:DB_PG_HC_lhr_v7.0.0.sql:423: ERROR: relation "pg_stat_wal_receiver" does not exist 18LINE 1: select * from pg_stat_wal_receiver; 19 ^ 20psql:DB_PG_HC_lhr_v7.0.0.sql:430: ERROR: function pg_current_wal_lsn() does not exist 21LINE 3: pg_current_wal_lsn() AS A(c1) 22 ^ 23HINT: No function matches the given name and argument types. You might need to add explicit type casts. 24psql:DB_PG_HC_lhr_v7.0.0.sql:450: ERROR: relation "pg_publication" does not exist 25LINE 1: select * from pg_publication; 26 ^ 27psql:DB_PG_HC_lhr_v7.0.0.sql:453: ERROR: relation "pg_publication_tables" does not exist 28LINE 1: select * from pg_publication_tables; 29 ^ 30psql:DB_PG_HC_lhr_v7.0.0.sql:460: ERROR: relation "pg_stat_subscription" does not exist 31LINE 1: select * from pg_stat_subscription; 32 ^ 33psql:DB_PG_HC_lhr_v7.0.0.sql:464: ERROR: relation "pg_subscription" does not exist 34LINE 1: select * from pg_subscription; 35 ^ 36psql:DB_PG_HC_lhr_v7.0.0.sql:468: ERROR: relation "pg_subscription_rel" does not exist 37LINE 1: select *,srrelid::regclass from pg_subscription_rel; 38 ^ 39psql:DB_PG_HC_lhr_v7.0.0.sql:490: ERROR: relation "pg_file_settings" does not exist 40LINE 1: select * from pg_file_settings; 41 ^ 42psql:DB_PG_HC_lhr_v7.0.0.sql:528: ERROR: relation "pg_hba_file_rules" does not exist 43LINE 1: select * from pg_hba_file_rules; 44 ^ 45psql:DB_PG_HC_lhr_v7.0.0.sql:588: ERROR: absolute path not allowed 46psql:DB_PG_HC_lhr_v7.0.0.sql:589: ERROR: could not open directory "/pg13/pgdata/pg_wal": Permission denied 47psql:DB_PG_HC_lhr_v7.0.0.sql:666: ERROR: relation "pg_config" does not exist 48LINE 1: SELECT * FROM pg_config ; 49 ^
1[root@ecs-9b83 ~]# sh DB_OS_HC_lhr_v7.0.0.sh 2DB_OS_HC_lhr_v7.0.0.sh: line 9: $'\r': command not found 3: No such file or directorye 13: /etc/profile 4[root@ecs-9b83 ~]# chmod +x DB_OS_HC_lhr_v7.0.0.sh 5[root@ecs-9b83 ~]# ./DB_OS_HC_lhr_v7.0.0.sh 6-bash: ./DB_OS_HC_lhr_v7.0.0.sh: /bin/bash^M: bad interpreter: No such file or directory
则需要使用dos2unix进行格式化:
1[root@ecs-9b83 ~]# dos2unix DB_OS_HC_lhr_v7.0.0.sh 2dos2unix: converting file DB_OS_HC_lhr_v7.0.0.sh to Unix format ... 3[root@ecs-9b83 ~]# ./DB_OS_HC_lhr_v7.0.0.sh 4检查结果:./HostDailyCheck--20220825.txt