您现在的位置是:首页 > 博文答疑 > DB2笔记系列 3 - STRUCTURES博文答疑
DB2笔记系列 3 - STRUCTURES
Leo2016-08-22【4】
简介DB2 STRUCTURE
DATA STRUCTURE 见博客 DB2 DATA STRUCTURE.
以下是值得注意的地方:
DATABASE:
如果你创建的TABLE SPACE 或TABLE 没有指定DATABASE 那么会使用默认的。在系统安装DB2时所默认的DATABASE 是DSNDB04
TABLE SPACE:
TABLE SPACE 由大量VSAM(LDS)组成。TABLESPACE被分成同等大小的的UNIT,叫作PAGE(页)。可以为数据指定PAGE的SIZE,一般默认的是4KB。
同样也可以创建集中不同类型的TABLE SPACE:
PARTITIONED
分配可用的空间给单独的UNIT,每个PARTITION包含一个TABLE的一个DATA SET,数量是从1到254.每个PARTITION可以被独立地指定在不同的STORAGE GROUP上。
Divides the available space into separate units of storage called partitions. Each partition contains one data set of one table. You assign the number of partitions (from 1 to 254) and you can assign partitions independently to different storage groups.
SEGMENTED
分配可用空间给一些PAGE的GROUP。每个SEGMENT都是一样的大小。一个SEGMENT仅包含一个表的ROWS。
Divides the available space into groups of pages called segments. Each segment is the same size. A segment contains rows from only one table.
LARGE OBJECT(LOB)
用来存储巨大数据,比如图片,影音,或者大文本字符串
Holds large object data such as graphics, video, or very large text strings. A LOB table space is always associated with the table space that contains the logical LOB column values. The table space that contains the table with the LOB columns is called, in this context, the base table space.
SIMPLE
包含多个表,不同表的行不鞥呢在独立,这不SEGMENT不一样的地方。
Can contain more than one table. The rows of different tables are not kept separate (unlike segmented table spaces).
INDEX
INDEX被定义后,又DB2维护,不过有时有些必要的维护还是需要人来做。INDEX放在INDEX SPACE里。
Each index is based on the values of data in one or more columns of a table. After you create an index, DB2 maintains the index, but you can perform necessary maintenance such as reorganizing it or recovering the index. Indexes take up physical storage in index spaces. Each index occupies its own index space.
SYSTEM STRUCTURE
CATALOG
DIRECTORY
包含DB2在正常情况下的操作信息。很大部分的信息是存在CATALOG里边,不过不能通过SQL来访问DIRECTORY。DIRECTORY由系统DATABASE DSNDB01肿的五个TABLE SPACES中存储的DB2 TABLES 集 组成。
The directory consists of a set of DB2 tables stored in five table spaces in system database DSNDB01.
其TABLE SPACES如下5个:
SCT02 : 当BIND一个PLAN时,会创建一个SKELETON CURSOR TABLE(基本指针表), 在SCT02中。
SPT01 :同上,不过是BIND PACKAGE的。
SYSLGRNX:跟踪TABLE SPACES,INDEXES, PARTITIONS的关闭和打开。**** 总之靠减少必须被扫描的LOG总数来减少回复时间。
SYSLGRNX Log range
Tracks the opening and closing of table spaces, indexes, or partitions. By tracking this information and associating it with relative byte addresses (RBAs) as contained in the DB2 log, DB2 can reduce recovery time by reducing the amount of log that must be scanned for a particular table space, index, or partition.
SYSUTILX: (SYSTEM UTILITIES)包含一个ROW,来源于每个正在运行的UTILITY JOB。这ROW一只持续到该UTILITY运行为止。如果期间该UTILITY异常,当再次重新运行该UTILITY时,DB2会使用到再该ROW的信息。
DBD01: (DATABASE DESCRIPTOR ‘DBD’) 包含了每个DATABASE的信息(一个严密对应的DBD),这个信息中描述了DATABASE,TABLE SPACES,TABLES, TABLE CHECK CONSTRAINT, INDEXES, REFERENTIAL RELATIONSHIPS.
DBD依然包含了该对应DATABASE访问 “更新或创建”TABLE时的信息。
Active and archive logs
DB2把每个LOG信息些到硬盘DATA SET里叫做ACTIVE LOG。COPY ACTIVE LOG到磁带上叫做ARCHIVE LOG.
Single logging and dual logging:
一个single active log 包含2到31个active log data sets. Dual logging 是4-64个,因为两个同样的LOG备份被保留下来。(With dual logging, the active log has the capacity for 4 to 62 active log data sets, because two identical copies of the log records are kept.Each active log data set is a single-volume, single-extent VSAM LDS.)
Bootstrap data set (BSDS)
是一个KSDS,
BUFFER POOLS
是一个VIRTUAL BUFFER POOL ,并且存在于DB2 TEMPORARILY STORES PAGES FO TABLE SPACES OR INDEXES. 如果需要的数据已经在BUFFER里边了,那么程序不必等待再从DISK里取一遍,意味着节约了时间。
BUFFER需要检测(monitoring)和调整(tuning)
SIZE OF BUFFER POOLS and so on (page47-48)
Data definition control support database
在初始化期间被创建的。Control support about DDL plans collections packages. 这个DATABASE的系统名字叫做:DSNRGFDB。
Resource limit facility database(DSNRLST)
是一个让我们控制处理器资源总量,而这个资源主要由动态SELECT声明而来。
可以创建单独的LIMIT给所有用户,不同的LIMIT给对应的用户,或二者。定义的这些LIMITS在一个或多个RLST(resource limit specification tables)里。
Work file database
是一个处理SQL描述所需要的工作存储空间。比如需要SORT的时候用到。DB2在初始化的时候已经创建了一个WORK FILE DATABASE,如果你需要的话可以在任何时候用CREATE TABLESPACE语句来添加work file table spaces .
In a non-data-sharing environment, the work file database is called DSNDB07. In a data sharing environment, each DB2 member in the data sharing group has its own work file database.
TEMP database
仅提供临时表用。可以创建一个为每一个DB2子系统或数据共享MEMBER 创建TEMP DABABASE。