列出所有實例
[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 閱讀(254)
評論(0) 編輯 收藏 所屬分類:
Database