1. 程式人生 > >Linux下DB2指令總結

Linux下DB2指令總結

scribe employ art oat ble localhost container usr ffffff

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

Linux下DB2指令總結