- 设置instance的自动启停
https://www.ibm.com/docs/en/db2/9.7?topic=instances-auto-starting
$ sudo su -
# source /home/db2inst1/sqllib/db2profile
# db2iauto -on <instance name>
# db2iauto -off <instance name>
可以使用$ db2set
命令查看当前设置值。
$ db2set
DB2AUTOSTART=YES
- 设置DB2 fault monitor controller
因为DB2 instance的自动启停,依赖于DB2 fault monitor controller
https://www.ibm.com/docs/en/db2/9.7?topic=monitor-using-db2fmcu-system-commands
$ sudo su -
# source /home/db2inst1/sqllib/db2profile
# db2fmcu -u -p /opt/ibm/db2/V9.7/bin/db2fmcd #<fullpath>
# db2fm -U # Brings the fault monitor daemon up
# db2fm -f on # Turns fault monitor on or off
# db2fm -s # Returns the status of the service
# db2fm -S # Returns the status of the fault monitor daemon
...
# db2fm -i <db2inst> ...
- 如果DB2 fmc不起作用
https://www.ibm.com/support/pages/db2-autostart-not-supported-red-hat-enterprise-linux-version-7
Q: Why does DB2 not autostart on Red Hat Enterprise Linux 7 ?
A: In Red Hat Enterprise Linux 7, systemd replaces upstart as the default init system. The DB2 fault monitor does not support the systemd init system.
$ cat /etc/systemd/system/db2fmcd.service
[Unit]
Description=DB2V97
[Service]
ExecStart=/opt/ibm/db2/V9.7/bin/db2fmcd
Restart=always
KillMode=process
KillSignal=SIGHUP
[Install]
WantedBy=default.target
$ sudo systemctl enable db2fmcd
$ sudo systemctl start db2fmcd
- 检查db2 instance状态
下列三个命令中的任何一个均可:
$ ps -ef|grep db2sysc
$ sudo su - db2inst1 -c "db2pd -"
$ sudo su - db2inst1 -c "db2_local_ps"
检查FMC Daemon状态:
$ sudo su - -c "/opt/ibm/db2/V9.7/bin/db2fmcu"
FMC: up: PID = <PID>
检查Fault Monitor状态:
$ sudo su - db2inst1 -c "db2fm -s -S"
Gcf module 'fault monitor' state is AVAILABLE
Gcf module '/opt/ibm/db2/V9.7/lib64/libdb2gcf.so' state is AVAILABLE
网友评论