db2 常量表 DB2檢視使用者表與指定使用者表表結構

2021-10-16 16:42:34 字數 1953 閱讀 6025

1.在dos中檢視使用者表

1.1檢視表

db2 list tables for user

1.2 檢視表結構

db2 describe table a

2.在db2連線工具中(這裡以sqldbx為例子)

2.1檢視使用者表清單

select rtrim(tabschema) as contname, --

rtrim(tabname) as name,

rtrim(tbspace) as tbspace,

definer as definer

from syscat.tables

where (left (tabschema,3) <> 'sys')

and (type = 't')

order by contname, name for fetch only;

2.2檢視指定表表結構

select rtrim(c.tabschema) as contcontname,

c.tabname as contname,

c.colname as name,

c.remarks as comment,

tc.type as isprim,

seclabelname as seclabelname,

rtrim(c.typeschema) as source_schema,

c.typename as source_name,

c.length as length,

c.scale as scale,

c.codepage as codepage,

c.nulls as nulls,

c.compress as compress,

c.default as default,

c.generated as generated,

c.text as text,

c.identity as identity,

c.logged as logged,

c.compact as compact,

c.partkeyseq as partkeyseq,

rtrim(c.dl_features) as dl_features,

c.inline_length as inlinelength,

cid.start as start,

cid.increment as increment,

cid.cache as cache,

cid.minvalue as minvalue,

cid.maxvalue as maxvalue,

cid.cycle as cycle,

order as order

from syscat.columns c

left outer join syscat.keycoluse kcu on kcu.tabschema = c.tabschema

and kcu.tabname = c.tabname

and kcu.colname = c.colname

left outer join syscat.tabconst tc on tc.constname = kcu.constname

left outer join syscat.colidentattributes cid on cid.colname = c.colname

and cid.tabname = c.tabname and cid.tabschema = c.tabschema

where (left (c.tabschema,3) <> 'sys')

and (c.tabname = 'table_name') ---此處修改表名

and (rtrim (c.tabschema) = 'scheme') ---此處修改scheme

order by colno for fetch only;

DB2管理非預設 db2 例項

檢視db2所有例項 c documents and settings administrator db2ilist db2c documents and settings administrator db2 get instance 當前資料庫管理器例項是 db2 建立新例項 c documents...

DB2使用者許可權控制

db2使用者許可權控制 1 構造例項 我們已經在db2使用者db2inst1下建立好資料庫test,下邊存在test table表和test procedure儲存過程。我們已經建立好乙個空的 使用者agent user db2inst1和agent user都是作業系統使用者 和db2inst1設...

db2匯入匯出單錶資料 db2備份恢復

db2look d dbname e o db.sql i username w password db2 tf db.sql 單錶匯出db2move web export tn yc news u db2user p psw db2move cqycnw export tn magazinecol...