# US 2018/0025066 A1 · Zero downtime database updates with database configuration changes

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

- Number: US 2018/0025066 A1
- Document ID: US20180025066A1
- Status: Published application
- Kind: A1
- Application number: 15/214,144
- Filed: 2016-07-19
- Published: 2018-01-25
- Earliest claimed: 2016-07-19
- Assignees: Sap SE
- Applicants: Sap SE
- Inventors: Francis Lui; Leo Chi-Lok Yu; Ho Kei David Chan; Changching Chiu; Mahdi Tayarani Najaran
- Web page: https://patentgrep.com/patent/US20180025066A1

## CPC

- G06F 16/27: Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- G06F 8/656: while running
- G06F 12/0866: for peripheral storage systems, e.g. disk cache
- G06F 16/214: {Database migration support}
- G06F 16/219: {Managing data history or versioning (querying versioned data G06F16/2474; querying temporal data G06F16/2477)}
- G06F 16/24552: {Database cache management}
- H04L 61/5007: Internet protocol [IP] addresses
- G06F 2212/1024: Latency reduction
- G06F 2212/465: Structured object, e.g. database record
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

Technologies are described for performing database updates in a database environment where the database remains accessible during the updates. For example, a number of database clients may utilize a database environment for running queries or performing transactions. When an update to the database environment needs to be performed (e.g., a change to the database schema), instead of taking the database offline or queueing requests, the database can remain accessible to the database clients throughout the update process. The update process can include switching database connections between a first copy of the database and a second copy of the database that are being replicated. Technologies are also described for performing updates to application code used to interact with the database environment (e.g., alone or in combination with database system updates).

## Claims

### Claim 1

A method for performing zero downtime database updates in a database environment, the method comprising:
directing database connections from server applications to a first copy of a database, wherein the first copy of the database is being replicated to a second copy of the database, and wherein the second copy of the database is in a read-only mode;
stopping replication from the first copy of the database to the second copy of the database;
performing database system changes to the second copy of the database, the database system changes comprising database schema changes for the second copy of the database;
after performing the database system changes, resuming replication from the first copy of the database to the second copy of the database;
switching the database connections from the server applications to the second copy of the database; and
stopping replication form the first copy of the database to the second copy of the database, and starting replication from the second copy of the database to the first copy of the database;
wherein the database remains accessible throughout the zero downtime database update.

### Claim 2 (depends on 1)

The method of claim 1, wherein the changes to the second copy of the database further comprise database configuration changes.

### Claim 3 (depends on 1)

The method of claim 1, wherein the changes to the second copy of the database further comprise one or both of:
hardware changes to a server on which the second copy of the database is running; or
changes to software running on the server other than the second copy of the database.

### Claim 4 (depends on 1)

The method of claim 1, wherein switching the database connections comprises:
directing database connections received at a virtual Internet protocol (IP) address to the second copy of the database instead of the first copy of the database.

### Claim 5 (depends on 1)

The method of claim 1, wherein switching the database connections comprises:
instructing a load balancer to direct all database connection requests that comprise a write operation to the second copy of the database instead of the first copy of the database.

### Claim 6 (depends on 1)

The method of claim 1, wherein the database schema changes comprise:
adding one or more columns to an end of a table in the second copy of the database;
using default field values for the one or more added columns.

### Claim 7 (depends on 1)

The method of claim 1, wherein the first copy of the database and the second copy of the database are in a master-slave replication arrangement.

### Claim 8 (depends on 1)

The method of claim 1, wherein the server applications are initially running a first code version, the method further comprising:
after starting replication from the second copy of the database to the first copy of the database, deploying and activating a second code version of the server applications that are used by client and server devices to access the database.

### Claim 9

A server environment comprising:
a first computer server running a master copy of a database;
a second computer server running a slave copy of the database;
the server environment configured to perform operations for zero downtime database updates, the operations comprising:
directing database connections comprising write operations from server applications to the master copy of the database, wherein the master copy of the database is being replicated to the slave copy of the database, wherein the slave copy of the database is in a read-only mode, and wherein the server applications are running a current code version;
deploying a new code version of the server applications, wherein the new code version is inactive;
stopping replication from the master copy of the database to the slave copy of the database;
performing database system changes to the slave copy of the database, the database system changes comprising database schema changes for the slave copy of the database;
after performing the database system changes, resuming replication from the master copy of the database to the slave copy of the database;
once the master and slave copies are in sync, switching the copies of the database so that the slave copy of the database becomes a new master and the master copy of the database becomes a new slave, the switching comprising directing database connections with write operations to the new master;
wherein the database remains accessible throughout the zero downtime database update.

### Claim 10 (depends on 9)

The server environment of claim 9, wherein switching the copies of the database comprises:
setting the new master copy of the database to a read-write mode;
switching a virtual Internet protocol (IP) address to point to the new master copy of the database to direct database connections comprising write operations from the server applications to the new master copy of the database;
stopping replication from the new slave copy of the database to the new master copy of the database;
setting the new slave copy of the database to a read-only mode;
starting replication from the new master copy of the database to the new slave copy of the database; and
activating the new code version of the server applications.

### Claim 11 (depends on 9)

The server environment of claim 9, wherein the changes to the slave copy of the database further comprise database configuration changes.

### Claim 12 (depends on 9)

The server environment of claim 9, wherein the changes to the slave copy of the database further comprise one or both of:
hardware changes to the second computer server on which the slave copy of the database is running; or
changes to software running on the second computer server other than the slave copy of the database.

### Claim 13 (depends on 9)

The server environment of claim 9, wherein directing database connections with write operations to the new master comprises:
switching a virtual Internet protocol (IP) address used for directing database connections so that the virtual IP address directs the database connections to the new master copy of the database.

### Claim 14 (depends on 9)

The server environment of claim 9, wherein the database schema changes comprise:
adding one or more columns to an end of a table in the slave copy of the database;
using default field values for the one or more added columns.

### Claim 15 (depends on 14)

The server environment of claim 14, wherein before the new code version is activated and after the database schema changes are made, the current code version is configured to operate with the database schema changes.

### Claim 16

A method for performing zero downtime database updates in a database environment, the method comprising:
directing database connections, for write operations, from server applications to a first copy of a database, wherein the first copy of the database is being replicated to a second copy of the database, wherein the second copy of the database is in a read-only mode, and wherein the server applications are running a current code version;
maintaining a first set of entries in a memory cache for database records returned in the database connections when the server applications are running the current code version, the first set of entries associated with the current code version;
deploying a new code version of the server applications, wherein the new code version is inactive;
stopping replication from the first copy of the database to the second copy of the database;
performing database system changes to the second copy of the database, the database system changes comprising database schema changes for the second copy of the database;
after performing the database system changes, resuming replication from the first copy of the database to the second copy of the database;
switching the database connections, for write operations, from the server applications to the second copy of the database;
stopping replication form the first copy of the database to the second copy of the database, and starting replication from the second copy of the database to the first copy of the database; and
maintaining a second set of entries in the memory cache for database records returned in the database connections when the server applications are running the new code version, the second set of entries associated with the new code version;
wherein the database remains accessible throughout the zero downtime database update.

### Claim 17 (depends on 16)

The method of claim 16, wherein the first set of entries in the memory cache are associated with a first set of keys that include an indication of the current code version, and wherein the second set of entries in the memory cache are associated with a second set of keys that include an indication of the new code version.

### Claim 18 (depends on 16)

The method of claim 16, wherein the changes to the second copy of the database further comprise one or both of:
hardware changes to a server on which the second copy of the database is running; or
changes to software running on the server other than the second copy of the database.

### Claim 19 (depends on 16)

The method of claim 16, wherein switching the database connections comprises:
directing database connections received at a virtual Internet protocol (IP) address to the second copy of the database instead of the first copy of the database.

### Claim 20 (depends on 16)

The method of claim 16, wherein the database schema changes comprise:
adding one or more columns to an end of a table in the second copy of the database;
using default field values for the one or more added columns.
