巡检人:小麦苗 QQ:646634621 微信公众号:DB宝 提供OCP、OCM、高可用(rac+dg)、PostgreSQL和MySQL培训 BLOG地址: https://www.dbaup.com 若需要脚本可私聊我
GBase 8a数据库巡检报告

Copyright (c) 2015-2100 (https://www.dbaup.com) lhrbest. All rights reserved.

巡 检 人:小麦苗([QQ:646634621] [微信公众号:DB宝] [提供OCP、OCM、高可用、MySQL和PostgreSQL最实用的培训])
巡检时间:2023-03-06 14:31:06
版 本 号:v7.0.0
修改日期:2023-3-6

[转到页底]


目录
总体概况 数据库基本信息数据库的总体概况、版本、主机情况、数据库负载情况、数据库属性等 所有数据库及其容量大小当前数据库实例的所有数据库及其容量大小 查看数据库的运行状态 占用空间最大的前10张大表 所有存储引擎列表当前数据库实例的所有存储引擎列表
存储引擎和DB的数量关系 查询所有用户 一些重要的参数
锁情况 查询所有线程排除sleep线程 sleep线程TOP20 有多少线程正在使用表 元数据锁的相关信息
SQL部分 查看平均执行时间值大于95%的平均执行时间的语句(可近似地认为是平均执行时间超长的语句),默认情况下按照语句平均延迟(执行时间)降序排序 查看使用了临时表的语句,默认情况下按照磁盘临时表数量和内存临时表数量进行降序排序 默认情况下按照语句总延迟时间(执行时间)降序排序
使用全表扫描的SQL语句 查看全表扫描或者没有使用到最优索引的语句(经过标准化转化的语句文本),默认情况下按照全表扫描次数与语句总次数百分比和语句总延迟时间(执行时间)降序排序 查看产生错误或警告的语句,默认情况下,按照错误数量和警告数量降序排序
索引部分 区分度,越接近1,表示区分度越高,低于0.1,则说明区分度较差,开发者应该重新评估SQL语句涉及的字段,选择区分度高的多个字段创建索引
高可用情况 MySQL Replication(MySQL主从复制) 主从库线程查询
数据库性能 性能参数统计
其它 自增ID的使用 无主键或唯一键的表



数据库总体概况

● 数据库基本信息
now_dateuserCURRENT_USER1CONNECTION_IDdb_nameServer_versionall_db_size_MBall_datafile_size_MBdatadirSOCKETlog_errorautocommitlog_binserver_id
2023-03-06 14:31:10root@192.168.27.230root@%748.6.2.43-R7-free.11060513.19/home/gbase/GBase/userdata/gbase8a//tmp/gbase_8a_5258.sock/home/gbase/GBase/log/gbase8a/system.log100

● 版本信息
VARIABLE_NAMEVARIABLE_VALUE
VERSION_COMMENTGBase Enterprise Server - Advanced Edition (Commercial)
VERSION_COMPILE_MACHINEx86_64
VERSION_COMPILE_OSunknown-linux-gnu

● 查询当前节点cluster层磁盘空间使用信息
HOSTDIR_TYPEPATHDIR_SIZE_GFILESYTEMSIZE_GUSED_GAVAIL_GPCT
gbase8adatadir/home/gbase/GBase/userdata/gbase8a/0.01overlay101937064936%
gbase8agbase_cache_data/home/gbase/GBase/tmpdata/cache_gbase8a0.00overlay101937064936%
gbase8alogdir/home/gbase/GBase/log/gbase8a/0.00overlay101937064936%

● 查询内存使用情况
HOSTPHSICAL_MEMORY_GSWAP_SIZE_GPCTUPPER_LIMITCURRENT_USEDMEMORY_PEAKMEMORY_PEAK_TIMESTAMP
gbase8a633480%83006704844001970-01-01 08:00:00

● 当前数据库实例的所有数据库及其容量大小
SCHEMA_NAMEDEFAULT_CHARACTER_SET_NAMEDEFAULT_COLLATION_NAMEtable_rowsdata_size_mbindex_size_mball_size_mbmax_size_mbfree_size_mbdisk_size_mb
sbtestutf8utf8_general_ci278855688.560.008.560.000.00
gbaseutf8utf8_general_ci1287772.332.414.752903934763007.990.00
information_schemautf8mb4utf8mb4_general_ci0.000.000.002415919565.110.00
performance_schemautf8mb4utf8mb4_general_ci0.000.000.00109.120.00
lhrdbutf8utf8_general_ci
gctmpdbutf8utf8_general_ci
gclusterdbutf8utf8_general_ci

● 数据库对象
db_nameob_typesums
gbaseTABLE40
sbtest PROCEDURE1
sbtestTABLE1

● 查看数据库的运行状态
-------------- D:\db\MySQL\mysql-5.7.30-winx64\bin\mysql Ver 14.14 Distrib 5.7.30, for Win64 (x86_64) Connection id: 74 Current database: Current user: root@192.168.27.230 SSL: Not in use Using delimiter: ; Server version: 8.6.2.43-R7-free.110605 GBase Enterprise Server - Advanced Edition (Commercial) Protocol version: 10 Connection: 172.18.0.14 via TCP/IP Server characterset: utf8 Db characterset: utf8 Client characterset: utf8 Conn. characterset: utf8 TCP port: 5258 Uptime: 1 day 22 hours 43 min 50 sec Threads: 3 Questions: 4616 Slow queries: 0 Opens: 3675 Flush tables: 1 Open tables: 63 Queries per second avg: 0.27 --------------

● 占用空间最大的前10张大表
db_nametable_nameTABLE_TYPEENGINECREATE_TIMEUPDATE_TIMETABLE_COLLATIONtable_rowstb_size_mbindex_size_mball_size_mbfree_size_mbdisk_size_mb
sbtestt1BASE TABLEEXPRESS2023-03-04 16:20:542023-03-04 17:18:19utf8_general_ci278855688.560.008.560.00
gbasetime_zone_transitionBASE TABLEGsSYS2019-04-11 13:39:022020-03-25 09:32:35utf8mb4_general_ci1166601.892.103.990.00
gbasetime_zone_transition_typeBASE TABLEGsSYS2019-04-11 13:39:032020-03-25 09:32:35utf8mb4_general_ci85820.370.120.490.00
gbasetime_zone_nameBASE TABLEGsSYS2019-04-11 13:39:012020-03-25 09:32:35utf8mb4_general_ci17500.040.070.120.00
gbasetime_zoneBASE TABLEGsSYS2019-04-11 13:39:012020-03-25 09:32:35utf8mb4_general_ci17500.010.010.030.00
gbasecolumns_privBASE TABLEGsSYS2019-04-11 13:39:012020-03-25 09:32:35utf8mb4_bin00.000.000.000.00
gbasepassword_historyBASE TABLEGsSYS2019-04-11 13:39:012023-03-04 15:37:51utf8mb4_bin110.000.000.000.00
gbaseprocBASE TABLEGsSYS2019-04-11 13:39:012023-03-04 16:24:11utf8mb4_general_ci10.000.000.000.00
gbasefuncBASE TABLEGsSYS2019-04-11 13:39:012020-03-25 09:32:35utf8mb4_bin20.000.000.000.00
gbaseuserBASE TABLEGsSYS2019-04-11 13:39:012023-03-04 17:18:21utf8mb4_bin90.000.000.000.00

● 占用空间最大的前10个索引

● 所有存储引擎列表
ENGINESUPPORTCOMMENTTRANSACTIONSXASAVEPOINTS
MRG_GSSYSYESCollection of identical GsSYS tablesNONONO
CSVYESCSV storage engineNONONO
EXPRESSDEFAULTExpress storage engineYESYESNO
GsSYSYESGsSYS engineNONONO
MEMORYYESHash based, stored in memory, useful for temporary tablesNONONO

● 存储引擎和DB的数量关系
ENGINEcounts
EXPRESS1
GsSYS49
MEMORY37

TABLE_SCHEMAENGINEcounts
gbaseGsSYS40
information_schemaGsSYS9
information_schemaMEMORY30
performance_schemaMEMORY7
sbtestEXPRESS1

● 查询所有用户
HostUserSelect_privInsert_privUpdate_privDelete_privCreate_privDrop_privReload_privShutdown_privProcess_privFile_privGrant_privReferences_privIndex_privAlter_privShow_db_privSuper_privCreate_tmp_table_privLock_tables_privExecute_privRepl_slave_privCreate_view_privShow_view_privCreate_routine_privAlter_routine_privCreate_user_privEvent_privTrigger_privssl_typessl_cipherx509_issuerx509_subjectmax_questionsmax_updatesmax_connectionsmax_user_connections
% root YYYYYYYYYYYYYYYYYYYYYYYYYYY0000000
% gbase YYYYYYYYYYYYYYYYYYYYYYYYYYY0000000
% lhr YYYYYYYYYYYYYYYYYYYYYYYYYYY0000000
127.0.0.1 root YYYYYYYYYYYYYYYYYYYYYYYYYYY0000000
127.0.0.1 gbase YYYYYYYYYYYYYYYYYYYYYYYYYYY0000000
localhost root YYYYYYYYYYYYYYYYYYYYYYYYYYY0000000
localhost gbase YYYYYYYYYYYYYYYYYYYYYYYYYYY0000000
127.0.0.1 lhr YYYYYYYYYYYYYYYYYYYYYYYYYYY0000000
localhost lhr YYYYYYYYYYYYYYYYYYYYYYYYYYY0000000

● 查询数据库中的用户与用户组role的关联关系
FROM_HOSTFROM_USERTO_HOSTTO_USERWITH_ADMIN_OPTION

● 查询所有支持的字符集
CHARACTER_SET_NAMEDEFAULT_COLLATE_NAMEDESCRIPTIONMAXLEN
big5big5_chinese_ciBig5 Traditional Chinese2
dec8dec8_swedish_ciDEC West European1
cp850cp850_general_ciDOS West European1
hp8hp8_english_ciHP West European1
koi8rkoi8r_general_ciKOI8-R Relcom Russian1
latin1latin1_swedish_cicp1252 West European1
latin2latin2_general_ciISO 8859-2 Central European1
swe7swe7_swedish_ci7bit Swedish1
asciiascii_general_ciUS ASCII1
ujisujis_japanese_ciEUC-JP Japanese3
sjissjis_japanese_ciShift-JIS Japanese2
hebrewhebrew_general_ciISO 8859-8 Hebrew1
tis620tis620_thai_ciTIS620 Thai1
euckreuckr_korean_ciEUC-KR Korean2
koi8ukoi8u_general_ciKOI8-U Ukrainian1
gb2312gb2312_chinese_ciGB2312 Simplified Chinese2
greekgreek_general_ciISO 8859-7 Greek1
cp1250cp1250_general_ciWindows Central European1
gbkgbk_chinese_ciGBK Simplified Chinese2
latin5latin5_turkish_ciISO 8859-9 Turkish1
armscii8armscii8_general_ciARMSCII-8 Armenian1
utf8utf8_general_ciUTF-8 Unicode3
ucs2ucs2_general_ciUCS-2 Unicode2
cp866cp866_general_ciDOS Russian1
keybcs2keybcs2_general_ciDOS Kamenicky Czech-Slovak1
maccemacce_general_ciMac Central European1
macromanmacroman_general_ciMac West European1
cp852cp852_general_ciDOS Central European1
latin7latin7_general_ciISO 8859-13 Baltic1
utf8mb4utf8mb4_general_ciUTF-8 Unicode4
cp1251cp1251_general_ciWindows Cyrillic1
cp1256cp1256_general_ciWindows Arabic1
cp1257cp1257_general_ciWindows Baltic1
binarybinaryBinary pseudo charset1
geostd8geostd8_general_ciGEOSTD8 Georgian1
cp932cp932_japanese_ciSJIS for Windows Japanese2
eucjpmseucjpms_japanese_ciUJIS for Windows Japanese3
gb18030gb18030_chinese_ciChina National Standard GB180304

● 一些重要的参数
VARIABLE_NAMEVARIABLE_VALUE
AUTOCOMMITON
DATADIR/home/gbase/GBase/userdata/gbase8a/
GBASE_COMPRESSION_NUM_METHOD5
GBASE_COMPRESSION_SAMPLING1
GBASE_COMPRESSION_STR_METHOD5
HAVE_COMPRESSYES
LOG_ERROR/home/gbase/GBase/log/gbase8a/system.log
LOG_OUTPUTFILE
LOG_QUERIES_NOT_USING_INDEXESOFF
LOG_SLAVE_UPDATESOFF
LONG_QUERY_TIME10.000000
LOWER_CASE_TABLE_NAMES1
MAX_CONNECTIONS100
MAX_CONNECT_ERRORS10
MAX_USER_CONNECTIONS0
PID_FILE/home/gbase/GBase/log/gbase8a/gbased.pid
QUERY_CACHE_SIZE8388608
QUERY_CACHE_TYPEON
READ_ONLYOFF
SERVER_ID0
SLAVE_COMPRESSED_PROTOCOLOFF
SOCKET/tmp/gbase_8a_5258.sock
SQL_MODEPIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ONLY_FULL_GROUP_BY,NO_AUTO_VALUE_ON_ZERO,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH
TIME_ZONE+08:00
TX_ISOLATIONREPEATABLE-READ
_GBASE_DELETE_FILTER_COMPRESSEDOFF

● 查看当前连接到数据库的用户和Host
USERHOST
root192.168.27.230:63880
rootgbase8a:56458
rootgateway:33236

● 查看加载进度
SCNDB_NAMETB_NAMEIPSTATESTART_TIMEELAPSED_TIMEAVG_SPEEDPROGRESSTOTAL_SIZELOADED_SIZELOADED_RECORDSSKIPPED_RECORDSDATA_SOURCESQL_CMD

● 查看历史加载结果
TASK_IDDB_NAMETB_NAMEUSERACCESS_IPHOST_IPSTART_TIMEEND_TIMEELAPSED_TIMETOTAL_SIZEAVERAGE_SPEEDLOADED_RECORDSSKIPPED_RECORDSIGNORED_FILESRESULTSQL_CMDMESSAGE

[回到目录]


锁情况


● 查询所有线程(排除sleep线程)
IDUSERHOSTDBCOMMANDTIMESTATEINFO
45rootgateway:33236Killed162335checking permissions0

● sleep线程TOP20
IDUSERHOSTDBCOMMANDTIMESTATEINFO
73rootgbase8a:56458Sleep12

● 有多少线程正在使用表

● 锁详情

● 查看服务器的状态
VARIABLE_NAMEVARIABLE_VALUE
COM_LOCK_TABLES0
COM_SHOW_TABLE_LOCKS0
COM_UNLOCK_TABLES0
KEY_BLOCKS_NOT_FLUSHED0
KEY_BLOCKS_UNUSED6687
KEY_BLOCKS_USED7
QCACHE_FREE_BLOCKS1
QCACHE_TOTAL_BLOCKS4
TABLE_LOCKS_IMMEDIATE405
TABLE_LOCKS_WAITED29
TABLE_LOCK_REGISTERED_TABLES1

[回到目录]


SQL部分


● 查询SQL的整体消耗百分比
statetotal_rpct_rcallsr/call

[回到目录]


索引部分


[回到目录]


高可用情况


● 高可用重要参数
VARIABLE_NAMEVARIABLE_VALUE
AUTO_INCREMENT_OFFSET1
MAX_BINLOG_SIZE1073741824
AUTO_INCREMENT_INCREMENT1
BINLOG_FORMATSTATEMENT
SERVER_ID0
SQL_SLAVE_SKIP_COUNTER
SQL_LOG_BINON
SYNC_BINLOG0
LOG_SLAVE_UPDATESOFF
LOG_BINOFF
READ_ONLYOFF
SLAVE_SKIP_ERRORSOFF
EXPIRE_LOGS_DAYS0
SLAVE_EXEC_MODESTRICT
MAX_ALLOWED_PACKET1048576

[回到目录]


数据库性能


● 性能参数统计
VARIABLE_NAMEVARIABLE_VALUE
COM_DELETE0
COM_INSERT1
COM_SELECT4392
CONNECTIONS75
CREATED_TMP_DISK_TABLES1613
CREATED_TMP_FILES0
CREATED_TMP_TABLES8579
HANDLER_READ_RND_NEXT39217
OPEN_FILES101
OPENED_TABLES3757
SORT_MERGE_PASSES0
SORT_RANGE0
SORT_ROWS654
SORT_SCAN288
TABLE_LOCKS_IMMEDIATE405
TABLE_LOCKS_WAITED29
UPTIME168233

[回到目录]


其它


● 插件信息
PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_STATUSPLUGIN_TYPEPLUGIN_TYPE_VERSIONPLUGIN_LIBRARYPLUGIN_LIBRARY_VERSIONPLUGIN_AUTHORPLUGIN_DESCRIPTIONPLUGIN_LICENSE
binlog1.0ACTIVESTORAGE ENGINE80602.0GBase AB0
partition1.0ACTIVESTORAGE ENGINE80602.0Mikael Ronstrom, GBase AB0
CSV1.0ACTIVESTORAGE ENGINE80602.0Brian Aker, GBase AB0
EXPRESS0.1ACTIVESTORAGE ENGINE80602.0Express0
GsSYS1.0ACTIVESTORAGE ENGINE80602.0GBase AB0
MRG_GSSYS1.0ACTIVESTORAGE ENGINE80602.0GBase AB0
MEMORY1.0ACTIVESTORAGE ENGINE80602.0GBase AB0

● 自增ID的使用情况(前20条)
table_schematable_nameengineAuto_increment
gbasetime_zoneGsSYS1751

● 无主键或唯一键的表(前100条)
table_schematable_name
gbaseaudit_log
gbasecache_access_info
gbasegeneral_log
gbasememory_heap_info
gbasenew_index_conditions
gbasenew_index_fields
gbaseprocesslist
gbaseresource_pool_events
gbaseresource_pool_usage_history
gbasesql_trace
sbtestt1

[回到目录]