Force All Connections to Disconnect (dbDisconnect)
The dbDisconnect command forces all user connections to the specified database to be disconnected. This is useful, for example, prior to maintenance operations. Closing connections is mandatory to ensure a smooth shutdown and no data loss.
ttGridAdmin dbDisconnect name -transactional|-immediate|-abort [-nowait | -wait [timeout]]
No new transactions are allowed before the command runs.
A disconnection request is sent to each data instance in the grid.
See Unloading a Database from Memory in Oracle TimesTen In-Memory Database Scaleout User's Guide for related information.
Note:
The dbDisconnect command does not affect subdaemon connections.
Options
The dbDisconnect command has the options:
| Option | Description |
|---|---|
|
|
Name of the database. |
|
- |
Specify the mode for the disconnection process. You must specify one of the following modes (there is no default):
A recommended best practice is to run Use abort mode only as a last resort if transactional and immediate levels do not result in all connections being closed. Abort may result in loss of data. Abort abruptly causes every user and Note: Execution in immediate mode also disconnects idle connections. Execution in transactional mode does not. |
|
|
Specifies whether the command should return immediately (the default) or wait until all disconnections finish. With Database management commands initiate a state change that is recorded in the active management instance of the grid. More specifically, the The If there is a large number of connections, it may not be advisable to use Note: Even when using |
Examples
This example:
-
Uses
dbStatusto show existing connections. -
Closes the database and confirms.
-
Disconnects in transactional mode (without wait).
-
Checks status of the
dbDisconnectcommand withdbDisconnectStatusand the status of the connections withdbStatus. (ThedbDisconnectcommand is in progress and the connections still exist.) -
Disconnects in immediate mode (without wait), to be sure connections are closed.
-
Again checks status of the
dbDisconnectcommand withdbDisconnectStatusand the status of the connections withdbStatus. (ThedbDisconnectcommand has completed and the connections are gone.)
% ttGridAdmin dbStatus database1 -connections Host Instance ConnId Name Pid Type CHost CAddr CPid ---------- --------- ------ --------- ----- ------ ----- ----- ---- mysys5host instance3 1 database1 20233 Direct mysys4host instance2 1 database1 26529 Direct mysys3host instance1 1 database1 1600 Direct mysys6host instance4 1 database1 1678 Direct % ttGridAdmin dbClose database1 Database database1 close started % ttGridAdmin dbStatus database1 Database database1 summary status as of Tue Sep 27 16:12:16 PST 2021 created,loaded-complete,closed Completely created elements: 4 (of 4) Completely loaded elements: 4 (of 4) Completely created replica sets: 2 (of 2) Completely loaded replica sets: 2 (of 2) Open elements: 0 (of 4)
First try disconnecting in transactional mode:
% ttGridAdmin dbDisconnect database1 -transactional Database database1 dbDisconnect started
% ttGridAdmin dbDisconnectStatus database1
Database Host Instance Elem State Started
--------- ---------- --------- ---- ------------- ------------------------
database1 Disconnecting 2021-09-27T16:12:55.000Z
mysys5host instance3 1 Disconnecting
mysys4host instance2 2 Disconnecting
mysys3host instance1 3 Disconnecting
mysys6host instance4 4 Disconnecting
% ttGridAdmin dbStatus -connections
Database database1:
Host Instance ConnId Name Pid Type CHost CAddr CPid
---------- --------- ------ --------- ----- ------ ----- ----- ----
mysys5host instance3 1 database1 20233 Direct
mysys4host instance2 1 database1 26529 Direct
mysys3host instance1 1 database1 1600 Direct
mysys4host instance4 1 database1 1678 Direct
Try again in immediate mode:
% ttGridAdmin dbDisconnect database1 -immediate Database database1 dbDisconnect started
Check status again—now the connections are gone.:
% ttGridAdmin dbDisconnectStatus database1
Database Host Instance Elem State Started
--------- ---------- --------- ---- ------------ ------------------------
database1 Complete 2021-09-27T16:14:03.000Z
mysys5host instance3 1 Disconnected
myshs4host instance2 2 Disconnected
mysys3host instance1 3 Disconnected
mysys6host instance4 4 Disconnected
% ttGridAdmin dbStatus database1 -connections
Host Instance ConnId Name Pid Type CHost CAddr CPid
---- -------- ------ ---- --- ---- ----- ----- ----
%Notes
-
The database must be in a closed state before you run this command. (Closing a database does not affect existing connections, but does prevent new connections.)
-
In TimesTen Scaleout, the capability to force disconnections is always enabled and the
forceDisconnectEnabledconnection attribute is ignored.