DB2常用命令之实例级别命令
2009-11-28 21:18

1. db2icrt
Description(描述):
Used to create a instance.(用于创建一个DB2实例,DB2实例是用于执行DB2命令和函数所处的上下文。
可以把实例看做管理对数据库文件的访问权的服务或守护进程。DB2中一台服务器可以有多个实例,每个实例相互独立,
但同一时刻只能有一个实例在运行。)
Systax(语法):
db2icrt instance_name
linux need to provide user id for create function and storage procedure.(Linux 中必须提供用于创建函数和存储过程的用户标识。)
db2icrt -u fenced_user_ID instance_name
Examples(例子):
db2icrt NEW


2. db2idrop
Description(描述):
Drop a db2 instance(删除一个DB2实例)。
Before drop a instance, you should disconnect all the database connection and stop current db2 instance.
Systax(语法):
db2idrop -f intance_name
Examples(例子):
db2idrop -f NEW

3. db2start
Description(描述):
Start the current db2 instance.(启动当前的DB2实例。)
Systax(语法):
db2start
Examples(例子):
db2start

4. db2stop
Description(描述):
Stop the current db2 instance.(停止当前的DB2实例。)
Systax(语法):
db2stop
Examples(例子):
db2stop

5. db2 get instance
Description(描述):
Get the current db2 instance, the value of environment db2instance.(获得当前所运行的DB2实例名称,环境变量db2instance的值。)
Systax(语法):
db2 get instance
Examples(例子):
db2 get instance

6. set db2instance
Description(描述):
Set the current db2 instance.(设置环境变量db2instance的值。)
Systax(语法):
Windows: set db2instance=instance_name;
Unix C Shell: setenv db2instance instance_name;
Unix Korn Shell: export db2instance=instance_name;
Examples(例子):
set db2instance=NEW

7. db2 get dbm cfg
Description(描述):
Each db2 instance has a configuration file.(每个DB2实例有一个数据库管理配置文件,这个文件用于保存与认证,监管级别,诊断级别,
以及贯穿实例的内存和进程资源有关的参数。当更新这个文件后需要重新启动实例。)
Systax(语法):
db2 get dbm cfg
Examples(例子):
db2 get dbm cfg

8. db2 update dbm cfg
Description(描述):

Systax(语法):
db2 update dbm cfg using PARAMETER_NAME PARAMETER_VALUE
Examples(例子):
db2 update dbm cfg using DIAGLEVEL 4
db2stop
db2start

9. db2imigr
Description(描述):
When you install a new version of DB2 UDB, you need to migrate instance.
Systax(语法):
db2imigr instance_name
Examples(例子):
db2imigr NEW

10. db2iupdt
Description(描述):
When you install a new version of DB2 UDB, you need to update instance.
Systax(语法):
db2iupdt instance_name
Examples(例子):
db2iupdt NEW

11. db2ilist
Description(描述):
List all the db2 instance in the server.(列出服务器上的所有的db2实例。)
Systax(语法):
db2ilist
Examples(例子):
db2ilist

12. db2 attach to
Description(描述):
Connect a db2 instance in the server from remote computer.(远程连接db2实例。)
Systax(语法):
ATTACH [TO node-name] [USER username [{USING password[NEW new-password CONFIRM confirm-password] |CHANGE PASSWORD}]]
Examples(例子):
db2 attach to NEW

13. db2 list applications
Description(描述):
List all the connection to the currenct db2 instance.(列出所有与当前db2实例的连接。)
Systax(语法):
db2 list applications [show detail]
Examples(例子):
db2 list applications [show detail]

14. db2 force application
Description(描述):
Stop the connection to the currenct db2 instance.(断开与当前db2实例的连接。)
Systax(语法):
FORCE APPLICATION {ALL | ( application-handle [ {,application-handle} ... ] )}[MODE ASYNC]
Examples(例子):
db2 db2 force application (6, 5)
db2 force application all