DB2安装过程(CentOS)

安装
./install 
创建实例:
groupadd database 
useradd prod -g database
useradd prodfenc -g database
cd /opt/ibm/db2/V9.7/instance
./db2icrt -a server -u prodfenc prod
配置实例参数:
cd ~prod
vi .bashrc #在最后加入
./sqllib/db2profile
设置实例在每次登录时自启动
su prod
db2iauto -on prod
启动实例
db2start #必须用实例拥有者登录后执行此命令

列出所有实例
db2ilist

查看当前实例
db2 get instance

查看当前实例配置参数
db2 get dbm cfg


创建/查看/连接数据库

db2 create database LEON
db2 list database directory
db2 connect to LEON
查看表空间(明细)
db2 list tablespaces show detail
创建一个8k页面大写的缓冲池
db2 "CREATE BUFFERPOOL LEON_BU_8K IMMEDIATE SIZE 2000 PAGESIZE 8k"
db2 drop bufferpool LEON_BU_8K
db2 create bufferpool leon_bp_8k immediate size 5000 pagesize 8k
创建表空间(8K页面大小)
mkdir -p /database 
chown -R prod:database database  
db2 "create tablespace LEONSPACE0 pagesize 8192 managed by database using (FILE'/database/container1' 5000 ) bufferpool leon_bp_8k"
#只能创建到/databse,container目录由数据库自己创建;如果用户创建的话,那么在创建表空间时会报以下错误
DB21034E  The command was processed as an SQL statement because it was not a  valid Command Line Processor command.  During SQL processing it returned: SQL0298N  Bad container path.  SQLSTATE=428B2 

你可能感兴趣的:(DB2安装过程(CentOS))