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


建立/查看/鏈接數據庫 sql

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
相關文章
相關標籤/搜索