DB2常用命令

2021-04-20 13:32:20 字數 3203 閱讀 4395

例項

clp 命令描述

db2start

啟動資料庫管理器例項。

db2stop

停止資料庫管理器例項。

get dbm cfg

返回資料庫管理器配置設定。

get dbm cfg show detail

顯示資料庫管理器引數的當前值和延遲值(從 v8 起)。

1update dbm cfg using

將資料庫管理器配置引數 更新為值 。

get instance

返回 db2instance 環境變數的值。

list active databases

列出活動的資料庫和連線數。

返回關於當前連線的應用程式的資訊。

根據控制代碼號與特定應用程式斷開連線。

斷開所有應用程式與資料庫的連線。

attach 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

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

export to btpoper.txt of

delselect * from btpoper(,號分割)

export to btpoper.txt of

delmodified by coldel| select * from btpoper(|號分割)

export to btpoper.txt of

delselect * from btpoper where brhid='907020000'

import

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

import from btpoper.txt of

delinsert into btpoper(,號分割)

import from btpoper.txt of

delmodified by coldel| insert into btpoper(|號分割)

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常用命令

常用的db2命令 啟動db2服務 db2start 關閉db2服務 db2stop 一 載入資料 1 以預設分隔符載入,預設為 號 db2 import from btpoper.txt of del insert into btpoper 2 以指定分隔符 載入 db2 import from b...