db2 建库命令

– 创建数据库
CREATE DATABASE db_name AUTOMATIC STORAGE YES
ON ‘d:\’
DBPATH ON ‘d:\’
USING CODESET GBK
TERRITORY CN COLLATE
USING SYSTEM PAGESIZE 16384;

– 配置数据库日志
connect to db_name
UPDATE DB CFG FOR db_name USING logarchmeth1 OFF logarchmeth2 OFF logprimary 20 logsecond 10 logfilsiz 102400
db2stop force
db2start

– 授权用户
CONNECT TO db_name;
GRANT DBADM,SECADM ON DATABASE TO USER user_name
CONNECT RESET;

– 导出表结构
db2look -d db_name -e -a -x -i username -w password -o ddlfile.sql

– 执行脚本
db2 -tvf ddlfile.sql

你可能感兴趣的:(db2)