Patent attributes
Techniques are described for performing session termination(s) for active sessions in response to a planned operation on a database server of a DBMS. In an embodiment, the DBMS receives a request for a planned operation on a database server. The database server may have session(s) established with a client system to receive request(s) to execute database command(s) on the DBMS. In response, the DBMS transmits to the client system a notification to drain a session with the database server, and the DBMS marks the sessions at the database to drain. The DBMS is configured to terminate any drain-marked sessions by the database server when a rule is satisfied, and the failover is expected to succeed, and/or that the session is unlikely to drain or to failover at a later point in the session lifecycle. The DBMS may identify, in a rule set, a rule having rule instructions to detect a possible termination point for the session before the drain timeout period expires. Based on the execution of the rule instructions before the drain timeout expires, the DBMS determines that a termination point for the session is detected where that session will failover. In such a way, sessions are failed over early and at points where the failover is expected to succeed.