Database data changing method and device
By analyzing and automatically executing database data change requests, the complex problems of frequent adjustment and rollback management of transaction switches in banking business are solved, efficient automatic implementation and intelligent safe rollback are achieved, and data change efficiency and security are improved.
Patent Information
- Application Number
- CN202111304883.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-05
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2041-11-05
AI Technical Summary
During the iteration of the banking business version, the frequent adjustment and rollback management of transaction switches in the database are complex, resulting in high costs of manual execution and rollback, and there is a risk of operational errors and rollbacks without closed loops.
By analyzing data change requests, obtaining data backup and unique identifiers, automatically judge and performing data change and rollback operations, ensuring the consistency of data within the start and end time of the change, and providing automatic safe rollback function.
It improves the efficiency of database data change, reduces the cost of manual execution and fallback, reduces the risk of operational errors and rollbacks, and realizes efficient automatic implementation and intelligent safe rollbacks.
Smart Images

Figure CN113986939B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of databases, and in particular to a method and device for changing data in a database. Background Art
[0002] As banking business functions become richer and iterations accelerate, the coupling between product systems and the risk of going online are getting higher and higher. To ensure the stable operation of banking business, the product system deploys transaction switches in the database to control the old and new versions of transactions, grayscale strategies, and promotion scope.
[0003] Since the data status in the database (such as the transaction switch status) has a critical impact on business transactions, each switch will be repeatedly adjusted and verified during the version iteration test. When encountering important business demand transformation, dozens or even hundreds of switches will be added to each key system.
[0004] The existing change testing method is that the functional tester submits the data change content and window through the change management system, and then the system administrator assigns the corresponding technician to implement it, and then confirms the restoration of the parameters according to the deadline. This has the following practical problems:
[0005] 1. For large-scale business transformation, such as accounting system reconstruction, thousands of transaction switches are involved, and the duration is several months or even longer. However, versions are released daily and put into production weekly, and the cost of frequent manual execution and rollback of changes is high.
[0006] 2. The data types are complex. For example, transaction switch values include region codes, whitelists, Boolean values, transaction codes, service interfaces, etc. Technical personnel are prone to operational errors during manual implementation and rollback.
[0007] 3. Rollback management is highly complex. Technical personnel have cognitive limitations. Confirming the change rollback operation cannot be simply restored through historical backups. Technical personnel need to judge what state should be restored based on the latest situation of continuous version delivery. Transaction switch rollback has risks such as unclosed changes and inconsistency with actual production configuration. Summary of the invention
[0008] In view of the problems existing in the prior art, the main purpose of the embodiments of the present invention is to provide a method and device for changing data in a database, so as to improve the efficiency of data changes in the database and provide automatic and safe rollback of changes with high efficiency.
[0009] In order to achieve the above object, an embodiment of the present invention provides a method for changing data in a database, the method comprising:
[0010] Parse the acquired data change request to obtain the change operation information, data change statement, change start time and change end time;
[0011] According to the data change statement, a data backup and a data row unique identifier corresponding to the data to be changed are obtained from the database;
[0012] According to the change operation information, the change start time and the data row unique identifier, data change processing is performed on the data to be changed in the database to obtain a second update timestamp;
[0013] According to the change end time and the data row unique identifier, the current update timestamp is obtained from the database. If it is learned that the second update timestamp is the same as the current update timestamp, data rollback is performed on the database according to the data backup.
[0014] Optionally, in an embodiment of the present invention, the data backup and data row unique identifier corresponding to the data to be changed are obtained from the database according to the data change statement:
[0015] Determine the location information of the data to be changed according to the data change statement;
[0016] According to the location information of the data to be changed, a data backup and a data row unique identifier corresponding to the data to be changed are obtained from a database.
[0017] Optionally, in an embodiment of the present invention, the data change method further includes: receiving change error information sent by the database, and performing data rollback processing on the database according to the change error information and the data backup.
[0018] Optionally, in an embodiment of the present invention, the data change method further includes: acquiring a first update timestamp corresponding to the data to be changed from a database according to the data change statement.
[0019] Optionally, in an embodiment of the present invention, the data changing method further includes:
[0020] Compare the first update timestamp with the second update timestamp to obtain a comparison result;
[0021] If the comparison result is the same, data rollback processing is performed on the database according to the data backup and the data row unique identifier.
[0022] The embodiment of the present invention further provides a data modification device for a database, the data modification device comprising:
[0023] The change request module is used to parse the acquired data change request to obtain the change operation information, data change statement, change start time and change end time;
[0024] A data backup module, used to obtain data backup and data row unique identifier corresponding to the data to be changed from the database according to the data change statement;
[0025] A data change module, used for performing data change processing on the data to be changed in the database according to the change operation information, the change start time and the data row unique identifier, to obtain a second update timestamp;
[0026] A data rollback module is used to obtain a current update timestamp from the database according to the change end time and the data row unique identifier, and if it is learned that the second update timestamp is the same as the current update timestamp, the database is rolled back according to the data backup.
[0027] Optionally, in an embodiment of the present invention, the data backup module includes:
[0028] A location information unit, used to determine the location information of the data to be changed according to the data change statement;
[0029] The data backup unit is used to obtain the data backup and data row unique identifier corresponding to the data to be changed from the database according to the location information of the data to be changed.
[0030] Optionally, in an embodiment of the present invention, the data change device further includes: a change error reporting module, configured to receive change error reporting information sent by the database, and perform data rollback processing on the database according to the change error reporting information and the data backup.
[0031] Optionally, in an embodiment of the present invention, the data backup module is further used to obtain a first update timestamp corresponding to the data to be changed from the database according to the data change statement.
[0032] Optionally, in one embodiment of the present invention, the data change device also includes: a timestamp comparison module, used to compare the first update timestamp with the second update timestamp to obtain a comparison result; if the comparison result is the same, the database is rolled back according to the data backup and the data row unique identifier.
[0033] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above method when executing the program.
[0034] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for executing the above method.
[0035] The present invention realizes automatic implementation and rollback of changes by setting change timing and automatically judging rollback conditions, thereby improving the efficiency of business system data changes and providing a test environment for efficient and automatic implementation of data changes and intelligent and safe rollback. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 A flowchart of a method for changing data in a database according to an embodiment of the present invention;
[0038] Figure 2 This is a flowchart of obtaining information related to data to be updated in an embodiment of the present invention;
[0039] Figure 3 This is a flowchart of data rollback in an embodiment of the present invention;
[0040] Figure 4 A schematic diagram of the structure of a system for applying a method for changing database data in an embodiment of the present invention;
[0041] Figure 5 A flow chart of a method for changing data in an embodiment of the present invention;
[0042] Figure 6 A schematic diagram of the parsing of a change statement in an embodiment of the present invention;
[0043] Figure 7 A schematic diagram of recording a second update timestamp in an embodiment of the present invention;
[0044] Figure 8 A schematic diagram of querying the current update timestamp in an embodiment of the present invention;
[0045] Fig. 9 A schematic diagram of the structure of a device for changing data in a database according to an embodiment of the present invention;
[0046] Fig.10 This is a schematic diagram of the structure of a data backup module in an embodiment of the present invention;
[0047] Fig.11 It is a schematic diagram of the structure of a data changing device of a database in another embodiment of the present invention;
[0048] Fig.12 It is a structural schematic diagram of a data changing device of a database in another embodiment of the present invention;
[0049] Fig.13 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0050] The embodiments of the present invention provide a method and device for changing database data, which can be used in the financial field and other fields. It should be noted that the data change of the database of the present invention can be used in the financial field, and can also be used in any field other than the financial field. The application field of the data change of the database of the present invention is not limited.
[0051] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0052] like Figure 1 The flowchart of a method for changing database data in an embodiment of the present invention is shown. The execution subject of the method for changing database data in an embodiment of the present invention can be a change management system, including but not limited to a computer. The method shown in the figure includes:
[0053] Step S1, parsing the acquired data change request to obtain change operation information, data change statement, change start time and change end time.
[0054] The user initiates a data change by submitting a data change request. The data change request includes change operation information, data change statement, change start time and change end time. The above information can be obtained by parsing the data change request.
[0055] Furthermore, the change operation information indicates the specific change operation to be performed on the data to be changed, such as modifying the value of the data or deleting the data. The data change statement is an SQL statement used to query the unique identifier of the data row to be changed and the update timestamp, and the data change statement includes the location information of the data to be changed. The change start time and the change end time respectively identify the start time and end time of the change implementation. For example, if the time for submitting the data change request is 9 am on Monday, the change start time can be 9 am on Tuesday, and the change end time can be 5 pm on Friday.
[0056] Step S2: According to the data change statement, a data backup and a data row unique identifier corresponding to the data to be changed are obtained from the database.
[0057] The data change statement is sent to a database, such as an Oracle database, and the database automatically parses the data change data. When the database receives the data change statement, it automatically backs up the data to be changed and generates a data backup, whereby the database returns the data backup corresponding to the data to be changed and a unique identifier of the data row.
[0058] Furthermore, the unique identifier of a data row can be called a rowid in an Oracle database. It is usually used to access data within an Oracle database. A rowid requires 10 bytes of storage space and is displayed using 18 characters. The value indicates the physical location of the row in the Oracle database.
[0059] As an embodiment of the present invention, the method further includes: acquiring a first update timestamp corresponding to the data to be changed from a database according to the data change statement.
[0060] The data change statement is sent to the database, and the database automatically parses the data change data, and the database returns the first update timestamp corresponding to the data to be changed.
[0061] Furthermore, ora_rowscn in the Oracle database indicates the last modification of the block where each record is located in the Oracle database, which can be converted into a specific modification time, i.e., an update timestamp, by using Oracle's built-in SCN and timestamp conversion function scn_to_timestamp. When a record is modified, the ora_rowscn will change, and the first update timestamp obtained will be used as the first update timestamp.
[0062] Step S3: performing data change processing on the data to be changed in the database according to the change operation information, the change start time and the data row unique identifier to obtain a second update timestamp.
[0063] When the change start time is reached, the address of the data to be changed is determined using the data row unique identifier, and the data to be changed in the database is processed according to the change operation information. Specifically, the data to be changed is modified or deleted according to the change operation information. After the data change processing is completed, the ora_rowscn corresponding to the changed data will change, and the update timestamp obtained according to ora_rowscn is used as the second update timestamp.
[0064] Step S4, obtaining the current update timestamp from the database according to the change end time and the data row unique identifier, and if it is learned that the second update timestamp is the same as the current update timestamp, performing data rollback processing on the database according to the data backup.
[0065] When the change end time is reached, the address of the changed data, that is, the address of the data to be changed before the change processing, is determined using the data row unique identifier, and the update timestamp corresponding to the data at the current address is obtained from the database as the current update timestamp.
[0066] Furthermore, the second update timestamp is compared with the current update timestamp. If the second update timestamp is the same as the current update timestamp, it means that the data has not been changed twice during the period from the start to the end of the change. Then, according to the above data backup, the data at this address in the database is rolled back, thereby restoring the data to the state before the data change process. If the second update timestamp is different from the current update timestamp, it means that the data has been changed twice during the period from the start to the end of the change, which is equivalent to the data change process being terminated in advance, and there is no need to roll back the data.
[0067] Furthermore, rollback refers to the act of restoring a program or data to its last correct state when a program or data processing error occurs. Rollback includes program rollback and data rollback. The data rollback process in the present invention is to restore the data after the change has been implemented to the state before the change.
[0068] As an embodiment of the present invention, Figure 2 As shown, according to the data change statement, obtaining the data backup and data row unique identifier corresponding to the data to be changed from the database includes:
[0069] Step S21, determining the location information of the data to be changed according to the data change statement;
[0070] Step S22: acquiring, from a database according to the location information of the data to be changed, a data backup and a data row unique identifier corresponding to the data to be changed.
[0071] The data change statement includes location information of the data to be changed. According to the location information, after the data change statement is sent to the database, a data backup and a data row unique identifier of the data to be changed corresponding to the location can be obtained from the database.
[0072] As an embodiment of the present invention, the data change method further includes: receiving change error information sent by the database, and performing data rollback processing on the database according to the change error information and the data backup.
[0073] After the database is changed, if a change error message is received from the database, the database is rolled back according to the change error message and data backup. Specifically, if the change error message indicates that the change has failed, the corresponding data in the database is restored to the state before the change according to the data backup.
[0074] As an embodiment of the present invention, Figure 3 As shown, the data changing method also includes:
[0075] Step S31, comparing the first update timestamp with the second update timestamp to obtain a comparison result;
[0076] Step S32: If the comparison result is the same, data rollback is performed on the database according to the data backup and the data row unique identifier.
[0077] After the database is processed for data change, in addition to receiving the change error information actively sent by the database, the first update timestamp is compared with the second update timestamp to determine whether the data change is successfully implemented.
[0078] Further, the first update timestamp is compared with the second update timestamp to obtain a comparison result. If the first update timestamp is consistent with the second update timestamp, the comparison result is the same. If they are inconsistent, the comparison result is different. If the comparison result is the same, it means that the change implementation failed and the data has not been changed. Then, according to the data address corresponding to the unique identifier of the data row, the corresponding data in the database is rolled back using the data backup to restore the data to the state before the data change process was implemented.
[0079] In a specific embodiment of the present invention, Figure 4 The figure shows a schematic diagram of the structure of a change management system that applies the method for changing the data in the database of the present invention. The change management system is applicable to the change scenario of transaction parameters under Oracle, which can greatly improve the efficiency of parameter switch changes in the banking business system and provide a test environment for efficient automatic implementation of changes and intelligent and safe rollback. The change management system shown in the figure includes: a change statement module, an automatic implementation module for changes, an intelligent rollback module for changes, and a change result reminder module. Figure 5 The figure shows the flow chart of data change in the system, and the specific process is described as follows.
[0080] In this embodiment, the change statement module is used to receive and parse data change requests, obtain change operation information, data change statements, change start time and change end time, and send the data change statements to the database for parsing and processing to obtain data backup, data row unique identifier and first update timestamp feedback from the database.
[0081] The data change statement is a SQL statement that queries the unique rowid and ora_rowscn update stamp of the change table data row, such as Figure 6 As shown. Data change statement parsing uses the sqlparse package of Python's sql parser module to parse the change statement, and the database automatically generates data backup according to the data change statement.
[0082] In this embodiment, the automatic implementation module is used for the automatic implementation process and the operation line recording process.
[0083] The automatic implementation process implements the changes to the target Oracle database, including automatically identifying the database associated with the change, automatically submitting the execution, and returning the results. The automatic implementation process automatically accesses the corresponding database through the authorized user after the change start time according to the change operation information, submits and executes the change SQL.
[0084] Furthermore, the operation row recording process is to identify the latest status of the changed data row through the query SQL generated by the automatic implementation process when the change is automatically implemented, obtain the unique identifier rowid and update stamp ora_rowscn of the operation data row in the change database, that is, the second update timestamp, and record it, such as Figure 7 shown.
[0085] In this embodiment, the change intelligent rollback module is used to intelligently judge the expired changes and automatically implement rollback according to the change end time.
[0086] The intelligent change rollback module checks the expired changes in the change management system on a daily basis. After detecting an expired change, the intelligent change rollback module automatically executes the query SQL statement based on the unique identifier of the changed data and the update stamp to query the latest unique identifier rowid and ora_rowscn update stamp status of the changed data row, that is, the current update timestamp.
[0087] Furthermore, if the query results are Figure 7 If the query results are consistent, it means that the continuous delivery version has not changed the relevant parameters during the change period. In this case, restore the backup data and roll back the changes. Figure 8 As shown, it means that during the change period, the continuous delivery version has changed related parameters. In this case, it means that the test environment and version are consistent and the same as the actual production status, so it should not be rolled back. At this time, the change can be automatically closed directly.
[0088] In this embodiment, the change result reminder module is used to remind the change applicant, system administrator, and technician of the results of the automatic execution and intelligent rollback of the change. Specifically, it can determine whether the data change processing is implemented by receiving the change error information of the database, or comparing the first update timestamp with the first update timestamp, etc., thereby obtaining the change implementation result and reminding the relevant personnel.
[0089] The change management system of the present invention uses Oracle's native scn_to_timestamp method and rowid, ora_rowscn object mechanism, combined with implementation change operation information, and uses algorithmic timing identification and intelligent judgment of parameter rollback conditions, and automatically triggers rollback and outputs change processing information to associated personnel.
[0090] The present invention automatically implements and rolls back changes by changing the timing and automatically judging the rollback conditions, thereby improving the efficiency of business system parameter changes and providing a test environment for efficient and automatic implementation of transaction parameter changes and intelligent and safe rollback.
[0091] like Fig. 9 FIG. 1 is a schematic diagram of a structure of a data modification device for a database according to an embodiment of the present invention. The device shown in the figure includes:
[0092] The change request module 10 is used to parse the acquired data change request to obtain change operation information, data change statement, change start time and change end time.
[0093] The user initiates a data change by submitting a data change request. The data change request includes change operation information, data change statement, change start time and change end time. The above information can be obtained by parsing the data change request.
[0094] Furthermore, the change operation information indicates the specific change operation on the data to be changed, such as modifying the value of the data, or deleting the data. The data change statement is a SQL statement used to query the unique identifier of the data row to be changed and the update timestamp. The data change statement includes the location information of the data to be changed. The change start time and change end time respectively indicate the start time and end time of the change implementation.
[0095] The data backup module 20 is used to obtain the data backup and data row unique identifier corresponding to the data to be changed from the database according to the data change statement.
[0096] The data change statement is sent to a database, such as an Oracle database, and the database automatically parses the data change data. When the database receives the data change statement, it automatically backs up the data to be changed and generates a data backup, whereby the database returns the data backup corresponding to the data to be changed and a unique identifier of the data row.
[0097] Furthermore, the unique identifier of a data row can be called a rowid in an Oracle database. It is usually used to access data within an Oracle database. A rowid requires 10 bytes of storage space and is displayed using 18 characters. The value indicates the physical location of the row in the Oracle database.
[0098] As an embodiment of the present invention, the data backup module 20 is further configured to obtain a first update timestamp corresponding to the data to be changed from the database according to the data change statement.
[0099] Furthermore, ora_rowscn in the Oracle database indicates the last modification of the block where each record is located in the Oracle database, which can be converted into a specific modification time, i.e., an update timestamp, by using Oracle's built-in SCN and timestamp conversion function scn_to_timestamp. When a record is modified, the ora_rowscn will change, and the first update timestamp obtained will be used as the first update timestamp.
[0100] The data change module 30 is used to perform data change processing on the data to be changed in the database according to the change operation information, the change start time and the data row unique identifier to obtain a second update timestamp.
[0101] When the change start time is reached, the address of the data to be changed is determined using the data row unique identifier, and the data to be changed in the database is processed according to the change operation information. Specifically, the data to be changed is modified or deleted according to the change operation information. After the data change processing is completed, the ora_rowscn corresponding to the changed data will change, and the update timestamp obtained according to ora_rowscn is used as the second update timestamp.
[0102] The data rollback module 40 is used to obtain the current update timestamp from the database according to the change end time and the data row unique identifier, and if it is known that the second update timestamp is the same as the current update timestamp, the database is rolled back according to the data backup.
[0103] When the change end time is reached, the address of the changed data, that is, the address of the data to be changed before the change processing, is determined using the data row unique identifier, and the update timestamp corresponding to the data at the current address is obtained from the database as the current update timestamp.
[0104] Furthermore, the second update timestamp is compared with the current update timestamp. If the second update timestamp is the same as the current update timestamp, it means that the data has not been changed twice during the period from the start to the end of the change. Then, according to the above data backup, the data at this address in the database is rolled back, thereby restoring the data to the state before the data change process. If the second update timestamp is different from the current update timestamp, it means that the data has been changed twice during the period from the start to the end of the change, which is equivalent to the data change process being terminated in advance, and there is no need to roll back the data.
[0105] As an embodiment of the present invention, Fig.10 As shown, the data backup module 20 includes:
[0106] A location information unit 21, used to determine the location information of the data to be changed according to the data change statement;
[0107] The data backup unit 22 is used to obtain the data backup and data row unique identifier corresponding to the data to be changed from the database according to the location information of the data to be changed.
[0108] As an embodiment of the present invention, Fig.11 As shown, the data change device further includes: a change error reporting module 50, which is used to receive change error reporting information sent by the database, and perform data rollback processing on the database according to the change error reporting information and the data backup.
[0109] As an embodiment of the present invention, Fig.12 As shown, the data change device also includes: a timestamp comparison module 60, which is used to compare the first update timestamp with the second update timestamp to obtain a comparison result; if the comparison result is the same, the database is rolled back according to the data backup and the data row unique identifier.
[0110] Based on the same application concept as the above-mentioned method for changing data in a database, the present invention also provides a device for changing data in a database. Since the principle of solving the problem by the device for changing data in a database is similar to that of the method for changing data in a database, the implementation of the device for changing data in a database can refer to the implementation of the method for changing data in a database, and the repeated parts will not be repeated.
[0111] The present invention automatically implements and rolls back changes by changing the timing and automatically judging the rollback conditions, thereby improving the efficiency of business system parameter changes and providing a test environment for efficient and automatic implementation of transaction parameter changes and intelligent and safe rollback.
[0112] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above method when executing the program.
[0113] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for executing the above method.
[0114] like Fig.13 As shown, the electronic device 600 may further include: a communication module 110, an input unit 120, an audio processing unit 130, a display 160, and a power supply 170. It is worth noting that the electronic device 600 does not necessarily have to include Fig.10 In addition, the electronic device 600 may also include Fig.13 For components not shown, reference may be made to the prior art.
[0115] like Fig.13 As shown, the central processor 100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor devices and / or logic devices. The central processor 100 receives inputs and controls the operations of various components of the electronic device 600.
[0116] The memory 140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 100 may execute the program stored in the memory 140 to implement information storage or processing.
[0117] The input unit 120 provides input to the CPU 100. The input unit 120 is, for example, a key or a touch input device. The power supply 170 is used to provide power to the electronic device 600. The display 160 is used to display display objects such as images and text. The display may be, for example, an LCD display, but is not limited thereto.
[0118] The memory 140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 140 may also be some other type of device. The memory 140 includes a buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application / function storage unit 142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 600 through the central processor 100.
[0119] The memory 140 may also include a data storage unit 143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 144 of the memory 140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).
[0120] The communication module 110 is a transmitter / receiver 110 that transmits and receives signals via an antenna 111. The communication module (transmitter / receiver) 110 is coupled to the central processor 100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.
[0121] Based on different communication technologies, multiple communication modules 110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module. The communication module (transmitter / receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide an audio output via the speaker 131 and receive an audio input from the microphone 132, thereby realizing a common telecommunication function. The audio processor 130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 130 is also coupled to the central processor 100, so that the sound can be recorded on the local machine through the microphone 132, and the sound stored on the local machine can be played through the speaker 131.
[0122] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0123] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0124] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0125] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0126] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for changing data in a database, characterized in that: The data changing method comprises: Parse the acquired data change request to obtain the change operation information, data change statement, change start time and change end time; According to the data change statement, a data backup and a data row unique identifier corresponding to the data to be changed are obtained from the database; According to the change operation information, the change start time and the data row unique identifier, data change processing is performed on the data to be changed in the database to obtain a second update timestamp; wherein the second update timestamp is an update timestamp corresponding to the data to be changed after the data change processing is completed; According to the change end time and the data row unique identifier, the current update timestamp is obtained from the database, and if it is known that the second update timestamp is the same as the current update timestamp, data rollback is performed on the database according to the data backup; wherein the current update timestamp is the update timestamp corresponding to the data in the address of the data to be changed when the change end time is reached; According to the data change statement, a first update timestamp corresponding to the data to be changed is obtained from the database; wherein the first update timestamp is the timestamp information corresponding to the data to be changed returned by the database when the data change statement is sent to the database; Comparing the first update timestamp with the second update timestamp to obtain a comparison result; If the comparison result is the same, performing data rollback processing on the database according to the data backup and the data row unique identifier; According to the data change processing results, message reminders are sent to change applicants, system administrators, and technical personnel; The database is an Oracle database, the data row unique identifier is a rowid in the Oracle database, and the update timestamp is obtained by converting ora_rowscn into a specific modification time through Oracle's built-in SCN and timestamp conversion function scn_to_timestamp.
2. The data changing method according to claim 1, characterized in that: The step of obtaining the data backup and the data row unique identifier corresponding to the data to be changed from the database according to the data change statement comprises: Determine the location information of the data to be changed according to the data change statement; According to the location information of the data to be changed, a data backup and a data row unique identifier corresponding to the data to be changed are obtained from a database.
3. The data changing method according to claim 1, characterized in that: The data change method further includes: receiving change error information sent by the database, and performing data rollback processing on the database according to the change error information and the data backup.
4. A data changing device for a database, characterized in that: The data changing device comprises: The change request module is used to parse the acquired data change request to obtain the change operation information, data change statement, change start time and change end time; A data backup module, used to obtain data backup and data row unique identifier corresponding to the data to be changed from the database according to the data change statement; A data change module, configured to perform data change processing on the data to be changed in the database according to the change operation information, the change start time and the data row unique identifier, and obtain a second update timestamp; wherein the second update timestamp is an update timestamp corresponding to the data to be changed after the data change processing is completed; A data rollback module is used to obtain a current update timestamp from the database according to the change end time and the data row unique identifier, and if it is learned that the second update timestamp is the same as the current update timestamp, perform data rollback processing on the database according to the data backup; wherein the current update timestamp is the update timestamp corresponding to the data in the address of the data to be changed when the change end time is reached; The data backup module is also used to obtain a first update timestamp corresponding to the data to be changed from the database according to the data change statement; wherein the first update timestamp is the timestamp information corresponding to the data to be changed returned by the database when the data change statement is sent to the database; The data change device further includes: a timestamp comparison module, configured to compare the first update timestamp with the second update timestamp to obtain a comparison result; if the comparison result is the same, performing data rollback processing on the database according to the data backup and the data row unique identifier; The device further comprises: The change result reminder module is used to send message reminders to the change applicant, system administrator and technical personnel according to the data change processing results; The database is an Oracle database, the data row unique identifier is a rowid in the Oracle database, and the update timestamp is obtained by converting ora_rowscn into a specific modification time through Oracle's built-in SCN and timestamp conversion function scn_to_timestamp.
5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 3 is implemented.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for executing the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Online change method and platform for database, computer device and readable medium
CN110489436A
Providing the timing of the last committed change to a row in a database table
US20050256897A1