- 浏览: 152889 次
- 性别:
- 来自: 郑州
-
文章分类
最新评论
-
loveseaside:
db2v9.1
db2许可证 -
uglypeak:
不对,你这个是哪个版本的??
db2许可证 -
uglypeak:
试过了,不行啊~~
db2许可证 -
yingjun055:
怎么样能修改后,能实时生效呢?
java 读取配置文件的例子
常用命令:
1.启动数据库
db2start
2.停止数据库
db2stop
3.连接数据库
db2 connect to sample user db2admin using db2admin
4.读数据库管理程序配置
db2 get dbm cfg
5.写数据库管理程序配置
db2 update dbm cfg using 参数名 参数值
6.读数据库的配置
db2 connect to sample user db2 using pwd
db2 get db cfg for sample
7.写数据库的配置
db2 connect to sample user db2 using pwd
db2 update db cfg for sample using 参数名 参数值
8.关闭所有应用连接
db2 force application all
db2 force application ID1,ID2,,,Idn MODE ASYNC
(db2 list application for db sample show detail)
9.备份数据库
db2 force application all
db2 backup db sample to d:
(db2 initialize tape on \\.\tape0)
(db2 rewind tape on \\.\tape0)
db2 backup db sample to \\.\tape0
10.恢复数据库
db2 restore db sample from d: to d:
db2 restore db sample from \\.\tape0 to d:
11.绑定存储过程
db2 connect to sample user db2 using pwd
db2 bind c:\dfplus.bnd
拷贝存储过程到服务器上的C:\sqllib\function目录中
12.整理表
db2 connect to sample user db2 using pwd
db2 reorg table ydd
db2 runstats on table ydd with distribution and indexes all
13.导出表数据
db2 export to c:\dftz.txt of del select * from dftz
db2 export to c:\dftz.ixf of ixf select * from dftz
14.导入表数据
import from c:\123.txt of del insert into ylbx.czyxx
db2 import to c:\dftz.txt of del commitcount 5000 messages c:\dftz.msg insert into dftz
db2 import to c:\dftz.ixf of ixf commitcount 5000 messages c:\dftz.msg insert into dftz
db2 import to c:\dftz.ixf of ixf commitcount 5000 insert into dftz
db2 import to c:\dftz.ixf of ixf commitcount 5000 insert_update into dftz
db2 import to c:\dftz.ixf of ixf commitcount 5000 replace into dftz
db2 import to c:\dftz.ixf of ixf commitcount 5000 create into dftz (仅IXF)
db2 import to c:\dftz.ixf of ixf commitcount 5000 replace_create into dftz (仅IXF)
15.执行一个批处理文件
db2 –tf 批处理文件名
(文件中每一条命令用 ;结束)
16.自动生成批处理文件
建文本文件:temp.sql
select 'runstats on table DB2.' || tabname || ' with distribution and detailed indexes all;' from syscat.tables where
tabschema='DB2' and type='T';
db2 –tf temp.sql>runstats.sql
17.自动生成建表(视图)语句
在服务器上:C:\sqllib\misc目录中
db2 connect to sample user db2 using pwd
db2look –d sample –u db2 –e –p –c c:\sample.txt
18.其他命令
grant dbadm on database to user bb
19
select * from czyxx fetch first 1 rows only
20
db2look –d ylbx –u db2admin –w –asd –a –e –o a.txt
21. 显示当前用户所有表
list tables
22. 列出所有的系统表
list tables for system
23. 查看表结构
db2 describe select * from user.tables
24. 查看死锁明细
db2 get snapshot for locks on yourdatdabasename
用df -k命令看看是否有些文件系统没有空间.
DAS INSTANCE COMMAND(DAS实例命令)
DAS a special instance, it is short for Database Administrator Server. Only one DAS can be create in one DB2 server.
DAS provide local&remote management function.(DAS是一个特殊的实例,只能有一个DAS驻留在db2服务器上,DAS允许使用db2工具对
服务器进行本地和远程管理。)
1. dbsicrt(db2admin create)
Description(描述):
DAS was created automatically when db2 installing.(DAS通常在安装时候自动创建。)
Systax(语法):
UNIX:dasicrt name
WINDOWS:db2admin create
Examples(例子):
UNIX:dasicrt MyDas
WINDOWS:db2admin create
2. dbsidrop(db2admin drop)
Description(描述):
Systax(语法):
UNIX:dbsidrop name
WINDOWS:db2admin drop
Examples(例子):
UNIX:dbsidrop MyDas
WINDOWS:db2admin drop
3. db2admin start
Description(描述):
Start DAS.(启动DAS。)
Systax(语法):
db2admin start
Examples(例子):
db2admin start
4. db2admin stop
Description(描述):
Stop DAS.(停止DAS。)
Systax(语法):
db2admin stop
Examples(例子):
db2admin stop
5. db2 get admin cfg
Description(描述):
Get DAS configuration information.(取得DAS配置信息。)
Systax(语法):
db2 get admin cfg
Examples(例子):
db2 get admin cfg
6. db2 update admin cfg
Description(描述):
Update DAS configuration information.(更新DAS配置信息。)
Systax(语法):
db2 update admin cfg using PARAMETER_NAME PARAMETER_VALUE
Examples(例子):
db2 update admin cfg using DIAGLEVEL 4
Profile Registry Command(概要文件注册表命令)
1. db2set -lr
Description(描述):
List out all the supportive parameter name.(列出所受支持的概要文件注册表。)
Systax(语法):
db2set -lr
Examples(例子):
db2set -lr
2. db2set registry_variable=value
Description(描述):
Set registry variable.(设置DB2概要文件注册表。)
Systax(语法):
db2set registry_variable=value
Examples(例子):
db2set DB2COMM=TCPIP,APPC
3. db2set registry_variable=
Description(描述):
Set registry variable to default value .(恢复DB2概要文件注册表默认值。)
Systax(语法):
db2set registry_variable=
Examples(例子):
db2set DB2COMM=
4. db2set -all
Description(描述):
List out all the settled registry variable value.(列出所受支持的概要文件注册表。)
Systax(语法):
db2set -all
Examples(例子):
db2set -all
发表评论
-
DB2系统命令
2011-08-10 15:11 2633DB2系统命令 1、dasauto在$DB2DIR/da ... -
db2查看当前模式的sql
2011-08-09 15:05 1307通过DB2提供的专用寄存器current sche ... -
db2中会导致表处于reorg pending状态的alter语句
2011-08-09 14:57 5008会导致表处于reorg pending状态的alter tab ... -
db2系统编目表的实践
2011-08-03 15:34 1002一 根据此命令导出全部需要进行统计的表--导出runstats ... -
db2认证
2011-07-19 09:29 1099在这里,我把IBM的认证相关的资料整理下,希望对大家有点帮助。 ... -
db2pd 使用(二)
2011-07-19 09:23 2839分析 DB2 for Linux, UNIX, and ... -
db2pd 使用
2011-07-19 08:53 1434db2pd 工具 用于监控 DB2 实例和数据库的新的 DB ... -
DB2 V9.7分区索引新特性
2011-05-26 16:35 1459在本文中将介绍 DB2 V9.7 ... -
db2的几个有用SQL
2010-11-04 14:47 978--查找函数SELECT * FROM SYSCAT.FUNC ... -
すばらしいnet ---------testpassport問題集のメリット
2010-09-17 14:16 838http://www.testpassport.jp/ ... -
DB2关于查看表空间是否启动了自动存储功能
2010-09-16 11:04 4006可以通过三种方式查看 进入命令行模式 d ... -
DB2约束
2010-09-09 09:53 1180DB2约束 DB2 约束用来对数据实施业务规则,主要 ... -
高级建表SQL
2010-08-16 09:15 882--建表AB 和已知表AA一样create table AB ... -
db2单表优化的命令
2010-08-16 09:04 1037reorg 和runstats 都是单个表优化 ... -
DB2常用语句总结
2010-06-03 16:41 810DB2常用语句 ... -
DB2使用笔记
2010-06-03 15:00 1504DB2使用笔 ... -
db2检索授权的SQL
2010-05-27 10:07 1009--检索具有特权的所有授权名 SELECT DISTINCT ... -
db2许可证
2010-05-27 09:54 1905许可证执行过程 1、windows下启动命令提示符。2、将目 ... -
[转载]DB2表合理映射到表空间
2010-05-26 08:18 1049在DB2数据库中,是 ... -
DB2 DATE 函数的使用一个陷阱
2010-05-19 09:27 4859DB2 DATE 函数的使用一个陷阱 1)DATE 函数正确 ...
相关推荐
### DB2 Command Reference Version 8.2:关键知识点解析 #### 概述 DB2是IBM推出的一款功能强大且高效的关系型数据库管理系统(RDBMS)。《DB2 Command Reference version 8.2》文档详细介绍了DB2 Version 8.2版本...
### DB2 Command Reference #### 简介 《DB2 Command Reference》是一份全面而详细的文档资料,由IBM公司发布,旨在为用户提供DB2 Universal Database Version 7版本中所有命令的参考指南。这份资料非常重要,它...
db2 command ref book
根据提供的文件信息,我们可以归纳出一系列与IBM DB2数据库系统相关的命令及选项。这些命令涵盖了DB2系统的管理和操作,包括但不限于实例管理、配置调整、工具使用等关键领域。接下来将详细解析这些知识点。 ### ...
根据提供的文件信息,本文将对《DB2 v8 命令参考》中的部分关键知识点进行详细解析。此文档是IBM DB2 Universal Database Version 8 的命令参考手册,旨在为用户提供有关DB2 v8 中各个命令的具体用法、功能及注意...
例如,`DB2Command`的`Parameters`集合可以添加`DB2Parameter`对象,设置其`ParameterName`、`DbType`和`Value`属性。 在C#代码中,你可以创建一个`DB2Connection`实例,打开连接,然后创建一个`DB2Command`实例来...
DB2Command command = new DB2Command("SELECT * FROM MyTable WHERE ID = @id", connection); command.Parameters.Add(new DB2Parameter("@id", DB2Type.Int32)).Value = myId; DB2DataReader reader = ...
DB2Command command = new DB2Command("SELECT * FROM myTable", connection); DB2DataReader reader = command.ExecuteReader(); ``` `ExecuteReader()`返回一个`DB2DataReader`,用于读取查询结果。 3. 数据...
DB2Command command = new DB2Command(query, connection); using (DB2DataReader reader = command.ExecuteReader()) { // 处理查询结果 } ``` 4. **处理查询结果** `DB2DataReader`是一个只向前的数据流,...
DB2Command cmd = con.CreateCommand(); cmd.CommandText = "{ CALL CHAXUN.BIG_CASH_TRADE(?,?)}"; DB2Parameter p1 = cmd.CreateParameter(); p1.Value = GetBindPartyNum(ddlPartyNum); p1.DB2Type = DB2...
5- In a DB2 command line processor window, run : \>db2 connect to <my_db> user <uid> using \>db2 set current schema='REGEXP' \>db2 -td@ -vf C:\avalanche\db2_regex\scripts\sql\db2_regex_...
using (DB2Command cmd = new DB2Command(insertSql, conn)) { cmd.Parameters.AddWithValue("@param1", value1); cmd.Parameters.AddWithValue("@param2", value2); int rowsAffected = cmd.ExecuteNonQuery(); ...
`Db2Command`的`Parameters`集合可以添加`Db2Parameter`对象,每个参数对应SQL语句中的占位符。例如: ```csharp command.Parameters.Add(new Db2Parameter("@id", DbType.Int32) { Value = id }); command....
DB2Command db2Command = db2Connection.CreateCommand(); db2Command.CommandText = "SELECT * FROM myTable"; DB2DataReader reader = db2Command.ExecuteReader(); while (reader.Read()) { // 处理数据 }...
2. 使用DB2Command对象创建SQL查询或存储过程,并设置相应的参数。 3. 使用DB2DataReader或DB2DataAdapter对象来读取查询结果。 4. 在处理完数据库操作后,记得关闭连接以释放资源。 在ASP.NET中,你还可以使用控件...
- **db2cmd**:Open DB2 Command Window 命令,用于打开专门的命令窗口进行操作。 - **db2dclgn**:Declaration Generator 工具,用于生成声明语句。 - **db2drdat**:DRDATrace 工具,用于追踪 DRDA 操作。 - **db2...
DB2Command command = new DB2Command("SELECT * FROM MyTable", connection); ``` 然后,创建一个DB2DataReader来读取结果集: ```csharp using (DB2DataReader reader = command.ExecuteReader()) { while ...
DB2Command cmd = conn.CreateCommand(); cmd.CommandText = "SELECT * FROM myTable"; // 执行查询并获取结果集 using (DB2DataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { // 处理每一行...
5. 执行命令:通过`DB2Connection`创建`DB2Command`对象,设置SQL语句,并可使用`DB2Command.ExecuteNonQuery()`或`DB2Command.ExecuteReader()`执行查询或非查询命令。 6. 处理结果:如果执行的是查询,可以通过`...