Jcat
宠辱不惊,闲看庭前花开花落~~
posts - 173,comments - 67,trackbacks - 0
列出所有实例
[db2inst1@dcm ~]$ db2ilist
db2inst1

列出当前实例下的所有数据库

[db2inst1@dcm ~]$ db2 list db directory

 System Database Directory

 Number of entries in the directory = 1

Database 1 entry:

 Database alias                       = SAMPLE
 Database name                        = SAMPLE
 Local database directory             = /home/db2inst1
 Database release level               = d.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            =
 Alternate server port number         =

启动实例
[db2inst1@dcm ~]$ db2start
07/09/2010 14:24:36     0   0   SQL1063N  DB2START processing was successful.
SQL1063N  DB2START processing was successful.

连接到数据库
[db2inst1@dcm ~]$ db2 connect to sample

   Database Connection Information

 Database server        = DB2/LINUX 9.7.1
 SQL authorization ID   = DB2INST1
 Local database alias   = SAMPLE

执行SQL
[db2inst1@dcm ~]$ db2
db2 => select * from staff where dept=20

ID     NAME      DEPT   JOB   YEARS  SALARY    COMM     
------ --------- ------ ----- ------ --------- ---------
    10 Sanders       20 Mgr        7  98357.50         -
    20 Pernal        20 Sales      8  78171.25    612.45
    80 James         20 Clerk      -  43504.60    128.20
   190 Sneider       20 Clerk      8  34252.75    126.50

  4 record(s) selected.

退出
db2 => quit
DB20000I  The QUIT command completed successfully.

断开连接(不断开就不能db2stop)
[db2inst1@dcm ~]$ db2 connect reset
DB20000I  The SQL command completed successfully.

关闭实例
[db2inst1@dcm ~]$ db2stop
07/09/2010 14:29:32     0   0   SQL1064N  DB2STOP processing was successful.
SQL1064N  DB2STOP processing was successful.

posted on 2010-07-09 14:32 Jcat 阅读(237) 评论(0)  编辑  收藏 所属分类: Database

只有注册用户登录后才能发表评论。


网站导航: