`
friend365
  • 浏览: 54347 次
  • 性别: Icon_minigender_2
  • 来自: 上海
最近访客 更多访客>>
社区版块
存档分类
最新评论
阅读更多

IBM DB2上机操作指南
1.启动实例(db2inst1):实例相当于informix中的服务
db2start
2.停止实例(db2inst1):
db2stop
3.列出所有实例(db2inst1)
db2ilist
5.列出当前实例:
db2 get instance
4.察看示例配置文件:
db2 get dbm cfg|more
5.更新数据库管理器参数信息:
db2 update dbm cfg using para_name para_value
6.创建数据库:
db2 create db test
7.察看数据库配置参数信息
db2 get db cfg for test|more
8.更新数据库参数配置信息
db2 update db cfg for test using para_name para_value
10.删除数据库:
db2 drop db test
11.连接数据库
db2 connect to test
11.列出所有表空间的详细信息。
db2 list tablespaces show detail
12.列出容器的信息
db2 list tablespace containers for tbs_id show detail
13.创建表:
db2 ceate table tb1(id integer not null,name char(10))
14.列出所有表
db2 list tables
12.插入数据:
db2 insert into tb1 values(1,’sam’);
db2 insert into tb2 values(2,’smitty’);
13.查询数据:
db2 “select * from tb1”
14.删除数据:
db2 delete from tb1 where id=1
15.创建索引:
db2 create index idx1 on tb1(id);
16.创建视图:
db2 create view view1 as select id from tb1
17.查询视图:
db2 select * from view1
18.节点编目
db2 catalog tcp node node_name remote server_ip server server_port
19.察看端口号
db2 get dbm cfg|grep SVCENAME
20.节点的附接
db2 attach to node_name
21.察看本地节点
db2 list node direcotry
22.节点反编目
db2 uncatalog node node_name
23.数据库编目
db2 catalog db db_name as db_alias at node node_name
24.察看数据库的编目
db2 list db directory
25.连接数据库
db2 connect to db_alias user user_name using user_password
26.数据库反编目
db2 uncatalog db db_alias
27.导出数据
db2 export to myfile of ixf messages msg select * from tb1
28.导入数据
db2 import from myfile of ixf messages msg replace into tb1
29.导出数据库的所有表数据
db2move test export
30.生成数据库的定义
db2look -d db_alias -a -e -m -l -x -f -o db2look.sql
31.创建数据库
db2 create db test1
32.生成定义
db2 -tvf db2look.sql
33.导入数据库所有的数据
db2move db_alias import
34.重组检查
db2 reorgchk
35.重组表tb1
db2 reorg table tb1
36.更新统计信息
db2 runstats on table tb1
37.备份数据库test
db2 backup db test
38.恢复数据库test
db2 restore db test

39. 拥有实例的所有程序列表
db2 list application
40.db2 terminate
41.查看数据表结构
db2 “describe select * from ggwdxtcs”

/*启动命令界面 */    db2cmd

/*查看帮助*/  db2 ? *

/*连接数据库*/   db2 connecct to <库名> user <用户名> using <用户密码>

/*查看数据库实例*/ db2ilist

/*启动数据库*/  db2start

/*停止数据库应用*/ db2 force applications all

/*停数据库*/  db2stop

/*查看表空间*  db2 list tablespaces show detail


/*查看表是否有记录*/ db2 select count(*) from <表名>

/*从文本导入到数据库表中*/ db2 import from ***.ixf of ixf modified by forcein commitcount 1000 insert into <表名>
   
modified by forcein  /*数据库数据在AIX 和 windows 不同版本之间的格式转换*/
       
commitcount **** /*防止数据库提交过多,引起交易日志满,1000-5000 为宜*/

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics