DB2 Profile Registry
-DB2 Instance Level Profile Registry 负责特定得实例
-DB2 Global Level Profile Registry 全局环境变量
-DB2 Instance Node Level Profile Registry 多分区环境中特定节点
-DB2 Instance Profile Registry 包含系统识别得实例列表,通过db2list可查看得实例,在此寄存器定义。
下列得参数可在db2 寄存器中进行设置:
DB2CODEPAGE
DB2DBDFT
DB2COMM
DB2NBADAPTERS -只用于windows环境
Environment variables
有一部分环境变量没有或者不能在寄存器中进行设置就得通过环境变量进行设置。如DB2INSTANCE,DB2PATH
Configuration parameters
声明寄存器及环境变量:
虽然寄存器信息都保存在文件当中,但是不能进行手动得修改。必须通过db2set命令进行设置,所有设置都是可动态得。
可通过db2set -all查看你系统中设置得所有寄存器环境,通过db2set -lr 查看系统中所有得可设置寄存器变量。
所有得变量尽量使用db2寄存机进行设置。
instance:
目录包括:
The database manager configuration file
The system database directory
The node directory
The node configuration file (db2nodes.cfg)
Other files that contain debugging information, such as the exception or register dump or the call stack for the DB2 processes.
二:创建instance:
1.创建下列用户组
Instance owner
db2inst1
db2iadm1
Fenced user
db2fenc1
db2fadm1
DB2 administration server
db2as
db2asgrp
2、创建DAS:
/usr/opt/db2_08001/instance/dascrt -u db2as
3.创建instance:
DB2DIR/instance/db2icrt -a server/client/SERVER_ENCRYPT -u db2fenc1 db2inst1
4.设置通信类型:
db2set db2comm=tcpip
update dbm cfg using db2svcename db2c_DB2--为/etc/services里定义端口标识
5、更新产品许可。
db2licm
启动关闭实例:
db2start
db2stop
三、实例管理:
1、连接到instance:
ATTACH [TO nodename] [USER username [USING password]]
当前活动得instance 可以使用get instance得到,其获得得信息为DB2INSTANCE环境变量得信息。数据库连接与实例连接无关。一个应用可以同事连接
多个数据库,但是对于实例而言,只能连接一个实例。
2、本地实例管理:
第一个实例可以通过DB2INSTANCE和DB2PATH变量指定,第二个实例通过一下方式:
catalog local node mydb2 instance db2
catalog db db2cert as mycert at node mydb2
可以通过list node directory/list db directory查看。
3、db2管理服务器
一台机器只需要一个管理服务器,主要作用:
Enabling remote administration of DB2 servers.
Providing the facility for job management, including the ability to schedule the running of both DB2 and operating system command scripts. These command scripts are user-defined.
Defining the scheduling of jobs, viewing the results of completed jobs, and performing other administrative tasks against jobs located either remotely or locally to the DAS using the Task Center.
Providing a means for discovering information about the configuration of DB2 instances, databases, and other DB2 administration servers in conjunction with the DB2 Discovery utility. This information is used by the Configuration Assistant and the Control Center to simplify and automate the configuration of client connections to the DB2 databases.
DAS管理常用命令:
DB2ADMIN START - Starts the DB2 Administration Server.
DB2ADMIN STOP - Stops the DB2 Administration Server.
DASICRT - Creates the DAS in UNIX.
DASIDROP - Drops the DAS in UNIX.
DB2ADMIN CREATE - Creates the DAS in Windows.
DB2ADMIN DROP - Drops the DAS instance in Windows.
DB2 GET ADMIN CFG - Displays the database manager configuration file of the DAS.
DB2 UPDATE ADMIN CFG - This command allows you to update individual entries in the database manager configuration file for the DAS.
DB2 RESET ADMIN CFG - Resets the configuration parameters to the recommended defaults. The changes become effective only after the DB2ADMIN START command is executed