Db2 Terminate Vs Connect Reset , Disconnect

db2 Terminate and db2 connect Reset both break the connection to a database.
 
             Connect Reset breaks a connection to a database, but does not terminate the back-end process. The Terminate command does both ie. break the connection to a database and terminate the back-end process.
 
Suppose an application is connected to a database, or a process may be in the middle of a of work. We can use TERMINATE to make the database connection to be lost. When Terminate is issued, an internal commit is also performed.
 
When issue the command db2stop, it may not stop the database manager, if an application is connected to a database. In this situation, you have to issue db2 Terminate command or db2 connect reset, then issue the command db2stop.
 
Db2 Disconnect is used to clear the database connection of a particular database or all
 
Syntax : db2 disconnect dbname
 
eg. db2 disconnect sample
 
db2 disconnect all
 
db2 release all
 
Note : Even after disconnecting database, some times you may get the error message "Database already in use "  when you execute the commands like   "db2 Restore db databasename , etc ..". 
 
That means current data base is connected by some other applications. Applications connected to the database can be listed out by the following command
 
db2 list applications
 
Auth Id Application Name Appl. Handle Application Id DB Name # of Agents
------- -------------- ---------- ------------------------------ -------- -----
 
TEST javaw.exe 78 *LOCAL.DB2.110722172106 EMPLOYEE 1
 
TEST javaw.exe 77 *LOCAL.DB2.110722172103 EMPLOYEE 1
 
 
Now you can use db2 "force applications all" This command is used to kill  all the applications forcefully at instance level .
 
To force a particular application with application handle 78
db2  "force application(78)"
 
 
=============================
如果是退出编辑器 quit ;如果是断开数据库连接释放资源 connect reset ;如果是修改了参数下次使用数据服务想要生效 terminate。

1:
connect reset 应该是终止数据库连接,包含一个commit的动作
terminate应该是能终止这个client发起的进程,释放资源
2:
terminate是命令,除了断开连接以外,它还终止clp(命令行处理器)的后台进程,也就是常见的db2bp:back-end process。   
connect   reset是sql语句。
3:
connect   reset只是断开连接,不终止clp后台,在duow(可以同时连接多个数据库的事务)中可以将数据库当前连接休眠。
4:
quit :退出clp,但数据库连接不断开
connect reset:断开数据库连接但不退出clp
terminate:断开数据库连接,同时退出clp
5:
CLP backend process会在从CLP提交命令和SQL语句时启动,其作用就是将Directory file的内容读到内存中,这样不用每次connect都去读一次I/O,以提高效率。
就如上面所说,区别就在于是否终止那个CLP backend process。所以,当你修改了一些参数以后,用terminate的话,下次的CLP命令(比如一个新的connect语句)此参数就会生效;而用connect reset则还不会生效。

原文地址:https://www.cnblogs.com/rusking/p/11726202.html