# US 2021/0081382 A1 · Termination of database sessions for planned failover

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0081382 A1
- Document ID: US20210081382A1
- Status: Published application
- Kind: A1
- Application number: 17/018,142
- Filed: 2020-09-11
- Published: 2021-03-18
- Earliest claimed: 2019-09-12
- Assignees: Oracle International Corporation
- Applicants: Oracle International Corporation
- Inventors: CAROL L. COLRAIN; PEDRO ARTURO CORNEJO TORRES; KEVIN S. NEEL
- Web page: https://patentgrep.com/patent/US20210081382A1

## CPC

- G06F 16/21: Design, administration or maintenance of databases
- G06F 16/217: {Database tuning (G06F16/2282 takes precedence; database performance monitoring G06F11/3409)}
- G06F 16/2365: {Ensuring data consistency and integrity}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

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.

## Claims

### Claim 1

A computer-implemented method comprising:
receiving a request for a planned operation on a first database server of a DBMS, the first database server having a particular session established with a client system to receive one or more requests to execute one or more user calls on the DBMS;
in response to the request for a planned operation for the first database server, transmitting to the client system a request to drain sessions with the first database server including the particular session, the DBMS being configured to terminate any session with the first database server that has not been drained within a drain timeout period;
identifying, in a rule set, first rule data, the first rule data including first rule instructions to detect a possible termination point for the particular session before the drain timeout period expires;
based on execution of the first rule instructions before the drain timeout period expires, determining whether the termination point for the particular session is detected;
based on determining that the termination point for the particular session is detected, terminating the particular session of the client system with the DBMS at the termination point.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
in response to the request for the planned operation for the first database server, transmitting to the client system the request to drain sessions with the first database server including another session of the DBMS with the client system;
identifying, in the rule set, second rule data different from the first rule data, the second rule data including second rule instructions to detect a possible termination point for the other session before the drain timeout period expires;
based on execution of the second rule instructions before the drain timeout period expires, determining whether the termination point for the other session is detected;
based on determining that the termination point for the other session is detected, terminating the other session of the client system with the DBMS at the termination point.

### Claim 3 (depends on 1)

The method of claim 1, wherein the rule set includes a second rule data, the second rule data having a higher priority for execution than the first rule data, the method further comprising:
based on the second rule data having the higher priority for execution than the first rule data, executing second rule instructions of the second rule data;
based on the executing the second rule instructions, determining that no termination point is detected.

### Claim 4 (depends on 1)

The method of claim 1, wherein terminating the particular session at the termination point further comprises causing the client system to fail over to a second database server of the DBMS by establishing a new session with the second database.

### Claim 5 (depends on 1)

The method of claim 1, further comprising:
retrieving a set of historical session-level raw statistics for one or more previous sessions of the client system with the DBMS,
obtaining a set of current session-level raw statistics for the particular session of the client system with the DBMS at a particular snapshot point in the particular session;
based on the set of historical session-level raw statistics and the set of current session-level raw statistics, calculating one or more metrics for the particular session of the client system with the DBMS at the particular snapshot point in the particular session;
based at least in part on the one or more metrics for the particular session, determining whether the termination point for the particular session is detected at the particular snapshot point in the particular session.

### Claim 6 (depends on 1)

The method of claim 1, further comprising:
retrieving a set of historical session-level raw statistics for one or more previous sessions of the client system with the DBMS;
determining that the set of historical session-level raw statistics has missing session-level raw statistics for at least one aspect of the particular session;
identifying service-level raw statistics in the set of service-level statistics that corresponds to the at least one aspect of the particular session;
based at least in part on the set of historical session-level raw statistics and the service-level raw statistics in the place of the missing session-level raw statistics, calculating one or more metrics for the particular session of the client system with the DBMS;
based at least in part on the one or more metrics for the particular session, determining whether the termination point for the particular session is detected.

### Claim 7 (depends on 1)

The method of claim 1, further comprising:
based at least in part on raw statistics for the particular session between the client system and DBMS, calculating one or more metrics for the particular session of the client system with the DBMS;
based at least in part on the one or more metrics for the particular session, determining whether the termination point for the particular session is detected.

### Claim 8 (depends on 1)

The method of claim 1, further comprising:
based at least in part on raw statistics for the particular session between the client system and DBMS, calculating one or more metrics for the particular session of the client system with the DBMS;
based at least in part on the one or more metrics for the particular session, estimating whether each and every request in the particular session is expected to complete before the particular session drain time out.

### Claim 9 (depends on 1)

The method of claim 1, further comprising:
based at least in part on raw statistics for the particular session between the client system and DBMS, calculating one or more metrics for the particular session of the client system with the DBMS;
based at least in part on the one or more metrics for the particular session, determining a likelihood of the next request containing a non-recoverable command.

### Claim 10 (depends on 1)

The method of claim 1, further comprising:
determining whether within a portion of the drain timeout any command is issued from the client system to the DBMS over the particular session;
based on determining whether within the portion of the drain timeout any command is issued from the client system to the DBMS over the particular session, determining whether the termination point for the particular session is detected.

### Claim 11

One or more non-transitory computer-readable media storing instructions, wherein the instructions include a set of instructions, which when executed by one or more hardware processors, cause:
receiving a request for a planned operation on a first database server of a DBMS, the first database server having a session established with a client system to receive one or more requests to execute one or more user calls on the DBMS;
in response to the request for a planned operation for the first database server, transmitting to the client system a request to drain sessions with the first database server including the particular session, the DBMS being configured to terminate any session with the first database server that has not been drained within a drain timeout period;
identifying, in a rule set, first rule data, the first rule data including first rule instructions to detect a possible termination point for the particular session before the drain timeout period expires;
based on execution of the first rule instructions before the drain timeout period expires, determining whether the termination point for the particular session is detected;
based on determining that the termination point for the particular session is detected, terminating the particular session of the client system with the DBMS at the termination point.

### Claim 12 (depends on 11)

The one or more non-transitory computer-readable media of claim 11, wherein the set of instructions further include instructions, which, when executed by said one or more hardware processors, cause:
in response to the request for the planned operation for the first database server, transmitting to the client system the request to drain sessions with the first database server including another session of the DBMS with the client system;
identifying, in the rule set, second rule data different from the first rule data, the second rule data including second rule instructions to detect a possible termination point for the other session before the drain timeout period expires;
based on execution of the second rule instructions before the drain timeout period expires, determining whether the termination point for the other session is detected;
based on determining that the termination point for the other session is detected, terminating the other session of the client system with the DBMS at the termination point.

### Claim 13 (depends on 11)

The one or more non-transitory computer-readable media of claim 11, wherein the rule set includes a second rule data, the second rule data having a higher priority for execution than the first rule data, wherein the set of instructions further include instructions, which, when executed by said one or more hardware processors, cause:
based on the second rule data having the higher priority for execution than the first rule data, executing second rule instructions of the second rule data;
based on the executing the second rule instructions, determining that no termination point is detected.

### Claim 14 (depends on 11)

The one or more non-transitory computer-readable media of claim 11, wherein the set of instructions further include instructions, which, when executed by said one or more hardware processors, cause the client system to fail over to a second database server of the DBMS by establishing a new session with the second database server.

### Claim 15 (depends on 11)

The one or more non-transitory computer-readable media of claim 11, wherein the set of instructions further include instructions, which, when executed by said one or more hardware processors, cause:
retrieving a set of historical session-level raw statistics for one or more previous sessions of the client system with the DBMS,
obtaining a set of current session-level raw statistics for the particular session of the client system with the DBMS at a particular snapshot point in the particular session;
based on the set of historical session-level raw statistics and the set of current session-level raw statistics, calculating one or more metrics for the particular session of the client system with the DBMS at the particular snapshot point in the particular session;
based at least in part on the one or more metrics for the particular session, determining whether the termination point for the particular session is detected at the particular snapshot point in the particular session.

### Claim 16 (depends on 11)

The one or more non-transitory computer-readable media of claim 11, wherein the set of instructions further include instructions, which, when executed by said one or more hardware processors, cause:
retrieving a set of historical session-level raw statistics for one or more previous sessions of the client system with the DBMS;
determining that the set of historical session-level raw statistics has missing session-level raw statistics for at least one aspect of the particular session;
identifying service-level raw statistics in the set of service-level statistics that corresponds to the at least one aspect of the particular session;
based at least in part on the set of historical session-level raw statistics and the service- level raw statistics in the place of the missing session-level raw statistics, calculating one or more metrics for the particular session of the client system with the DBMS;
based at least in part on the one or more metrics for the particular session, determining whether the termination point for the particular session is detected.

### Claim 17 (depends on 11)

The one or more non-transitory computer-readable media of claim 11, wherein the set of instructions further include instructions, which, when executed by said one or more hardware processors, cause:
based at least in part on raw statistics for the particular session between the client system and DBMS, calculating one or more metrics for the particular session of the client system with the DBMS;
based at least in part on the one or more metrics for the particular session, determining whether the termination point for the particular session is detected.

### Claim 18 (depends on 11)

The one or more non-transitory computer-readable media of claim 11, wherein the set of instructions further include instructions, which, when executed by said one or more hardware processors, cause:
based at least in part on raw statistics for the particular session between the client system and DBMS, calculating one or more metrics for the particular session of the client system with the DBMS;
based at least in part on the one or more metrics for the particular session, estimating whether each and every request in the particular session is expected to complete before the particular session drain time out.

### Claim 19 (depends on 11)

The one or more non-transitory computer-readable media of claim 11, wherein the set of instructions further include instructions, which, when executed by said one or more hardware processors, cause:
based at least in part on raw statistics for the particular session between the client system and DBMS, calculating one or more metrics for the particular session of the client system with the DBMS;
based at least in part on the one or more metrics for the particular session, determining a likelihood of the next request containing a non-recoverable command.

### Claim 20 (depends on 11)

The one or more non-transitory computer-readable media of claim 11, wherein the set of instructions further include instructions, which, when executed by said one or more hardware processors, cause:
determining whether within a portion of the drain timeout any command is issued from the client system to the DBMS over the particular session;
based on determining whether within the portion of the drain timeout any command is issued from the client system to the DBMS over the particular session, determining whether the termination point for the particular session is detected.
