2009年3月12日星期四

DB2中有用的系统视图

参考:http://www.devx.com/dbzone/Article/29585/1954

SYSCAT.TABLES
Column Name Data Type Description
TABSCHEMA VARCHAR(128) Stores the schema name on which the database object is defined
TABNAME VARCHAR(128) Stores the name of the database object, such as table, view, nickname, or an alias
TYPE CHAR(1) Identifies the database object as a table, view, alias, or a nickname (The type value 'T' means table; 'V' means view; 'N' means nickname; and 'A' means alias.)
COLCOUNT SMALLINT Number of columns in the table or view
KEYCOLUMNS SMALLINT Number of columns that constitute the primary key
KEYINDEXID SMALLINT Index ID for the primary key
KEYUNIQUE SMALLINT Number of unique constraints in the table or view



SYSCAT.VIEWS
Column Name Data Type Description
VIEWSCHEMA VARCHAR(128) Schema name for the view
VIEWNAME VARCHAR(128) Name of the view
DEFINER VARCHAR(128) User who created the view
VIEWCHECK CHAR(1) Type of view checking defined for this view:
  • N = means no check option
  • L = means local check option
  • C = means cascaded check option
  • READONLY CHAR(1) Defines whether the view is read only or not:
  • Y = means read only
  • N = means view is not read only
  • VALID CHAR(1) Determines the validity of the view:
  • Y = means view is valid
  • X = means view is invalid
  • TEXT CLOB(64K) DDL text for view


    SYSCAT.INDEXES
    Column Name Data Type Description
    INDSCHEMA VARCHAR(128) Name of the schema on which the index is defined
    INDNAME VARCHAR(18) Index name
    DEFINER VARCHAR(128) User who created the index
    TABSCHEMA VARCHAR(128) Stores the schema name of the table on which the index is defined
    TABNAME VARCHAR(128) Stores the name of the table for which index is defined
    COLNAMES VARCHAR(640) List of columns in the index
    UNIQUERULE CHAR(1) Determines whether the index is unique or not:
  • D = means duplicate allowed
  • P = means primary index
  • U = means unique index
  • INDEXTYPE CHAR(4)
  • CLUS = means clustered index
  • REG = means regular index
  • DIM = means dimension block index
  • BLOK = means block index




  • SYSCAT.TRIGGERS
    Column Name Data Type Description
    TRIGSCHEMA VARCHAR(128) Name of the schema on which the trigger is defined
    TRIGNAME VARCHAR(18) Trigger name
    DEFINER VARCHAR(128) User who created the index
    TABSCHEMA VARCHAR(128) Stores the schema name of the table for which the trigger is defined
    TABNAME VARCHAR(128) Name of table for which the trigger is defined
    TRIGTIME CHAR(1)
  • A = means after trigger
  • B = means before trigger
  • I = means instead of trigger
  • TRIGEVENET CHAR(1) Event for which the trigger is defined:
  • I = means INSERT
  • D = means DELETE
  • U = means UPDATE
  • GRANULARITY CHAR(1) Determines whether the trigger is executed per statement or per row:
  • S = means once per statement
  • R = means once per row
  • TEXT CLOB(64K) Full text of the trigger statement




    没有评论: