连接数据库实例
db2 connect to database_name
显示表空间详情
db2 list tablespaces show detail
获取数据库实例配置
db2 get db cfg for sample
监控表空间情况
db2pd -d sample -tablespaces
设置兼容ORACLE(需重启)
db2set DB2_COMPATIBILITY_VECTOR=ORA
强制关闭
db2stop force
启动
db2start
强制关闭session(解锁)
db2 "force application (11348)"
查看锁表详情
1. db2pd -db lopdb -locks show detail
2. SELECT * FROM TABLE (SNAP_GET_LOCK ('', -1)) AS T WHERE lock_object_type = 'TABLE_LOCK'
设置事务日志文件大小
db2 update db cfg for lopdb using LOGFILSIZ 4096
设置事务日志文件主文件个数
db2 update db cfg for lopdb using LOGPRIMARY 220
设置事务日志文件辅文件个数
db2 update db cfg for lopdb using LOGSECOND 20
事务日志最大大小计算
LOGFILSIZ * (LOGPRIMARY + LOGSECOND)
创建大文件缓冲池
create BUFFERPOOL slopbuff SIZE 5000 PAGESIZE 32K
使用大文件缓冲池创建表空间
CREATE TABLESPACE sloptablespace PAGESIZE 32K BUFFERPOOL slopbuff
显示应用详情
db2 list applications show detail | grep 11348
获取数据库实例配置参数
db2 get dbm cfg
--
db2 update dbm cfg using SYSMON_GROUP {group_name}
db2 grant connect on database to user lvkc_01
重命名表名
db2 rename SLOP_BIZ.T_LOP_OI to T_LOP_OI_20200610
db2 update db cfg for lopdb using STMTHEAP 8192 AUTOMATIC
查看服务名
db2 get dbm cfg|grep SVC
查看端口号
tail -10 /etc/services|grep DB2_db2inst2
--netstat -lnp | grep 50000
设置表无事务日志记录
alter table SLOP_BIZ.t_md_oi_20200701 activate not logged initially;