程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle數據庫基礎 >> DB2常用命令大全

DB2常用命令大全

編輯:Oracle數據庫基礎
 

連接數據庫:



connect to [數據庫名]user [操作用戶名]using [密碼]



創建緩沖池(8K):



create bufferpool ibmdefault8k IMMEDIATE SIZE 5000 PAGESIZE 8K ;

創建緩沖池(16K)(OA_DIVERTASKRECORD):

create bufferpool ibmdefault16k IMMEDIATE SIZE 5000 PAGESIZE16 K ;

創建緩沖池(32K)(OA_TASK):

create bufferpool ibmdefault32k IMMEDIATE SIZE 5000 PAGESIZE32 K ;



創建表空間:



CREATE TABLESPACE exoatbs IN DATABASE PARTITION GROUPIBMDEFAULTGROUP PAGESIZE 8K MANAGED BY SYSTEM USING('/home/exoa2/exoacontainer') EXTENTSIZE 32 PREFETCHSIZE16 BUFFERPOOL IBMDEFAULT8K OVERHEAD 24.10 TRANSFERRATE0.90 DROPPED TABLE RECOVERY OFF;



CREATE TABLESPACE exoatbs16k IN DATABASE PARTITION GROUPIBMDEFAULTGROUP PAGESIZE 16K MANAGED BY SYSTEM USING('/home/exoa2/exoacontainer16k' ) EXTENTSIZE32 PREFETCHSIZE 16 BUFFERPOOL IBMDEFAULT16K OVERHEAD 24.1 TRANSFERRATE 0.90 DROPPED TABLE RECOVERYOFF;



CREATE TABLESPACE exoatbs32k IN DATABASE PARTITION GROUPIBMDEFAULTGROUP PAGESIZE 32K MANAGED BY SYSTEM USING('/home/exoa2/exoacontainer32k' ) EXTENTSIZE32 PREFETCHSIZE 16 BUFFERPOOL IBMDEFAULT32K OVERHEAD 24.1 TRANSFERRATE 0.90 DROPPED TABLE RECOVERYOFF;



GRANT USE OF TABLESPACE exoatbs TO PUBLIC;

GRANT USE OF TABLESPACE exoatbs16k TO PUBLIC;

GRANT USE OF TABLESPACE exoatbs32k TO PUBLIC;



創建系統表空間:



CREATE TEMPORARY TABLESPACE exoasystmp IN DATABASE PARTITION GROUPIBMTEMPGROUP PAGESIZE 8K MANAGED BY SYSTEM USING('/home/exoa2/exoasystmp' ) EXTENTSIZE 32PREFETCHSIZE 16 BUFFERPOOL IBMDEFAULT8K OVERHEAD 24.10TRANSFERRATE 0.90 DROPPED TABLE RECOVERY OFF;



CREATE TEMPORARY TABLESPACE exoasystmp16k IN DATABASE PARTITIONGROUP IBMTEMPGROUP PAGESIZE 16K MANAGED BY SYSTEM USING('/home/exoa2/exoasystmp16k' ) EXTENTSIZE 32PREFETCHSIZE 16 BUFFERPOOL IBMDEFAULT16K OVERHEAD 24.10TRANSFERRATE 0.90 DROPPED TABLE RECOVERY OFF;



CREATE TEMPORARY TABLESPACE exoasystmp32k IN DATABASE PARTITIONGROUP IBMTEMPGROUP PAGESIZE 32K MANAGED BY SYSTEM USING('/home/exoa2/exoasystmp32k') EXTENTSIZE 32 PREFETCHSIZE 16BUFFERPOOL IBMDEFAULT32K OVERHEAD 24.10 TRANSFERRATE 0.90 DROPPED TABLE RECOVERY OFF;



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 serverserver_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  

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved