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則還不會生效。java