db2 v11在redhat7上安装

发布时间:2020-08-05 16:48:03 作者:18620626259
来源:网络 阅读:1054

1、设置主机名和修改/etc/hosts一致
hostnamectl --static set-hostname db2v11

2、安装操作系统依赖包
yum  install  libstdc++.so.6


3、解压包并安装
./db2_deinstall
安装目录,选择推荐目录即可(可以修改目录,如果不修改/预留大小为6G)
Enter "help" to redisplay product names. --------------- 选择安装产品类型,这里选择SERVER
Do you want to install the DB2 pureScale Feature? [yes/no] ---------------- 选择是否安装pureScale功能,这里选择不安装


4、安装完后初始化
groupadd db2iadm1                   
groupadd db2fadm1                                         
useradd db2inst1 -G db2iadm1          
useradd db2fenc1 -G db2fadm1       
cd /opt/ibm/db2/V11.1/instance/                   
./db2icrt -a server -p 50000 -u db2fenc1 db2inst1  

5、激活license                                       
以下操作全部以db2inst1用户执行查看license信息                                   
db2licm -l                                   
license激活                                   
db2licm -a /usr/local/src/db2ese_c.lic
   
6、修改实例

a、修改db2nodes.cfg(可选)位置在instance用户的$HOME/sqllib/.文件格式是:
<logic port> <hostname> <logic port>   //主机名要与/etc/hosts 的主机名一致 或hostname命令查看


(2)  检查services文件(多节点配置自动生成多个服务端口)
vi  /etc/services 
DB2c_db2inst1   50000/tcp  // 要与dbm SVCENAME一致
 
(3) 启动实例: 
配置环境变量  --root用户和db2inst1用户
# vi ~/.bash_profile
$ vi ~/.bash_profile
./home/db2inst1/sqllib/db2profile  # 增加该行代码
# source ~/.bash_profile
$ source ~/.bash_profile

设置服务名称
$ db2 update dbm cfg using SVCENAME db2inst1
设置注册变量
$ db2set DB2COMM=tcpip
启动实例
$ db2start

7、创建数据库
[root@localhost ~]# su - db2inst1
[db2inst1@localhost ~]$ cd /opt/ibm/db2/V9.7/bin
[db2inst1@localhost bin]$ ./db2sampl


8、调整数据库参数
db2set DB2_PARALLEL_IO=*
db2set DB2_SKIPINSERTED=YES
db2set DB2_USE_ALTERNATE_PAGE_CLEANING=YES
db2set DB2_EVALUNCOMMITTED=YES
db2set DB2_ANTIJOIN=EXTEND
db2set DB2_SKIPDELETED=YES
db2set DB2CODEPAGE=1208
 
db2 update dbm cfg using DFT_MON_BUFPOOL   on

db2 update dbm cfg using DFT_MON_LOCK   on
    
db2 update dbm cfg using DFT_MON_SORT   on
 
db2 update dbm cfg using DFT_MON_STMT   on
 
db2 update dbm cfg using DFT_MON_TABLE   on
   
db2 update dbm cfg using DFT_MON_TIMESTAMP   on
    
db2 update dbm cfg using DFT_MON_UOW   on

[db2inst1@db2v11 ~]$ db2 get dbm cfg |grep -i mon
 Transaction processor monitor name        (TP_MON_NAME) =
 Default database monitor switches
   Buffer pool                         (DFT_MON_BUFPOOL) = OFF
   Lock                                   (DFT_MON_LOCK) = OFF
   Sort                                   (DFT_MON_SORT) = OFF
   Statement                              (DFT_MON_STMT) = OFF
   Table                                 (DFT_MON_TABLE) = OFF
   Timestamp                         (DFT_MON_TIMESTAMP) = ON
   Unit of work                            (DFT_MON_UOW) = OFF
 Monitor health of instance and databases   (HEALTH_MON) = OFF
 SYSMON group name                        (SYSMON_GROUP) =
 Database monitor heap size (4KB)          (MON_HEAP_SZ) = AUTOMATIC(90)
 
授权
db2 get dbm cfg |grep -i sysmon
groupadd db2user
db2 update dbm cfg using SYSMON_GROUP db2user
db2 attach to db2inst1
db2 force applications all
db2stop force

db2 get dbm cfg |grep -i sysmon
useradd -g db2user  -d /home/dpmmon  -s /bin/bash -m  dpmmon

su  - db2inst1

db2 connet to 数据库

db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_SERVICE_SUBCLASS TO user dpmmon"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_TABLESPACE TO user dpmmon"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_CONTAINER TO user dpmmon"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_PKG_CACHE_STMT TO user dpmmon"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_BUFFERPOOL TO user dpmmon"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.ENV_GET_SYSTEM_RESOURCES TO user dpmmon"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.ENV_GET_DB2_SYSTEM_RESOURCES TO USER dpmmon"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.ENV_GET_NETWORK_RESOURCES TO user dpmmon"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_CONNECTION TO user dpmmon"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_TABLE TO user dpmmon"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_LOCKS TO user dpmmon"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_ACTIVITY TO user dpmmon"
db2 "GRANT SELECT ON TABLE SYSIBMADM.MON_BP_UTILIZATION TO user dpmmon"
db2 "GRANT SELECT ON TABLE SYSIBMADM.MON_BP_UTILIZATION TO user dpmmon"
db2 "GRANT SELECT ON TABLE SYSIBMADM.MON_LOCKWAITS TO user dpmmon"
db2 "grant sqladm on database to user dpmmon"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_FORMAT_LOCK_NAME TO user dpmmon"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_SERVICE_SUBCLASS TO user dpmmon"
db2 "GRANT SELECT ON TABLE SYSIBMADM.SNAPDB TO user dpmmon"
db2 "GRANT SELECT ON TABLE SYSIBMADM.SNAPDB_MEMORY_POOL TO user dpmmon"
db2 "GRANT SELECT ON TABLE SYSIBMADM.MON_LOCKWAITS TO user dpmmon"
db2 "GRANT SELECT ON TABLE SYSIBMADM.SNAPDBM TO user dpmmon"
db2 "GRANT SELECT ON TABLE SYSIBMADM.ENV_INST_INFO TO user dpmmon"
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.SNAP_GET_HADR TO user dpmmon"---需要在配置hadr上配置
db2 "GRANT EXECUTE ON FUNCTION SYSPROC.MON_GET_SYSTEM_RESOURCES TO user dpmmon"-----报错,可忽略

su   -  dpmmon

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

db2 connect to sample
/home/db2inst1/sqllib/misc
db2 -tvf EXPLAIN.DDL
[dpmmon@db2v11 misc]$ db2 list  tables
Table/View                      Schema          Type  Creation time            
------------------------------- --------------- ----- --------------------------
ADVISE_INDEX                    DPMMON          T     2018-12-30-18.01.12.076928
ADVISE_INSTANCE                 DPMMON          T     2018-12-30-18.01.11.780594
ADVISE_MQT                      DPMMON          T     2018-12-30-18.01.12.737807
ADVISE_PARTITION                DPMMON          T     2018-12-30-18.01.13.200973
ADVISE_TABLE                    DPMMON          T     2018-12-30-18.01.13.707483
ADVISE_WORKLOAD                 DPMMON          T     2018-12-30-18.01.12.454300
EXPLAIN_ACTUALS                 DPMMON          T     2018-12-30-18.01.16.561204
EXPLAIN_ARGUMENT                DPMMON          T     2018-12-30-18.01.08.940831
EXPLAIN_DIAGNOSTIC              DPMMON          T     2018-12-30-18.01.10.379307
EXPLAIN_DIAGNOSTIC_DATA         DPMMON          T     2018-12-30-18.01.10.858547
EXPLAIN_INSTANCE                DPMMON          T     2018-12-30-18.01.07.627235
EXPLAIN_OBJECT                  DPMMON          T     2018-12-30-18.01.09.203827
EXPLAIN_OPERATOR                DPMMON          T     2018-12-30-18.01.09.322018
EXPLAIN_PREDICATE               DPMMON          T     2018-12-30-18.01.09.593889
EXPLAIN_STATEMENT               DPMMON          T     2018-12-30-18.01.08.443878
EXPLAIN_STREAM                  DPMMON          T     2018-12-30-18.01.09.938834
OBJECT_METRICS                  DPMMON          T     2018-12-30-18.01.11.477921


推荐阅读:
  1. db2 v10安装
  2. DB2 Zos 浅谈 - DB2 LUW VS DB2 Zos

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

db2 v11 redhat7

上一篇:Python2爬虫中Urllib的使用方法

下一篇:关于Python3爬虫中HTTP的基本原理分析

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》