db2start
db2cmd
db2
db2 => create database smart_crud
SQL1001N "smart_crud" is not a valid database name. SQLSTATE=2E000
db2 => create database smartcru (MB的,db2数据库名的长度只能是8位?)
SQL1047N The application is already connected to another database.
db2 => connect reset
DB20000I The SQL command completed successfully.
db2 => create database smartcru
DB20000I The CREATE DATABASE command completed successfully.
就这么建成功了,默认建哪里去了?
db2 => list database directory [on 盘符:]
System Database Directory
Number of entries in the directory = 5
Database 1 entry:
Database alias = XSCJ
Database name = XSCJ
Database drive = E:\DB2
Database release level = a.00
Comment = 学生成绩数据库
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =
Database 2 entry:
Database alias = SMARTCRU
Database name = SMARTCRU
Database drive = E:\DB2
Database release level = a.00
Comment =
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =
Database 3 entry:
Database alias = EFEDDB2T
Database name = EFEDDB2T
Node name = NODE_EV
Database release level = a.00
Comment =
Directory entry type = Remote
Catalog database partition number = -1
Alternate server hostname =
Alternate server port number =
Database 4 entry:
Database alias = DEMO
Database name = DEMO
Database drive = E:\DB2
Database release level = a.00
Comment = this is a demo db
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =
Database 5 entry:
Database alias = SAMPLE
Database name = SAMPLE
Database drive = E:\DB2
Database release level = a.00
Comment =
Directory entry type = Indirect
Catalog database partition number = 0
Alternate server hostname =
Alternate server port number =
db2 =>
好吧,看起来有5个数据库,然后具体位置在E:\db2\NODE0000,有6个目录,目录的结构大致如下:
E:\db2\NODE0000>tree
Folder PATH listing for volume software
Volume serial number is F439-30CD
E:.
├─SQL00001
│ ├─DB2EVENT
│ │ └─db2detaildeadlock
│ ├─SQLOGDIR
│ ├─SQLT0000.0
│ ├─SQLT0002.0
│ └─SYSTOOLSPACE
├─SQL00002
│ ├─DB2EVENT
│ │ └─db2detaildeadlock
│ ├─SQLOGDIR
│ ├─SQLT0000.0
│ ├─SQLT0001.0
│ ├─SQLT0002.0
│ └─SYSTOOLSPACE
├─SQL00003
通过文件的创建时间能隐约看出来,这个新建的DB位置在:E:\db2\NODE0000\SQL00005
http://a280606790.iteye.com/blog/909659
又建了一个create database notsmart,这次默认的位置在E:\db2\NODE0000\SQL00006,
看了一个这个生成的目录的大小,约30M
db2 => drop database notsmart
DB20000I The DROP DATABASE command completed successfully.
继续:http://doc.chinaunix.net/db2/201007/758576.shtml
这次创建DB的时候带点参数:
db2 => create database notsmart on 'E:/db2data/notsmart/on1','E:/db2data/notsmar
t/on2'
SQL0104N An unexpected token "," was found following "<character-string>".
Expected tokens may include: "CATALOG". SQLSTATE=42601
db2 => create database notsmart on 'E:/db2data/notsmart/on1'
SQL1052N The database path "E:/db2data/notsmart/on1" does not exist.
db2 =>
好吧。我手动的把目录先建好。
db2 => create database notsmart on 'E:/db2data/notsmart/on1'
SQL1052N The database path "E:/db2data/notsmart/on1" does not exist.
TMD的,还是这个错:
看这里:http://blog.csdn.net/xuyingjun/article/details/6430259
E:\db2data\notsmart>db2set -i db2 DB2_CREATE_DB_ON_PATH=YES
DBI1302E Invalid parameter detected.
Explanation:
An invalid parameter was used.
User Response:
Use the -? option for the usage help message.
为什么不可以? 难道DB2 8不支持这个变量吗?为了少折腾,我还是升级先。
继续:http://blog.csdn.net/cecilulysess/article/details/4637238
C:\Documents and Settings\Administrator>db2set -all
[e] DB2PATH=E:\db2
[i] DB2ACCOUNTNAME=IBM-R8M6A58\db2admin
[i] DB2INSTOWNER=IBM-R8M6A58
[i] DB2PORTRANGE=60000:60003
[i] DB2INSTPROF=E:\DB2
[i] DB2COMM=TCPIP
[i] DB2CODEPAGE=1208
[g] DB2_EXTSECURITY=YES
[g] DB2SYSTEM=IBM-R8M6A58
[g] DB2PATH=E:\db2
[g] DB2INSTDEF=DB2
[g] DB2ADMINSERVER=DB2DAS00