DB2数据库实用小结
1、创建DB2数据库实例(在db2 =>下执行)
db2 =>
create tablespace resource1 managed by database using (file ‘/home/db2inst1/db2inst1/NODE0000/YOURDB实例/cont0’ 1500000)
2、DB2数据库修改表空间(在db2授权用户即可执行,使用db2 ” “)
db2 “alter tablespace RESOURCE add(file ‘/home/db2inst1/db2inst1/NODE0000/YOURDB实例/cont1’ 16G)”
3、查看db2数据库版本(在db2用户执行)或db2level(在授权用户执行即可)
db2inst1@name-1:~> db2licm -l
Product name: “DB2 Enterprise Server Edition”
License type: “CPU Option”
Expiry date: “Permanent”
Product identifier: “db2ese”
Version information: “10.1”
Enforcement policy: “Soft Stop”
Features:
DB2 Storage Optimization: “Not licensed”
DB2 pureScale: “Not licensed”Product name: “DB2 Connect Server”
Expiry date: “Expired”
Product identifier: “db2consv”
Version information: “10.1”
Concurrent connect user policy: “Disabled”
Enforcement policy: “Soft Stop”
4、DB2数据库启动(在db2用户执行)
db2inst1@name-1:~> db2start
5、DB2数据库执行sql脚本命令()
db2 -tvf d:\ddl.sql -z d:\ddl.log
6、DB2数据库连接(在授权用户即可执行)
db2 connect to testdb(实例名) user tsas(用户名) using password(密码)
7、断开数据库所有连接(在db2用户执行)
db2inst1@name-1:~> db2 terinate
8、DB2数据