db2 command list(二)
log
取消已编目的数据库btpdbs
$ db2 uncatalog db btpdbs
查看版本
# db2level
显示当前数据库管理实例
$ db2 get instance
设置实例
系统启动时是否自动启动。
$ db2iauto -on 自动启动
$ db2iauto -off 不自动启动
数据库优化命令:
reorg、runstats
当数据库经过一段时间使用,数据空间会变得越来越庞大。一些delete掉
的数据仍存放在数据库中,占用数据空间,影响系统性能。因此需要定期
运行reorg、runstats命令,清除已delete的数据,优化数据结构。
db2 reorg table 表名
db2 runstats on table 表名 with distribution and indexes all
因为要优化的表比较多,所以在/btp/bin目录下提供了一个sh程序runsall,
可在当天业务结束后,运行runsall,对数据库进行优化