The present invention relates generally to the field of computing, and more particularly to database schemas.
A database schema of a database system is the database's structure described in a formal language supported by the database management system (DBMS). The database schema refers to the organization of data as a blueprint of how a database is constructed. A database schema is a set of formulas (sentences) often referred to as integrity constraints imposed on a database. These integrity constraints may ensure compatibility between parts of the schema. All constraints are expressible in the same language. When a developer develops a software using a database, several versions of the database schema may exist either during the development life cycle of the database as well as when the database is in production in a customer environment.
According to one embodiment, a method for upgrading a database schema in real time, wherein the database schema is associated with a plurality of databases is provided. The method may include installing a first plugin on a database upgrade process associated with a database. The method may also include installing a second plugin on each database instance within the plurality of databases. The method may further include determining, by the first plugin, a delta associated with a final target version of the database schema. Additionally, the method may include outlining, by the second plugin, an existence of an incongruence, an existence of an override or an existence of a customization removal based on the determined delta. The method may also include performing, by the second plugin, a peer-to-peer broadcasting analysis between each database instance within the plurality of databases based on the outlining. The method may include defining, by the first plugin, a migration strategy for each database instance within the plurality of databases based on the peer-to-peer broadcasting analysis. The method may further include creating, by the first plugin, a script for upgrading the database schema on each database instance within the plurality of databases based on the defined migration.
According to another embodiment, a computer system for upgrading a database schema in real time, wherein the database schema is associated with a plurality of databases is provided. The computer system may include one or more processors, one or more computer-readable memories, one or more computer-readable tangible storage medium, and program instructions stored on at least one of the one or more tangible storage medium for execution by at least one of the one or more processors via at least one of the one or more memories, wherein the computer system is capable of performing a method. The method may include installing a first plugin on a database upgrade process associated with a database. The method may also include installing a second plugin on each database instance within the plurality of databases. The method may further include determining, by the first plugin, a delta associated with a final target version of the database schema. Additionally, the method may include outlining, by the second plugin, an existence of an incongruence, an existence of an override or an existence of a customization removal based on the determined delta. The method may also include performing, by the second plugin, a peer-to-peer broadcasting analysis between each database instance within the plurality of databases based on the outlining. The method may include defining, by the first plugin, a migration strategy for each database instance within the plurality of databases based on the peer-to-peer broadcasting analysis. The method may further include creating, by the first plugin, a script for upgrading the database schema on each database instance within the plurality of databases based on the defined migration.
According to yet another embodiment, a computer program product for upgrading a database schema in real time, wherein the database schema is associated with a plurality of databases is provided. The computer program product may include one or more computer-readable tangible storage medium and program instructions stored on at least one of the one or more tangible storage medium, the program instructions executable by a processor. The computer program product may include program instructions to install a first plugin on a database upgrade process associated with a database. The computer program product may also include program instructions to install a second plugin on each database instance within the plurality of databases. The computer program product may further include program instructions to determine, by the first plugin, a delta associated with a final target version of the database schema. Additionally, the computer program product may include program instructions to outline, by the second plugin, an existence of an incongruence, an existence of an override or an existence of a customization removal based on the determined delta. The computer program product may also include program instructions to perform, by the second plugin, a peer-to-peer broadcasting analysis between each database instance within the plurality of databases based on the outlining. The program instructions may include program instructions to define, by the first plugin, a migration strategy for each database instance within the plurality of databases based on the peer-to-peer broadcasting analysis. The computer program product may further include program instructions to create, by the first plugin, a script for upgrading the database schema on each database instance within the plurality of databases based on the defined migration.
These and other objects, features and advantages of the present invention will become apparent from the following detailed description of illustrative embodiments thereof, which is to be read in connection with the accompanying drawings. The various features of the drawings are not to scale as the illustrations are for clarity in facilitating one skilled in the art in understanding the invention in conjunction with the detailed description. In the drawings:
Detailed embodiments of the claimed structures and methods are disclosed herein; however, it can be understood that the disclosed embodiments are merely illustrative of the claimed structures and methods that may be embodied in various forms. This invention may, however, be embodied in many different forms and should not be construed as limited to the exemplary embodiments set forth herein. Rather, these exemplary embodiments are provided so that this disclosure will be thorough and complete and will fully convey the scope of this invention to those skilled in the art. In the description, details of well-known features and techniques may be omitted to avoid unnecessarily obscuring the presented embodiments.
Embodiments of the present invention relate to the field of computing, and more particularly to database schemas. The following described exemplary embodiments provide a system, method and program product to, among other things, provide a service for upgrading a database schema.
As previously described, when a developer develops a software using a database, several versions of the database schema may exist either during the development life cycle of the database as well as when the database is in production in a customer environment. Furthermore, when the database must be migrated to a new version due to a new build or a new production release, it may become difficult to manage all of the system peculiarities while being able to successfully upgrade the database. A common solution to such a problem may be to develop a set of scripts that has the capability to transform the starting schema into a new schema. However, such a mechanism often fails since the customization for each instance of the database may take a long time. Additionally, in the context of software being utilized as a service, the customization issues may become even larger since the volume of the database may be quite large for a single product. Therefore, it may be advantageous, among other things, to provide a dynamic, resilient, and flexible upgrade system strategy.
According to at least one embodiment, the database schema may be upgraded based on a real time schema validation and introspection to create a final script without failure rather than based on a static creation of upgrade scripts that depend on the specific starting points that may fail. Furthermore, according to one implementation, the present embodiment may be iterative so that according to a defined policy (e.g., add, modify, delete) or according to a role of the operator so that the goals may be achieved in a segmented way via multiple independent steps. Additionally, consistency rules may be added so that based on specified parameters, multiple databases may converge to a common schema or maintain the schema's peculiarities.
According to at least one implementation of the present embodiment, a plugin may be installed on a database that may be responsible for interaction between multiple databases in the same site, customer region or any defined group. The plugin may act differently according to the version control system that is client-server based since the main behavior of the present embodiment is client-client. Additionally, the plugin may provide the capability to define either some default, such as ‘when an index is removed from a table, keep it in the upgrade if other database instances have the same index’; however the plugin may also have the capability to define variable based rules (e.g., same group, same network, etc.) or trusted groups to use for the decision. Furthermore, the plugin may also be able (differently from the traditional ‘version control system’ that may statically decide or not decide code merging of code) to be adaptive toward the changes and build itself an upgrade strategy by site or by database role. The adaptation may also be dynamically adjusted based on performance statistics or real time data since the upgrade strategy may be live, operating in real time and able to respond to changes in the external conditions when a specific choice is triggered.
The present invention may be a system, a method, and/or a computer program product. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.
The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.
Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device.
Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention.
Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.
These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts or carry out combinations of special purpose hardware and computer instructions.
The following described exemplary embodiments provide a system, method and program product to provide a service for upgrading a database schema. According to at least one implementation, the present embodiment is based on a database plugin that may provide either the interfaces to be contacted by an installer program or the interfaces to cooperate with other database instances. Moreover, the specific plugin may also host a set of behavior profiles ‘instrumenting’ the upgrade process about the default choices. An example of an instruction in the profile may be, ‘when an index is removed from a table, keep it in the upgrade if other database instances have the same index’. When the plugin runs, it may be able to retrieve all the information about the target version of the database schema and storing the information in XML files, separating, for more selective use, the information about tables, constraints, indexes, sequences, views and grants for every database's schema. According to this approach, the schema migration may be consolidated in multiple steps that may be executed according to an iterative approach. Furthermore, when changes have to be applied, in order to upgrade an old database schema version, the plugin may compare the schema objects with the target ones outlining the differences and automatically creating the SQL statements that are needed to bring the database to the expected new version.
For example, if the NOT NULL constraint on the column C1 of the table S.T1 is added in the new version of the database, automatically the second application may generate the following SQL statements:
Referring now to
The client computer 102 may communicate with server computer 112 via the communications network 110. The communications network 110 may include connections, such as wire, wireless communication links, or fiber optic cables. As will be discussed with reference to
A program, such as a Database Schema Upgrade Program 108A and 108B may run on the client computer 102 or on the server computer 112. The Database Schema Upgrade Program 108A, 108B may provide a service for upgrading a database schema. According to at least one implementation of the present embodiment, the Database Schema Upgrade Program 108A, 108B may be implemented as a plugin and may be installed on a database that may be responsible for interaction between multiple databases in the same site, customer region or any defined group. The Database Schema Upgrade method is explained in further detail below with respect to
Referring now to
The Database Schema Upgrade Program 108A, 108B (
According to one implementation, the Database Schema Upgrade Program 108A, 108B (
Referring now to
Next at 304, the determined delta is identified by the upgrade process plugin component 214 (
Next at 308, peer-to-peer broadcasting analysis is performed by the database plugins 206-212 (
Then at 310, group analysis (regional based, LAN based, affinity based) may be gathered by the database plugins 206-212 (
Next at 312, decomposition of change set based on roles may be performed by the database plugins 206-212 (
Then at 314, the migration strategy may be defined identifying the number of migration phases and roles associated. As such, the upgrade strategy may be defined by the database plugins 206-212 (
Next, at 316, the first phase of migration may be performed by the database plugins 206-212 (
Then at 318, a set of changes may be implemented by the database plugins 206-212 (
Next at 320, statistical data may be used by the database plugins 206-212 (
Then at 322, once the upgrade strategy is built and/or executed by the upgrade process plugin component 214 (
Next at 324, the new target state may optionally be differently instantiated by the upgrade process plugin component 214 (
It may be appreciated that
The present embodiment may have the capability to successfully upgrade a database schema despite the peculiarities of the database and therefore, may be significant in distributed environments, such as a database schema that may be related to a software as a service solution where there is no prefixed starting schema. Also, the present embodiment may have advantages in terms of code maintenance since there may not be the need to maintain different versions of code associated with different versions of schemas. Furthermore, another advantage may be the built in capability to allow multiple role like standard operators or administrative operators to concur to the upgrade at different times according to an iterative approach. Additionally, the present embodiment may be able to consolidate schemas based on information matching and computation between multiple instances of the database.
Data processing system 800, 900 is representative of any electronic device capable of executing machine-readable program instructions. Data processing system 800, 900 may be representative of a smart phone, a computer system, PDA, or other electronic devices. Examples of computing systems, environments, and/or configurations that may represented by data processing system 800, 900 include, but are not limited to, personal computer systems, server computer systems, thin clients, thick clients, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, network PCs, minicomputer systems, and distributed cloud computing environments that include any of the above systems or devices.
User client computer 102 (
Each set of internal components 800a, b, also includes a R/W drive or interface 832 to read from and write to one or more portable computer-readable tangible storage devices 936 such as a CD-ROM, DVD, memory stick, magnetic tape, magnetic disk, optical disk or semiconductor storage device. A software program, such as Database Schema Upgrade Program 108A (
Each set of internal components 800a, b also includes network adapters or interfaces 836 such as a TCP/IP adapter cards, wireless Wi-Fi interface cards, or 3G or 4G wireless interface cards or other wired or wireless communication links. The Database Schema Upgrade Program 108A (
Each of the sets of external components 900a, b can include a computer display monitor 920, a keyboard 930, and a computer mouse 934. External components 900a, b can also include touch screens, virtual keyboards, touch pads, pointing devices, and other human interface devices. Each of the sets of internal components 800a, b also includes device drivers 840 to interface to computer display monitor 920, keyboard 930 and computer mouse 934. The device drivers 840, R/W drive or interface 832 and network adapter or interface 836 comprise hardware and software (stored in storage device 830 and/or ROM 824).
The descriptions of the various embodiments of the present invention have been presented for purposes of illustration, but are not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope of the described embodiments. The terminology used herein was chosen to best explain the principles of the embodiments, the practical application or technical improvement over technologies found in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.
Number | Date | Country | |
---|---|---|---|
Parent | 14306271 | Jun 2014 | US |
Child | 15429290 | US |