ITPub博客

首页 > 数据库 > 数据库开发技术 > DB2的一些基础概念整理笔记

DB2的一些基础概念整理笔记

原创 数据库开发技术 作者:gancie 时间:2014-08-27 11:59:21 0 删除 编辑
1.实例
In DB2, an instance provides an independent environment where database objects can be created and applications can be run against them. Because of these independent environments, objects of two or more separate instances can have the same name.
When an instance is created, links to the DB2 code are generated. For example , instance 'DB2' and instance 'MyInst' have been created, and both of them are linked to the same DB2 code.
2.配置文件

环境变量
在unix环境中,DB2安装后会把db2profile脚本添加到用户的.profile/.login配置文件中,db2profile的作用是为BSH或KSH用户创建一个缺省的DB2运行环境,可以直接调用或者在用户登录时即创建DB2的运行环境。
最常用的DB2环境变量是DB2INSTANCE,这个环境变量指定当前的DB2命令所作用的实例对象,If you wanted to create this database on instance 'DB2' instead, then you would first have to change the value of the DB2INSTANCE variable to 'DB2'.
如果要在当前会话中临时更改环境变量,可以使用set命令,如set DB2INSTANCE=DB2 

DB2变量注册
主要有以下2中级别的变量注册:
DB2 Global-Level Profile Registry
DB2 Instance-Level Profile Registry

Global-Level 级别的变量作用于所有的实例,而Instance-Level级别的变量则只作用于特定的实例,当2个级别都设置同一个变量值时,Instance-Level生效。
Some registry variables require you to stop and start the instance ( db2stop/db2start ) in order for the change to take effect. Some other registry variables don't have this requirement. To be on the safe side, it is recommended to always stop and start your instance after making a change to a registry variable.

配置参数 Configuration Parameter
Configuration parameters are defined at two different levels--the instance level and the database level. The variables at each level are different (not like registry variables where the same variables could be defined at different levels).
  • To view the contents of the dbm cfg, from the CLP, issue the command:
    db2 get dbm cfg
At the database level, variables are stored in the Database Configuration file (db cfg); changes to these variables would affect the specific database. 
To view the contents of the db cfg, from the CLP, issue the command:
db2 get db cfg for 

DB2连接和DB2目录(编目)
In DB2, directories are binary files storing information about the databases and their connectivity. There are four main directories.

System db directory 系统数据库目录(编目)
The system database directory is the main 'table of contents' that contains information about all the databases you can connect to from your DB2 system.
用以下命令查看:db2 list db directory

Any entry from the output of this command containing the word 'indirect' means that the entry is for a local database; that is, a database residing in the machine where you are currently working. The entry will also point to the local database directory indicated by the 'Database drive' item (In Windows) or 'Local database directory' (In UNIX).

Any entry containing the word 'Remote' means that the entry is for a remote database; that is, a database residing in a machine other than the one you are currently working on. The entry will also point to the node directory entry indicated by the 'Node name' item.

Local db directory 本地数据库目录
The local database directory directory contains information about local databases; that is, the databases residing in the machine where you are currently working.用以下命令查看:
db2 list db directory on

Node directory
The node directory is used to store all connectivity information for remote databases.
可以在作为客户端的节点上查看:
db2 list node directory

DCS directory
The DCS directory contains connectivity information for host databases normally residing on a zSeries TM (S/390 ? ) or iSeries TM (AS/400 ? ) machine. You need to have the DB2 Connect software installed. 

数据库 database
DB2的数据库是关联到某个实例的封闭且独立的单元。所以多个数据库的内部对象允许同名.一般来讲,不允许同时查询2个数据库内的对象。
A database is created with the command create database . Note that this is considered a command, and not a SQL statement.
When you create a database, table spaces, logs, a buffer pool, and configuration files are automatically created, which is why this command takes a few seconds to complete.

表空间 tablespaces
表空间作为逻辑表格与物理存储空间的界面
The Catalog (SYSCATSPACE), system temporary space (TEMPSPACE1) and the user space (USERSPACE1) are all table spaces, and are automatically created when the database is created. 
The Catalog contains meta data (data about your data). Some other RDBMs call this structure a 'data dictionary'. Do not confuse the term 'Catalog' in this section with the catalog command mentioned earlier; they have no relationship at all.
A system temporary table space is the work area for the database manager to perform operations, like joins and sorts. There must be at least one system temporary table space.
The USERSPACE1 table space is created by default, but it can be dropped. It is the default location for storing user tables.

表、索引和大对象
A table is an unordered set of data records consisting of columns and rows. Indexes are ordered sets of pointers associated with a table, and are used for performance purposes and to ensure uniqueness. Video, audio, scanned documents, and so on can be stored in databases as large objects (LOBs). Tables, indexes and LOBs reside in table spaces.

日志
Logs are files used for recovery purposes. Logs record every operation against a database. In case of a failure, logs are crucial to restore a database to a consistent point.

缓存池
A buffer pool is an area in memory where all index and data pages (other than LOBs) go through in ordered to be processed. It is basically a cache used by the database manager. Buffer pools are the most important objects to tune in database performance problems.



来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/11325862/viewspace-1258736/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-08-26

  • 博文量
    5
  • 访问量
    16914