查看db2版本 db2 => select * from sysibm.sysversions 列出所有实例 [db2inst1@xifenfei ~]$ db2ilist db2inst1 列出当前实例 [db2inst1@xifenfei ~]$ db2 get instance The current database manager instance is: db2inst1 察看示例配置文件 [db2inst1@xifenfei ~]$ db2 get dbm cfg|more 察看数据库配置参数信息 [db2inst1@xifenfei ~]$ db2 get db cfg for TOOLSDB|more 列出所有表空间的详细信息 [db2inst1@xifenfei ~]$ db2 list tablespaces show detail|more 连接数据库 [db2inst1@xifenfei ~]$ db2 connect to TOOLSDB Database Connection Information Database server = DB2/LINUX 9.7.4 SQL authorization ID = DB2INST1 Local database alias = TOOLSDB sql操作数据库 [db2inst1@xifenfei ~]$ db2 "select * from t_xff" 查看端口号 [db2inst1@xifenfei ~]$ db2 get dbm cfg|grep SVCENAME 查看表结构 [db2inst1@xifenfei ~]$ db2 describe table t_xifenfei 查看某个表索引 [db2inst1@xifenfei ~]$ db2 describe indexes for table t_xff 显示当前活动数据库 [db2inst1@xifenfei ~]$ db2 list active databases 列出所有的系统表 [db2inst1@xifenfei ~]$ db2 list tables for system 列出表空间 [db2inst1@xifenfei ~]$ db2 list tablespaces 显示用户数据库的存取权限 [db2inst1@xifenfei ~]$ db2 GET AUTHORIZATIONS 检查 DB2 数据库管理程序配置 [db2inst1@xifenfei ~]$ db2 get dbm cfg