一、达梦数据库概述与查看信息的重要性
1.1 DM 数据库简介
达梦数据库 (DM Database) 是武汉达梦数据库股份有限公司自主研发的新一代大型通用关系型数据库管理系统,具有高性能、高可用、高安全等特性,广泛应用于金融、电信、能源、政务等关键行业。作为国产数据库的标杆产品,DM 数据库兼容 SQL 标准语法,并提供丰富的系统视图和管理工具,方便运维人员进行数据库信息查看与管理。
1.2 查看数据库信息的应用场景
在实际运维过程中,DM 查看数据库信息是日常工作的基础环节,典型应用场景包括:
1.3 常用查看工具介绍
DM 数据库提供多种信息查看工具,主要包括:
二、DM 查看数据库信息的常用方法
2.1 查看方式总览
DM 数据库信息查看的整体流程如下图所示,运维人员可根据实际场景选择合适的方式:
#publish-mermaid-1786945298456-0{font-family:inherit;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-1786945298456-0 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-1786945298456-0 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-1786945298456-0 .error-icon{fill:#552222;}#publish-mermaid-1786945298456-0 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-1786945298456-0 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-1786945298456-0 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-1786945298456-0 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-1786945298456-0 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-1786945298456-0 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-1786945298456-0 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-1786945298456-0 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-1786945298456-0 .marker.cross{stroke:#333333;}#publish-mermaid-1786945298456-0 svg{font-family:inherit;font-size:16px;}#publish-mermaid-1786945298456-0 p{margin:0;}#publish-mermaid-1786945298456-0 .label{font-family:inherit;color:#333;}#publish-mermaid-1786945298456-0 .cluster-label text{fill:#333;}#publish-mermaid-1786945298456-0 .cluster-label span{color:#333;}#publish-mermaid-1786945298456-0 .cluster-label span p{background-color:transparent;}#publish-mermaid-1786945298456-0 .label text,#publish-mermaid-1786945298456-0 span{fill:#333;color:#333;}#publish-mermaid-1786945298456-0 .node rect,#publish-mermaid-1786945298456-0 .node circle,#publish-mermaid-1786945298456-0 .node ellipse,#publish-mermaid-1786945298456-0 .node polygon,#publish-mermaid-1786945298456-0 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-1786945298456-0 .rough-node .label text,#publish-mermaid-1786945298456-0 .node .label text,#publish-mermaid-1786945298456-0 .image-shape .label,#publish-mermaid-1786945298456-0 .icon-shape .label{text-anchor:middle;}#publish-mermaid-1786945298456-0 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#publish-mermaid-1786945298456-0 .rough-node .label,#publish-mermaid-1786945298456-0 .node .label,#publish-mermaid-1786945298456-0 .image-shape .label,#publish-mermaid-1786945298456-0 .icon-shape .label{text-align:center;}#publish-mermaid-1786945298456-0 .node.clickable{cursor:pointer;}#publish-mermaid-1786945298456-0 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#publish-mermaid-1786945298456-0 .arrowheadPath{fill:#333333;}#publish-mermaid-1786945298456-0 .edgePath .path{stroke:#333333;stroke-width:1px;}#publish-mermaid-1786945298456-0 .flowchart-link{stroke:#333333;fill:none;}#publish-mermaid-1786945298456-0 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-1786945298456-0 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-1786945298456-0 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-1786945298456-0 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#publish-mermaid-1786945298456-0 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#publish-mermaid-1786945298456-0 .cluster text{fill:#333;}#publish-mermaid-1786945298456-0 .cluster span{color:#333;}#publish-mermaid-1786945298456-0 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:inherit;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#publish-mermaid-1786945298456-0 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-1786945298456-0 rect.text{fill:none;stroke-width:0;}#publish-mermaid-1786945298456-0 .icon-shape,#publish-mermaid-1786945298456-0 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-1786945298456-0 .icon-shape p,#publish-mermaid-1786945298456-0 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#publish-mermaid-1786945298456-0 .icon-shape .label rect,#publish-mermaid-1786945298456-0 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-1786945298456-0 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#publish-mermaid-1786945298456-0 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#publish-mermaid-1786945298456-0 .node .neo-node{stroke:#9370DB;}#publish-mermaid-1786945298456-0 [data-look=\”neo\”].node rect,#publish-mermaid-1786945298456-0 [data-look=\”neo\”].cluster rect,#publish-mermaid-1786945298456-0 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1786945298456-0 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-1786945298456-0 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-1786945298456-0 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1786945298456-0 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-1786945298456-0 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1786945298456-0 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-1786945298456-0 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1786945298456-0 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1786945298456-0 :root{–mermaid-font-family:inherit;}
开始 DM 查看数据库信息
选择查看方式
disql 命令行
DM 管理工具
系统视图查询
动态性能视图
查看版本与实例
图形化浏览对象
查询元数据
查看实时状态
输出结果
分析与诊断
完成
2.2 使用 disql 工具查看
disql 是 DM 数据库最常用的命令行工具,使用方式如下:
disql 工具支持脚本执行和结果导出,是运维人员必备工具。
2.3 通过系统视图查看元数据
DM 数据库在 SYS 模式下提供大量系统视图,用于查看数据库元数据:
查询时需要具备相应的 DBA 权限或对应对象的查询权限。
2.4 使用 DM 管理工具图形化查看
DM 管理工具提供图形化界面,查看数据库信息更加直观:
图形化方式适合新手用户,操作简单直观。
2.5 通过动态性能视图查看运行状态
动态性能视图以 V$ 开头,反映数据库实时运行状态,常用视图包括:
这些视图数据来自内存,查询实时性高,是性能诊断的重要依据。
三、DM 查看数据库信息的具体操作步骤
3.1 操作流程总览
DM 查看数据库信息的标准操作流程如下图所示,建议按步骤有序执行:
#publish-mermaid-1786945298523-1{font-family:inherit;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#publish-mermaid-1786945298523-1 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#publish-mermaid-1786945298523-1 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#publish-mermaid-1786945298523-1 .error-icon{fill:#552222;}#publish-mermaid-1786945298523-1 .error-text{fill:#552222;stroke:#552222;}#publish-mermaid-1786945298523-1 .edge-thickness-normal{stroke-width:1px;}#publish-mermaid-1786945298523-1 .edge-thickness-thick{stroke-width:3.5px;}#publish-mermaid-1786945298523-1 .edge-pattern-solid{stroke-dasharray:0;}#publish-mermaid-1786945298523-1 .edge-thickness-invisible{stroke-width:0;fill:none;}#publish-mermaid-1786945298523-1 .edge-pattern-dashed{stroke-dasharray:3;}#publish-mermaid-1786945298523-1 .edge-pattern-dotted{stroke-dasharray:2;}#publish-mermaid-1786945298523-1 .marker{fill:#333333;stroke:#333333;}#publish-mermaid-1786945298523-1 .marker.cross{stroke:#333333;}#publish-mermaid-1786945298523-1 svg{font-family:inherit;font-size:16px;}#publish-mermaid-1786945298523-1 p{margin:0;}#publish-mermaid-1786945298523-1 .label{font-family:inherit;color:#333;}#publish-mermaid-1786945298523-1 .cluster-label text{fill:#333;}#publish-mermaid-1786945298523-1 .cluster-label span{color:#333;}#publish-mermaid-1786945298523-1 .cluster-label span p{background-color:transparent;}#publish-mermaid-1786945298523-1 .label text,#publish-mermaid-1786945298523-1 span{fill:#333;color:#333;}#publish-mermaid-1786945298523-1 .node rect,#publish-mermaid-1786945298523-1 .node circle,#publish-mermaid-1786945298523-1 .node ellipse,#publish-mermaid-1786945298523-1 .node polygon,#publish-mermaid-1786945298523-1 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#publish-mermaid-1786945298523-1 .rough-node .label text,#publish-mermaid-1786945298523-1 .node .label text,#publish-mermaid-1786945298523-1 .image-shape .label,#publish-mermaid-1786945298523-1 .icon-shape .label{text-anchor:middle;}#publish-mermaid-1786945298523-1 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#publish-mermaid-1786945298523-1 .rough-node .label,#publish-mermaid-1786945298523-1 .node .label,#publish-mermaid-1786945298523-1 .image-shape .label,#publish-mermaid-1786945298523-1 .icon-shape .label{text-align:center;}#publish-mermaid-1786945298523-1 .node.clickable{cursor:pointer;}#publish-mermaid-1786945298523-1 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#publish-mermaid-1786945298523-1 .arrowheadPath{fill:#333333;}#publish-mermaid-1786945298523-1 .edgePath .path{stroke:#333333;stroke-width:1px;}#publish-mermaid-1786945298523-1 .flowchart-link{stroke:#333333;fill:none;}#publish-mermaid-1786945298523-1 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-1786945298523-1 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#publish-mermaid-1786945298523-1 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-1786945298523-1 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#publish-mermaid-1786945298523-1 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#publish-mermaid-1786945298523-1 .cluster text{fill:#333;}#publish-mermaid-1786945298523-1 .cluster span{color:#333;}#publish-mermaid-1786945298523-1 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:inherit;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#publish-mermaid-1786945298523-1 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#publish-mermaid-1786945298523-1 rect.text{fill:none;stroke-width:0;}#publish-mermaid-1786945298523-1 .icon-shape,#publish-mermaid-1786945298523-1 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#publish-mermaid-1786945298523-1 .icon-shape p,#publish-mermaid-1786945298523-1 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#publish-mermaid-1786945298523-1 .icon-shape .label rect,#publish-mermaid-1786945298523-1 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#publish-mermaid-1786945298523-1 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#publish-mermaid-1786945298523-1 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#publish-mermaid-1786945298523-1 .node .neo-node{stroke:#9370DB;}#publish-mermaid-1786945298523-1 [data-look=\”neo\”].node rect,#publish-mermaid-1786945298523-1 [data-look=\”neo\”].cluster rect,#publish-mermaid-1786945298523-1 [data-look=\”neo\”].node polygon{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1786945298523-1 [data-look=\”neo\”].swimlane.cluster rect{filter:none;}#publish-mermaid-1786945298523-1 [data-look=\”neo\”].node path{stroke:#9370DB;stroke-width:1px;}#publish-mermaid-1786945298523-1 [data-look=\”neo\”].node .outer-path{filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1786945298523-1 [data-look=\”neo\”].node .neo-line path{stroke:#9370DB;filter:none;}#publish-mermaid-1786945298523-1 [data-look=\”neo\”].node circle{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1786945298523-1 [data-look=\”neo\”].node circle .state-start{fill:#000000;}#publish-mermaid-1786945298523-1 [data-look=\”neo\”].icon-shape .icon{fill:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1786945298523-1 [data-look=\”neo\”].icon-shape .icon-neo path{stroke:#9370DB;filter:drop-shadow(1px 2px 2px rgba(185, 185, 185, 1));}#publish-mermaid-1786945298523-1 :root{–mermaid-font-family:inherit;}
连接数据库
验证权限
选择查看对象
执行查询
分析结果
记录与归档
输出巡检报告
3.2 查看数据库基本参数
查看数据库基本参数的步骤如下:
执行结果可帮助判断数据库版本、运行状态及关键参数配置。
3.3 查看表空间信息
查看表空间信息的具体步骤如下:
SELECT t.tablespace_name,
ROUND(SUM(d.bytes) / 1024 / 1024, 2) AS total_mb,
ROUND(SUM(d.bytes) / 1024 / 1024 – SUM(f.bytes) / 1024 / 1024, 2) AS used_mb,
ROUND((1 – SUM(f.bytes) / SUM(d.bytes)) * 100, 2) AS used_pct
FROM dba_tablespaces t,
dba_data_files d,
(SELECT tablespace_name, SUM(bytes) bytes FROM dba_free_space GROUP BY tablespace_name) f
WHERE t.tablespace_name = d.tablespace_name
AND d.tablespace_name = f.tablespace_name
GROUP BY t.tablespace_name;
通过上述查询可全面了解表空间使用情况,为容量规划提供依据。
3.4 查看用户与权限信息
查看用户与权限信息的步骤如下:
权限信息查看是数据库安全审计的重要环节。
3.5 查看会话与锁信息
查看会话与锁信息的步骤如下:
通过分析会话和锁信息,可有效定位性能瓶颈和死锁问题。
3.6 查看版本与字符集信息
查看版本与字符集信息步骤如下:
版本与字符集信息在数据库迁移、应用兼容性测试中尤为重要。
四、常见问题与优化建议
4.1 查看权限不足问题
当查询系统视图时出现 "无权限" 错误,可采取以下解决方案:
权限管理应遵循最小化原则,避免过度授权。
4.2 查询性能优化
查看数据库信息时,部分视图查询可能较慢,优化建议如下:
4.3 信息查看的注意事项
进行 DM 查看数据库信息时,应注意以下几点: