
字数 2086,阅读大约需 11 分钟
该套数据库巡检脚本多数为纯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提供英文版
和PostgreSQL数据库相似,需要有psql客户端,运行方式如下:
PGPASSWORD=lhr
psql -U gpadmin -h 192.168.8.8 -p 64340 -d lhrgpdb -H -f D:\DB_GP_HC_lhr_v7.0.0.sql > d:\a.html输入密码,回车即可。
注意: 1、该脚本的字符集为utf8,请使用utf8格式打开该文件。
由于版本差异,界面部分报错请忽略:
C:\Users\lhr>psql -U gpadmin -h 192.16.7.161-p 5432-d testdb -H -f E:\DB_GP_HC_lhr_v7.0.0_en.sql > d:\a.html
Password foruser gpadmin:
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:232: ERROR: could notopen extension control file "/usr/local/greenplum-db-7.4.0/share/postgresql/extension/gp_count_cores.control": No such file or directory
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:234: ERROR: relation "gp_num_physical_cores" does not exist
LINE 1: SELECT*from gp_num_physical_cores;
^
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:236: ERROR: relation "gp_num_physical_cores_per_host" does not exist
LINE 1: SELECT*from gp_num_physical_cores_per_host;
^
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:529: ERROR: column "waiting" does not exist
LINE 15: WHEN waiting ='false'THEN
^
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:534: ERROR: column "waiting" does not exist
LINE 1: ...backend_start,xact_start,query_start,state_change,waiting,st...
^
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:579: ERROR: column pgsa.waiting does not exist
LINE 10: pgsa.waiting,
^
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:611: WARNING: skipping "__gp_log_segment_ext" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:611: WARNING: skipping "__gp_log_coordinator_ext" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:611: WARNING: skipping "gp_disk_free" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:957: ERROR: column "relstorage" does not exist
LINE 78: and relstorage in ( 'c', 'a' )
^
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:988: ERROR: functionnot supported on relation (seg2 slice1 172.72.7.62:6000 pid=1317440)
CONTEXT: SQLfunction "__gp_aovisimap_hidden_typed" statement 1
PL/pgSQL function gp_toolkit.__gp_aovisimap_compaction_info(oid) line 7atFORoverSELECTrows
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1263: ERROR: column "lorwaiting" does not exist
LINE 1: ...LECT *FROM gp_toolkit.gp_locks_on_resqueue WHERE lorwaiting...
^
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1768: ERROR: column a.memory does not exist
LINE 9: a.memory/1024/1024 memory_GB,
^
HINT: Perhaps you meant to reference the column "a.mem_rss".
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "__gp_log_segment_ext" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "__gp_log_coordinator_ext" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "gp_disk_free" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "query_text_cleaner" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "report_cleaner" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "gp_log_master_ext" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "query_text_dir_size" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "dca_appliance_version" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "dca_serial_number" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "dca_hostmapping" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "os_timezone" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "gpcc_size_ext_table" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "gpcc_global_size_ext_table" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "gpcc_accuracy_ext_table" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "gpcc_index_ext_table" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "gpcc_queries_now" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "_gpcc_pg_log_import" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "_gpcc_pg_log_last_file" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "_gpcc_pg_log_increment" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "gpcc_mc_checker_coordinator" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "gpcc_mc_checker_segment_hosts" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "gp_env_ext" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "gp_log_master_ext" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "gpcc_stats_ext_table" --- cannot calculate this foreign table size
psql:E:/DB_GP_HC_lhr_v7.0.0_en.sql:1933: WARNING: skipping "gpcc_index_stats_ext_table" --- cannot calculate this foreign table size
这里只列出部分结果,其它的详细内容可以参考:https://share.weiyun.com/5lb2U2M





英文版界面:


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