当前位置: 首页 > news >正文

IBM Db2 笔记

目录

  • 1. IBM Db2 笔记
    • 1.1. 常用命令
    • 1.2. 登录命令行模式 (Using the Db2 command line processor)
    • 1.3. issue
      • 1.3.1. `db2: command not found`/`SQL10007N Message "-1390" could not be retreived. Reason code: "3".`
      • 1.3.2. db2 修改 dbm cfg 的时候报 SQL5001N 错误分析以解决方法
    • 1.4. DB2 ODBC/CLI driver
    • 1.5. docker
    • 1.6. monitor/observability

1. IBM Db2 笔记

1.1. 常用命令

db2 list db directory
db2 connect to SAMPLE
db2 "select substr(bpname,1,12) as bpname from syscat.bufferpools"

1.2. 登录命令行模式 (Using the Db2 command line processor)

# 输入进入命令
db2# 进入后
db2 => connect to testdb

更多见: Tutorial: Using the Db2 command line processor

1.3. issue

1.3.1. db2: command not found/SQL10007N Message "-1390" could not be retreived. Reason code: "3".

  • Setting Up A Command Line to Run Db2 Commands: Linux or UNIX – Sourcing the Db2 Profile

If you have access to the instance owning id, login and issue:

echo $INSTHOME

On the server, try this:

cat /etc/passwd |grep db2inst1

Look at the instance owner’s .profile, .bash_profile, and .bashrc to find the lines automatically added by Db2 on installation

Once you have the correct location, you can substitute it in to the lines above in the .profile, .bash_profile, and/or the .bashrc of every user who wants to execute Db2 commands:

if [ -f /db2home/db2inst1/sqllib/db2profile ]; then. /db2home/db2inst1/sqllib/db2profile
fi

直接用命令: source /db2home/db2inst1/sqllib/db2profile

  • Setting Up A Command Line to Run Db2 Commands: Windows

使用下列程序: db2cmd.exe db2cmdadmin.exe

Powershell: set-item -path env:DB2CLP -value "**$$**"

1.3.2. db2 修改 dbm cfg 的时候报 SQL5001N 错误分析以解决方法

本人今天使用 update 更新 dbm cfg 时候出现了 SQL5001N 错误, 那么就简单的分析一下并给出解决方法:

操作命令: db2 update dbm cfg using DFT_MON_STMT on

报错信息: SQL5001N "KEVIN" does not have the authority to change the database manager configuration file.

kevin 是我的 db2 数据库用户名字, 明显是 kevin 用户没有被授权修改 dbm 配置

首先介绍一下最基础的东西:

实例级权限:

  • SYSADM 最高管理权限, 通常供 DBA 使用
  • SYSCTRL 最高系统控制权限, 有 SYSMAINT 和 SYSMON 的全部权限
  • SYSMAINT 次级系统 控制权限
  • SYSMON 最小的实例级管理权限

Unix/Linux 下的查看命令:

db2 get dbm cfg|grep "SYSADM"
db2 get dbm cfg|grep "SYSCTRL"
db2 get dbm cfg|grep "SYSMAINT"db2 get dbm cfg|grep "SYSMON"

知道了上面的知识, 那么就知道修改 dbm cfg 需要有最高权限 sysadm,

那么在我的终端是用 db2 get dbm cfg | grep SYSADM

SYSADM group name                        (SYSADM_GROUP) = DB2IADM1

知道只有在组 DB2IADM1 下才有权限去执行, 那么我的示例用户是 db2inst1,

那么终端使用命令 id db2inst1

uid=801(db2inst1) gid=901(db2iadm1)=901(db2iadm1),903(db2dadm1)

很明显使用 db2inst1 用户就可以执行 dbm cfg 更新了

然后使用 su 命令切换到 db2inst1 用户下: su - db2inst1

最后再次使用命令: db2 update dbm cfg using DFT_MON_STMT on

DB20000I  The UPDATE DATABASE MANAGER CONFIGURATION command completed  successfully.

1.4. DB2 ODBC/CLI driver

IBM site

1.5. docker

https://hub.docker.com/r/ibmcom/db2

  • 默认用户名: db2inst1
  • 默认数据库: testdb

1.6. monitor/observability

IBM Db2

http://www.lryc.cn/news/140907.html

相关文章:

  • 【Cortex-M3权威指南】学习笔记2 - 指令集
  • Java——一个Java实体类,表示一个试题的模型
  • PHP8函数的引用和取消-PHP8知识详解
  • 华为OD机试真题【最大利润】
  • YOLOv5+deepsort实现目标追踪。(附有各种错误解决办法)
  • java.8 - java -overrideoverload 重写和重载
  • oracle通配符大全
  • 浏览器开发者工具平台js代码开启展开收起
  • opencv 案例实战01-停车场车牌识别实战
  • 【PHP】PHP开发教程-PHP开发环境安装
  • AURIX TriCore内核架构学习笔记
  • VMware ESXi 7.0 优化VMFSL磁盘占用与系统存储大小
  • 4.网络设计与redis、memcached、nginx组件(二)
  • 后端开发有哪几种语言? - 易智编译EaseEditing
  • Spring 学习源码的基础 核心原理与核心概念
  • cpolar做一个内网穿透
  • 自动驾驶——最优控制算法(LQR)工程化总结
  • 【微服务】05-网关与BFF(Backend For Frontend)
  • 保证MQ的高可用的几种方案
  • MySql013——函数
  • k8s-dashboard使用指导手册
  • Python爬虫快速入门指南
  • Java人脸识别技术探索与实践
  • 【鞋服零售ERP】之要货申请单设计思路
  • EWM怎么取消pinking,SAP_EWM取消拣配报错处理方式
  • TensorFlow 的基本概念和使用场景
  • openssl 加密(encrypt)、解密(decrypt)、签名(sign)、验证(verify)
  • 视频云存储/安防监控视频AI智能分析网关V3:抽烟/打电话功能详解
  • 新版Jadx 加载dex报错 jadx.plugins.input.dex.DexException:Bad checksum 解决方法
  • win11+vmware17+centos7.9环境搭建