啟動資料庫:
啟動db2服務:db2start
啟用資料庫例項:db2 activate database
檢視啟用狀態的資料庫:db2 list active databases
關閉資料庫:
失效資料庫例項:db2 deactivate database
關閉資料庫服務:db2stop
檢視資料庫:db2 list db directory
檢視資料庫表空間:db2pd -db -tablespace
檢視資料庫配置:db2 get db cfg for
連線資料庫:db2 connect to
db2 connect to user[user_name] using [password]
斷開資料庫連線:db2 connect reset/db2 terminate
建立資料庫:db2 create db
刪除資料庫:db2 drop database (如果不能刪除,嘗試斷開啟用的連線或者重啟db2)
列出系統表:db2 list tables for system
列出所有使用者表:db2 list tables
列出所有表:db2 list tables for all
列出特定使用者表:db2 list tables for schema [user]
複製一張表:db2 create table t1 like t2
顯示表結構:db2 describe table tablename
查詢表:db2 「select * from table tablename where …」
執行sql指令碼:db2 -tvf scripts.sql
檢視錯誤**資訊:
db2 ? 10054
停止啟用的連線:
檢視死鎖:
db2 get snapshot for locks on
db2 「select agent_id,tabname,lock_mode from table(snap_get_lock(『』)) as aa」
殺掉程序:
監控db2消耗多的sql語句:
eg:(db_name=sundb)
設定連線方式(重啟才會生效):
db2set db2comm=tcpip
db2set db2comm=
DB2常用命令
常用操作 db2 list db directory db2 connect to user using db2ilist 顯示當前例項名 db2 list tables 顯示當前例項下的所有表 db2 list tablespaces 顯示表空間 db2pd db tablespaces 檢視表空...
DB2常用命令
1 db2 list node directory 2 db2 list node directory show detail 3 db2 catalog tcpip node wsii remote 9.181.139.155 server 50000 4 db2 catalog database...
DB2常用命令
例項 clp 命令描述 db2start 啟動資料庫管理器例項。db2stop 停止資料庫管理器例項。get dbm cfg 返回資料庫管理器配置設定。get dbm cfg show detail 顯示資料庫管理器引數的當前值和延遲值 從 v8 起 1update dbm cfg using 將資...