DB2上機操作指令指南時間:


1. 啓動實例(db2inst1):

db2start

2. 停止實例(db2inst1):

db2stop

3. 列出所有實例(db2inst1)

db2ilist

5.列出當前實例:

db2 get instance

4. 察看示例配置文件:

db2 get dbm cfg|more

5. 更新數據庫管理器參數信息:

db2 update dbm cfg using para_name para_value

6. 創建數據庫:

db2 create db test

7. 察看數據庫配置參數信息

db2 get db cfg for test|more

8. 更新數據庫參數配置信息

db2 update db cfg for test using para_name para_value

10.刪除數據庫:

db2 drop db test

11.連接數據庫

db2 connect to test

12.列出所有表空間的詳細信息。

db2 list tablespaces show detail

13.查詢數據:

db2 select * from tb1

14.數據:

db2 delete from tb1 where id=1

15.創建索引:

db2 create index idx1 on tb1(id);

16.創建視圖:

db2 create view view1 as select id from tb1

17.查詢視圖:

db2 select * from view1

18.節點編目

db2 catalog tcp node node_name remote server_ip server server_port

19.察看端口號

db2 get dbm cfg|grep SVCENAME

20.測試節點的附接

db2 attach to node_name

21.察看本地節點

db2 list node direcotry

22.節點反編目

db2 uncatalog node node_name

23.數據庫編目

db2 catalog db db_name as db_alias at node node_name

24.察看數據庫的編目

db2 list db directory

25.連接數據庫

db2 connect to db_alias user user_name using user_password

26.數據庫反編目

db2 uncatalog db db_alias

27.導出數據

db2 export to myfile of ixf messages msg select * from tb1

28.導入數據

db2 import from myfile of ixf messages msg replace into tb1

29.導出數據庫的所有表數據

db2move test export

30.生成數據庫的定義

db2look -d db_alias -a -e -m -l -x -f -o db2look.sql

31.創建數據庫

db2 create db test1

32.生成定義

db2 -tvf db2look.sql

33.導入數據庫所有的數據

db2move db_alias import

34.重組檢查

db2 reorgchk

35.重組表tb1

db2 reorg table tb1

36.更新統計信息

db2 runstats on table tb1

37.備份數據庫test

db2 backup db test

38.恢復數據庫test

db2 restore db test

399/.列出容器的信息

db2 list tablespace containers for tbs_id show detail

40.創建表:

db2 ceate table tb1(id integer not null,name char(10))

41.列出所有表

db2 list tables

42.插入數據:

db2 insert into tb1 values(1,’sam’);

db2 insert into tb2 values(2,’smitty’);

本文來自編程入門網:http://www.bianceng.cn/database/db2/200706/2279.htm

發佈了30 篇原創文章 · 獲贊 13 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章