DB2常用命令學習筆記

2021-04-09 02:26:49 字數 2948 閱讀 5323

1、連線遠端db2伺服器

圖形介面:控制中心

注意:預設安裝db2的服務名稱為db2c_db2

使用tcp/ip協議連線時埠50000

命令:uncatalog node testcatalog tcpip node test remote toone-1eb06fba5 server db2c_db2 remote_instance

db2 system  toone-1eb06fba5 ostype  win

test 節點名稱

toone-1eb06fba5  遠端伺服器名稱

db2c_db2 為服務名

db2 例項名稱

2、啟動db2資料庫

db2start

3、備份資料庫

backup database命令。

例項:--連線資料庫

connect to jminnet;

--停頓資料庫

quiesce database immediate force connections;

--斷開連線

connect reset;

--備份

backup database jminnet to "d:/2005-10-12備份/" with 1 buffers buffer 1024 paralleli** 1 without

prompting;

--連線資料庫

connect to jminnet;

--取消停頓

unquiesce database;

--斷開連線

connect reset;

4、常用命令,參看ibm開發**

connect to

[ [user ] using ]

遠端例項連線。

資料庫create database 建立名為 的資料庫。

activate database 顯式地啟用資料庫。

deactivate database 顯式地使資料庫失效。

connect to

[ [user ] using ]  根據需要,顯式地以使用者 和密碼 與資料庫 連

接。 1update dbm cfg using 將資料庫管理器配置引數 更新為值 。

connect reset 斷開與當前資料庫的連線。

get db cfg show detail 顯示資料庫配置引數的當前值和延遲值(僅適用於 v8)。

get db cfg for 返回資料庫 的資料庫配置設定。

update db cfg for using 將資料庫 的資料庫配置引數 更新為值 。

list tables[for ][show detail] 列出資料庫中的表。如果

沒有指定任何引數,則預設情況是列出當前使用者的表。

describe table 顯示乙個表或檢視的列資訊。

list tablespaces [show detail] 顯示表空間的標識、名稱、型別、內容和狀態。

list tablespace containers for [show detail] 顯示用 指定的表空間

的容器資訊。

quiesce tablespaces for table reset 將表空間的狀態復位成正常(normal)。

連線性catalog [admin] node … 為協議 在節點目錄中建立一項。

list [admin] node directory 返回節點目錄的內容。

catalog database … 為資料庫 在資料庫目錄中建立一項。

list database directory [on ] 返回資料庫目錄的內容。

效能get monitor switches 返回會話監控開關的狀態。

update monitor switches using 為 設定會話監控開關的狀態。

reset monitor all 復位效能監控程式值。

get snapshot for dbm 返回例項級別的效能資訊。

get snapshot for all on 為資料庫 在資料庫級別返回所有效能資訊。

get snapshot for dynamic sql on 返回動態 sql 快取記憶體的內容。

runstats on table .收集表 的統計資訊。表名必須是用 全限定

的。 reorgchk on table all 確定是否需要對錶進行重組。這對於對所有表自動執行 runstats 很有用。

reorg table 通過重構行來消除「碎片」資料並壓縮資訊,對錶進行重組。

管理export 將資料庫資料抽取到乙個平面檔案中。

import 通過使用 import 實用程式,將資料匯入到資料庫。

load query table

[to local-message-file][nosummary | summaryonly] [showdelta]  返回 load 實用程式的進度。

backup database [to ] 執行資料庫備份。

restore database [from ] 執行資料庫恢復。

get health snapshot for dbm 返回例項的正常快照資訊(僅適用於 v8)。

get health snapshot for all on 返回資料庫 的所有正常快照(僅適用於 v8)。

管理伺服器

get admin cfg 返回管理伺服器的配置設定。

update admin cfg using 將管理伺服器配置引數 更新為值 。

應用程式開發

get routine into from [specific] procedure [hide body] 將 sql 過程抽取成

二進位制檔案。

put routine from [owner [use registers]] 從二進位制檔案部署 sql 過程。

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 將資...