db2 connect to yrh user yrh using yrh
DROP TABLE WWW
CREATE TABLE WZJ (SRVNAME VARCHAR(32) NOT NULL, SRVIP VARCHAR(16) NOT NULL, CONSTRAINT PK_WZJ PRIMARY KEY (SRVNAME))
ALTER TABLE "WZJ" ADD CONSTRAINT uq_www_ip UNIQUE(SRVIP)
(注意,语句最后没有分号。)
执行SQL文件:
db2 connect to dyting
db2 -tvf portal_mvnorouter.sql
修改等待锁表的时间:db2 update db cfg using LOCKTIMEOUT 20 //等待20s
查询等待锁表的时间:db2 get db cfg | grep LOCKTIMEOUT
锁表的SQL:
db2 connect to dyting user yrh using yrh
db2 +c lock table SUBSCRIBER in exclusive mode
表解锁:
以db2管理员用户登录unix
执行语句:$> db2 force application all (注意是命令不是sql)
导出表数据(注意是进入SQL命令模式):db2 => export to employee_ex1.del of del select * from employee
导入表数据:db2 => import from c:\export\employee_ex1.del of del insert into promotion_candidate
DB2的限制:
表名长度<=30
序列名字长度<=18
pk名字长度<=18