1、显示当前实例
>> get instance The current database manager instance is: db2axing
2、列出当前实例中激活的数据库
>> list active databases Active Databases
Database name =LAISDB
Applications connected currently = 529
Database path =/db2/laisdb/db2axing/NODE0000/SQL00001/MEMBER0000/ Database name =WEBUAT
Applications connected currently = 2
Database path =/db2/laisdb/db2axing/NODE0000/SQL00001/MEMBER0000/
3、连接数据库
>> connect to db2axing Database Connection Information Database server = DB2/AIX64 10.5.8
SQL authorization ID = WEBUAT
Local database alias = WEBUAT
4、查看数据库中所有的表
>> list tables Table/View Schema Type Creation time
------------------------------- --------------- ----- --------------------------
ACT DB2INST1 T 2012-01-17-09.38.24.314033
ADEFUSR DB2INST1 S 2012-01-17-09.38.30.953823
CATALOG DB2INST1 T 2012-01-17-09.38.45.758734
CL_SCHED DB2INST1 T 2012-01-17-09.38.17.264534
CUSTOMER DB2INST1 T 2012-01-17-09.38.42.650735
DEPARTMENT DB2INST1 T 2012-01-17-09.38.17.922386
DEPT DB2INST1 A 2012-01-17-09.38.19.113115
EMP DB2INST1 A 2012-01-17-09.38.20.001560
EMPACT DB2INST1 A 2012-01-17-09.38.24.312415
EMPLOYEE DB2INST1 T 2012-01-17-09.38.19.114152
EMPLOYEES DB2INST1 T 2012-01-31-12.29.59.242048
EMPLOYEESBCK DB2INST1 T 2012-01-31-12.30.01.379628
-------------------
5、db2信息查询命令
>> db2 list tables #列出所有表名
>> db2 describe table 表名 #显示表字段
>> db2 list db directory #列出该用户创建的所有数据库名
>> db2 list tablespaces show detail #查看当前数据库表空间分配状况
>> db2 list application
>> db2 list db directory 列出所有数据库
>> db2 list active databases 列出所有活动的数据库
>> db2 list tables for all 列出当前数据库下所有的表
>> db2 list tables for schema btp 列出当前数据库中schema为btp的表
>> db2 list tablespaces show detail 显示数据库空间使用情况
>> db2 list packages for all
显示当前的实例
1 2 3 | [db2inst1@localhost ~]$ db2 get instance The current database manager instance is : db2inst1 |