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
[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 "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