CN113986939A - Data change method and device for database - Google Patents
Data change method and device for database Download PDFInfo
- Publication number
- CN113986939A CN113986939A CN202111304883.1A CN202111304883A CN113986939A CN 113986939 A CN113986939 A CN 113986939A CN 202111304883 A CN202111304883 A CN 202111304883A CN 113986939 A CN113986939 A CN 113986939A
- Authority
- CN
- China
- Prior art keywords
- data
- change
- database
- changed
- backup
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 230000008859 change Effects 0.000 title claims abstract description 242
- 238000000034 method Methods 0.000 title claims abstract description 57
- 238000012545 processing Methods 0.000 claims abstract description 50
- 238000012508 change request Methods 0.000 claims abstract description 18
- 238000004590 computer program Methods 0.000 claims description 14
- 238000003860 storage Methods 0.000 claims description 13
- 238000012360 testing method Methods 0.000 abstract description 7
- 238000010586 diagram Methods 0.000 description 19
- 230000008569 process Effects 0.000 description 17
- 230000006870 function Effects 0.000 description 14
- 230000004048 modification Effects 0.000 description 10
- 238000012986 modification Methods 0.000 description 10
- 238000013070 change management Methods 0.000 description 7
- 238000004891 communication Methods 0.000 description 7
- 241000278713 Theora Species 0.000 description 6
- 239000000872 buffer Substances 0.000 description 4
- 238000004519 manufacturing process Methods 0.000 description 4
- 238000012384 transportation and delivery Methods 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000003203 everyday effect Effects 0.000 description 2
- 238000005096 rolling process Methods 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000001149 cognitive effect Effects 0.000 description 1
- 238000012790 confirmation Methods 0.000 description 1
- 230000008878 coupling Effects 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000002715 modification method Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 230000003442 weekly effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/235—Update request formulation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2358—Change logging, detection, and notification
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
A data change method and device of a database can be used in the field of databases, finance or other fields. The method comprises the following steps: analyzing the acquired data change request to obtain change operation information, a data change statement, change start time and change end time; acquiring a data backup and a data row unique identifier corresponding to data to be changed from a database; according to the change operation information, the change start time and the unique identifier of the data line, carrying out data change processing on the data to be changed to obtain a second update timestamp; and acquiring a current updating time stamp from the database according to the change ending time and the unique identifier of the data row, and performing data rollback processing on the database according to the data backup if the second updating time stamp is identical to the current updating time stamp. The invention automatically implements and rolls back the change, improves the data change efficiency of the service system, and provides a test environment for high-efficiency automatic implementation and intelligent safe roll back of the data change.
Description
Technical Field
The present invention relates to the field of database technologies, and in particular, to a method and an apparatus for changing data of a database.
Background
With the enrichment and the accelerated iteration of the banking business functions, the coupling degree between product systems and the online risk are higher and higher. In order to ensure the stable operation of banking business, a product system controls the new and old versions, the gray level strategy and the popularization range of transaction by deploying a transaction switch in a database.
Due to the critical influence of the data state (such as the transaction switch state) in the database on the business transaction, each switch is repeatedly adjusted and verified in the version iteration test process. When important business requirements are improved, the switches of each key system are increased by dozens or even hundreds.
The existing change mode of the test is that a function tester submits data change contents and windows through a change management system, a system administrator distributes corresponding technicians, the technicians are responsible for implementation, and the restoration of parameters is confirmed according to the deadline. This presents practical problems as follows:
1. for large-scale business demand transformation, such as financial system reconstruction, the related transaction switches reach thousands, the shelf life reaches months or even longer, but the versions are released every day and put into production on a weekly basis, and the cost of frequent manual execution and retroversion change is higher.
2. The data types are complex, for example, the transaction switch values comprise area codes, white lists, Boolean values, transaction codes, service interfaces and the like, and the manual implementation and rollback process of technicians is easy to operate and miss.
3. Rollback management is high in complexity, technical staff have cognitive limitation, change rollback operation cannot be simply restored through historical backup after confirmation, the technical staff need to judge what state the change rollback operation needs to be restored to according to the latest condition of continuous delivery of versions, and transaction switch rollback has risks of not changing a closed loop, being inconsistent with actual production configuration and the like.
Disclosure of Invention
In view of the problems in the prior art, embodiments of the present invention mainly aim to provide a method and an apparatus for changing data in a database, so as to improve the efficiency of changing data in the database and provide efficient automatic and safe rollback.
In order to achieve the above object, an embodiment of the present invention provides a data change method for a database, where the data change method includes:
analyzing the acquired data change request to obtain change operation information, a data change statement, change start time and change end time;
according to the data change statement, acquiring a data backup and a data row unique identifier corresponding to the data to be changed from a database;
according to the change operation information, the change start time and the unique data row identifier, performing data change processing on the data to be changed in the database to obtain a second update timestamp;
and acquiring a current updating time stamp from the database according to the change ending time and the unique identifier of the data row, and performing data rollback processing on the database according to the data backup if the second updating time stamp is identical to the current updating time stamp.
Optionally, in an embodiment of the present invention, the obtaining, according to the data change statement, a data backup and a data row unique identifier corresponding to data to be changed from a database includes:
determining the position information of the data to be changed according to the data change statement;
and acquiring a data backup and a data row unique identifier corresponding to the data to be changed from a database according to the position information of the data to be changed.
Optionally, in an embodiment of the present invention, the data changing method further includes: and receiving the change error reporting information sent by the database, and performing data rollback processing on the database according to the change error reporting information and the data backup.
Optionally, in an embodiment of the present invention, the data changing method further includes: and acquiring a first updating time stamp corresponding to the data to be changed from a database according to the data change statement.
Optionally, in an embodiment of the present invention, the data changing method further includes:
comparing the first update timestamp with the second update timestamp to obtain a comparison result;
and if the comparison results are the same, performing data rollback processing on the database according to the data backup and the unique identifier of the data row.
An embodiment of the present invention further provides a data changing apparatus for a database, where the data changing apparatus includes:
the change request module is used for analyzing the acquired data change request to obtain change operation information, a data change statement, change starting time and change ending time;
the data backup module is used for acquiring data backup and a data row unique identifier corresponding to the data to be changed from a database according to the data change statement;
the data change module is used for carrying out data change processing on the data to be changed in the database according to the change operation information, the change starting time and the unique data row identifier to obtain a second update timestamp;
and the data rollback module is used for acquiring a current updating time stamp from the database according to the change ending time and the unique data row identifier, and performing data rollback processing on the database according to the data backup if the second updating time stamp is identical to the current updating time stamp.
Optionally, in an embodiment of the present invention, the data backup module includes:
the position information unit is used for determining the position information of the data to be changed according to the data change statement;
and the data backup unit is used for acquiring the data backup and the unique data row identifier corresponding to the data to be changed from a database according to the position information of the data to be changed.
Optionally, in an embodiment of the present invention, the data changing apparatus further includes: and the change error reporting module is used for receiving the change error reporting information sent by the database and performing data rollback processing on the database according to the change error reporting information and the data backup.
Optionally, in an embodiment of the present invention, the data backup module is further configured to obtain, according to the data change statement, a first update timestamp corresponding to the data to be changed from a database.
Optionally, in an embodiment of the present invention, the data changing apparatus further includes: the timestamp comparison module is used for comparing the first update timestamp with the second update timestamp to obtain a comparison result; and if the comparison results are the same, performing data rollback processing on the database according to the data backup and the unique identifier of the data row.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method when executing the program.
The present invention also provides a computer-readable storage medium storing a computer program for executing the above method.
The invention realizes automatic implementation and rollback of the change by setting the change timing and automatically judging the rollback condition, improves the data change efficiency of the service system, and provides a test environment for efficient automatic implementation and intelligent safe rollback of the data change.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
FIG. 1 is a flowchart illustrating a method for changing data in a database according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating the acquisition of information related to data to be updated according to an embodiment of the present invention;
FIG. 3 is a flow chart of data rollback in an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a system for applying a database data modification method according to an embodiment of the present invention;
FIG. 5 is a flow chart of a data alteration method in accordance with an embodiment of the present invention;
FIG. 6 is a diagram illustrating change statement parsing according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating recording a second update timestamp in an embodiment of the present invention;
FIG. 8 is a diagram illustrating a query of a current update timestamp in an embodiment of the invention;
FIG. 9 is a schematic structural diagram of a database modification apparatus according to an embodiment of the present invention;
FIG. 10 is a block diagram of a data backup module according to an embodiment of the present invention;
FIG. 11 is a schematic structural diagram of a data modification apparatus for a database according to another embodiment of the present invention;
FIG. 12 is a diagram illustrating a structure of a database modification apparatus according to still another embodiment of the present invention;
fig. 13 is a schematic structural diagram of an electronic device according to an embodiment of the invention.
Detailed Description
The embodiment of the invention provides a method and a device for changing data of a database, which can be used in the financial field and other fields.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, which is a flowchart illustrating a method for changing data of a database according to an embodiment of the present invention, an execution subject of the method for changing data of a database according to an embodiment of the present invention may be a change management system, including but not limited to a computer. The method shown in the figure comprises the following steps:
in step S1, the acquired data change request is analyzed to obtain change operation information, a data change statement, a change start time, and a change end time.
The user initiates data change by submitting a data change request, the data change request comprises change operation information, a data change statement, change start time and change end time, and the information can be obtained by analyzing the data change request.
Further, the change operation information indicates a specific change operation on the data to be changed, such as modifying the value of the data, deleting the data, or the like. The data change statement is an sql statement used for inquiring the unique data row identifier of the data to be changed and the update timestamp, and the data change statement comprises the position information of the data to be changed. The change start time and the change end time identify the start time and the end time, respectively, of the implementation of the change, e.g., the time at which the data change request is submitted is 9 am on monday, the change start time may be 9 am on tuesday, and the change end time may be 5 pm on friday.
And step S2, acquiring a data backup and a data row unique identifier corresponding to the data to be changed from the database according to the data change statement.
The data change statement is sent to a database, such as an Oracle database, and the data change data is automatically analyzed through the database. When the database receives the data change statement, the data to be changed is automatically backed up to generate data backup, and the data backup and the data row unique identifier corresponding to the data to be changed are returned by the database.
Further, the unique identifier of the data row in the Oracle database may be referred to as rowid. It is typically used to access data within an Oracle database. rowid requires 10 bytes of storage space and is displayed with 18 characters, a value that indicates the physical specific location of the row in the Oracle database.
As an embodiment of the invention, the method further comprises: and acquiring a first updating time stamp corresponding to the data to be changed from the database according to the data change statement.
The data change statement is sent to the database, the data change data is automatically analyzed through the database, and the database returns a first update timestamp corresponding to the data to be changed.
Further, ora _ rowscn in the Oracle database indicates the last modification of the block where each record is located in the Oracle database, and the last modification can be converted into a specific modification time, i.e. a timestamp is updated, through an SCN and a timestamp conversion function SCN _ to _ timestamp built in the Oracle. When the record is modified, the ora _ rowscn is changed, and thus the update time stamp acquired for the first time is used as the first update time stamp.
And 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 unique data row identifier to obtain a second update time stamp.
When the change starting time is reached, the address of the data to be changed is determined by using the unique identifier of the data row, and the data to be changed in the database is changed 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 process is completed, the ora _ rowscn corresponding to the changed data is changed, and the update time stamp obtained from the ora _ rowscn is used as the second update time stamp.
And step S4, acquiring a current update timestamp from the database according to the change ending time and the unique data row identifier, and if the second update timestamp is the same as the current update timestamp, performing data rollback processing on the database according to the data backup.
When the change ending time is reached, the address of the changed data, namely the address of the data to be changed before the change processing, is determined by using the unique identifier of the data row, and the update time stamp corresponding to the data in the current address is acquired from the database and is used as the current update time stamp.
Furthermore, comparing the second update time stamp with the current update time stamp, if the second update time stamp is the same as the current update time stamp, it indicates that the data has not been changed for the second time during the period from the start to the end of the change. Then, according to the data backup, data rollback processing is performed on the data at the address in the database, thereby restoring the data to the state before the data change processing. If the second update time stamp is different from the current update time stamp, it indicates that the data is changed twice in the period from the start to the end of the change, and the data change process is ended earlier in this time, the data rollback process is not required.
Further, Rollback (Rollback) refers to the act of a program or data processing error to restore the program or data to the last correct state. Rollback includes types of program rollback and data rollback. The data rollback processing in the present invention is to restore the data after the change has been performed to the state before the change.
As an embodiment of the present invention, as shown in fig. 2, acquiring a data backup and a data row unique identifier corresponding to data to be changed from a database according to the data change statement includes:
step S21, determining the position information of the data to be changed according to the data change statement;
step S22, according to the location information of the data to be changed, obtaining a data backup and a data row unique identifier corresponding to the data to be changed from a database.
The data change statement comprises position information of the data to be changed, and after the data change statement is sent to the database according to the position information, the data backup and the data row unique identifier of the data to be changed corresponding to the position can be obtained from the database.
As an embodiment of the present invention, the data change method further includes: and receiving the change error reporting information sent by the database, and performing data rollback processing on the database according to the change error reporting information and the data backup.
After the data change processing is carried out on the database, if the change error reporting information fed back by the database is received, the data rollback processing is carried out on the database according to the change error reporting information and the data backup. Specifically, if the change error notification information is a change failure, the corresponding data in the database is restored to the state before the change processing according to the data backup.
As an embodiment of the present invention, as shown in fig. 3, the data change method further includes:
step S31, comparing the first update timestamp with the second update timestamp to obtain a comparison result;
and step S32, 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.
After the data change processing is carried out on the database, besides receiving change error reporting information actively sent by the database, the first update timestamp and the second update timestamp are compared to judge whether the data change is successfully implemented.
Further, the first update timestamp and the second update timestamp are compared to obtain a comparison result, if the first update timestamp and the second update timestamp are consistent, the comparison result is the same, and if the first update timestamp and the second update timestamp are inconsistent, the comparison result is different. If the comparison result is the same, the implementation of the change is failed, and the data is not changed, the corresponding data in the database is subjected to data rollback processing by using data backup according to the data address corresponding to the unique identifier of the data line, and the data is restored to the state before the data change processing is implemented.
In an embodiment of the present invention, as shown in fig. 4, a schematic structural diagram of a change management system applying the data change method of the database of the present invention is shown. The change management system is suitable for a change scene of transaction parameters under Oracle, can greatly improve the change efficiency of a banking system parameter switch, and provides a test environment with high-efficiency automatic implementation of change and intelligent and safe rollback. The change management system shown in the figure includes: the system comprises a statement change module, an automatic change implementation module, an intelligent change rollback module and a change result reminding module. Fig. 5 is a flowchart illustrating a process of changing data by the system, and the specific process is as follows.
In this embodiment, the change statement module is configured to receive and analyze the data change request, obtain change operation information, a data change statement, a change start time, and a change end time, and send the data change statement to the database for analysis processing, so as to obtain a data backup, a data row unique identifier, and a first update timestamp fed back by the database.
Wherein the data change statement is an sql statement that queries the change table data row to uniquely identify the rowid and ora _ rowscn update stamps, as shown in fig. 6. The data change statement analysis is to analyze the change statement by using an sql parser module sql parse package of python, and the database automatically generates data backup according to the data change statement.
In this embodiment, the change automatic implementation module is used for automatically implementing the process and the operation line recording process.
The automatic implementation process is to implement change content on a target Oracle database, and comprises the steps of automatically identifying a database related to change, automatically submitting execution and returning results. And the automatic implementation process automatically accesses the corresponding database through the authorized user according to the change operation information after the change starting time is reached, and submits and executes the change sql.
Further, when the operation row recording process is a change automatic implementation, the query sql generated by the automatic implementation process identifies the latest state of the changed data row, obtains the unique identifier rowid and the update stamp ora _ rowsc, i.e. the second update timestamp, of the operation data row in the change database, and records the unique identifier rowid and the update stamp ora _ rowsc, i.e. the second update timestamp, as shown in fig. 7.
In this embodiment, the change intelligent rollback module is configured to intelligently determine an due change according to the change end time and automatically perform rollback.
Wherein the change intelligent rollback module periodically checks the due change in the change management system every day. And after detecting that the due change exists, automatically executing the latest unique identifier rowid and ora _ rowsc of the query change data row to update the state of the stamp, namely the current update timestamp, again by the change intelligent rollback module according to the unique identifier of the change data and the query sql statement of the update stamp.
Further, if the query result is consistent with fig. 7, it is described that the relevant parameters are not changed in the continuous delivery version during the change period, in which case the backup data is restored and the change is rolled back. If the query result changes, as shown in fig. 8, the continuous delivery version changes the relevant parameters during the description change period, in this case, the description environment and the version are consistent, and should not be rolled back as the actual production state, and the change can be directly and automatically closed.
In this embodiment, the change result reminding module is configured to perform message reminding of a change applicant, a system administrator, and a technician on the results of automatic execution of the change and intelligent rollback. Specifically, whether the data change processing is implemented or not can be judged by receiving the change error reporting information of the database or comparing the first update time stamp with the first update time stamp, so that a change implementation result is obtained, and related personnel are reminded.
The change management system combines implementation change operation information through a native scn _ to _ timestamp method of Oracle and a rowid and ora _ rowscn object mechanism, regularly identifies and intelligently judges the rollback condition of the parameters through an algorithm, automatically triggers rollback and outputs change processing information to related personnel.
The invention automatically implements and rolls back the change by changing the timing and automatically judging the roll-back condition, improves the parameter changing efficiency of the service system, and provides a testing environment for efficiently and automatically implementing the transaction parameter change and intelligently and safely rolling back.
Fig. 9 is a schematic structural diagram of a data modification apparatus for a database according to an embodiment of the present invention, where the apparatus includes:
and a change request module 10 for analyzing the acquired data change request to obtain change operation information, a data change statement, a change start time and a change end time.
The user initiates data change by submitting a data change request, the data change request comprises change operation information, a data change statement, change start time and change end time, and the information can be obtained by analyzing the data change request.
Further, the change operation information indicates a specific change operation on the data to be changed, such as modifying the value of the data, deleting the data, or the like. The data change statement is an sql statement used for inquiring the unique data row identifier of the data to be changed and the update timestamp, and the data change statement comprises the position information of the data to be changed. The change start time and the change end time respectively mark the start time and the end time of the implementation of the change
And the data backup module 20 is configured to obtain, according to the data change statement, a data backup and a data row unique identifier corresponding to the data to be changed from the database.
The data change statement is sent to a database, such as an Oracle database, and the data change data is automatically analyzed through the database. When the database receives the data change statement, the data to be changed is automatically backed up to generate data backup, and the data backup and the data row unique identifier corresponding to the data to be changed are returned by the database.
Further, the unique identifier of the data row in the Oracle database may be referred to as rowid. It is typically used to access data within an Oracle database. rowid requires 10 bytes of storage space and is displayed with 18 characters, a value that indicates the physical specific location of the row in the Oracle database.
As an embodiment of the present invention, the data backup module 20 is further configured to obtain, according to the data change statement, a first update timestamp corresponding to the data to be changed from the database.
Further, ora _ rowscn in the Oracle database indicates the last modification of the block where each record is located in the Oracle database, and the last modification can be converted into a specific modification time, i.e. a timestamp is updated, through an SCN and a timestamp conversion function SCN _ to _ timestamp built in the Oracle. When the record is modified, the ora _ rowscn is changed, and thus the update time stamp acquired for the first time is used as the first update time stamp.
And the data change module 30 is 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, so as to obtain a second update timestamp.
When the change starting time is reached, the address of the data to be changed is determined by using the unique identifier of the data row, and the data to be changed in the database is changed 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 process is completed, the ora _ rowscn corresponding to the changed data is changed, and the update time stamp obtained from the ora _ rowscn is used as the second update time stamp.
And the data rollback module 40 is configured to obtain a current update timestamp from the database according to the change end time and the unique data row identifier, and perform data rollback processing on the database according to the data backup if it is known that the second update timestamp is the same as the current update timestamp.
When the change ending time is reached, the address of the changed data, namely the address of the data to be changed before the change processing, is determined by using the unique identifier of the data row, and the update time stamp corresponding to the data in the current address is acquired from the database and is used as the current update time stamp.
Furthermore, comparing the second update time stamp with the current update time stamp, if the second update time stamp is the same as the current update time stamp, it indicates that the data has not been changed for the second time during the period from the start to the end of the change. Then, according to the data backup, data rollback processing is performed on the data at the address in the database, thereby restoring the data to the state before the data change processing. If the second update time stamp is different from the current update time stamp, it indicates that the data is changed twice in the period from the start to the end of the change, and the data change process is ended earlier in this time, the data rollback process is not required.
As an embodiment of the present invention, as shown in fig. 10, the data backup module 20 includes:
a position information unit 21 configured to determine position information of data to be changed according to the data change statement;
and the data backup unit 22 is configured to obtain a data backup and a data row unique identifier corresponding to the data to be changed from a database according to the location information of the data to be changed.
As an embodiment of the present invention, as shown in fig. 11, the data changing apparatus further includes: and the change error reporting module 50 is 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.
As an embodiment of the present invention, as shown in fig. 12, the data changing apparatus further includes: a timestamp comparison module 60, configured to compare the first update timestamp with the second update timestamp to obtain a comparison result; and if the comparison results are the same, performing data rollback processing on the database according to the data backup and the unique identifier of the data row.
Based on the same application concept as the data changing method of the database, the invention also provides a data changing device of the database. Because the principle of solving the problems of the data changing device of the database is similar to that of the data changing method of the database, the implementation of the data changing device of the database can refer to the implementation of the data changing method of the database, and repeated parts are not described again.
The invention automatically implements and rolls back the change by changing the timing and automatically judging the roll-back condition, improves the parameter changing efficiency of the service system, and provides a testing environment for efficiently and automatically implementing the transaction parameter change and intelligently and safely rolling back.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method when executing the program.
The present invention also provides a computer-readable storage medium storing a computer program for executing the above method.
As shown in fig. 13, the electronic device 600 may further include: communication module 110, input unit 120, audio processing unit 130, display 160, power supply 170. It is noted that the electronic device 600 does not necessarily include all of the components shown in FIG. 10; furthermore, the electronic device 600 may also comprise components not shown in fig. 13, which may be referred to in the prior art.
As shown in fig. 13, the central processor 100, sometimes referred to as a controller or operational control, may include a microprocessor or other processor device and/or logic device, the central processor 100 receiving input and controlling the operation of the various components of the electronic device 600.
The memory 140 may be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information relating to the failure may be stored, and a program for executing the information may be stored. And the central processing unit 100 may execute the program stored in the memory 140 to realize information storage or processing, etc.
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 an object to be displayed, such as an image or a character. The display may be, for example, an LCD display, but is not limited thereto.
The memory 140 may be a solid state memory such as Read Only Memory (ROM), Random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 140 may also be some other type of device. Memory 140 includes buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application/function storage section 142, and the application/function storage section 142 is used to store application programs and function programs or a flow for executing the operation of the electronic device 600 by the central processing unit 100.
The memory 140 may also include a data store 143, the data store 143 for storing data, such as contacts, digital data, pictures, sounds, and/or any other data used by the electronic device. The driver storage portion 144 of the memory 140 may include various drivers of the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging application, address book application, etc.).
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 an input signal and receive an output signal, which may be the same as in the case of a conventional mobile communication terminal.
Based on different communication technologies, a plurality of communication modules 110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, may be provided in the same electronic device. The communication module (transmitter/receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide audio output via the speaker 131 and receive audio input from the microphone 132 to implement general telecommunications functions. Audio processor 130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, an audio processor 130 is also coupled to the central processor 100, so that recording on the local can be enabled through a microphone 132, and so that sound stored on the local can be played through a speaker 131.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described 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 flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, 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 specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principle and the implementation mode of the invention are explained by applying specific embodiments in the invention, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (10)
1. A data change method of a database, the data change method comprising:
analyzing the acquired data change request to obtain change operation information, a data change statement, change start time and change end time;
according to the data change statement, acquiring a data backup and a data row unique identifier corresponding to the data to be changed from a database;
according to the change operation information, the change start time and the unique data row identifier, performing data change processing on the data to be changed in the database to obtain a second update timestamp;
and acquiring a current updating time stamp from the database according to the change ending time and the unique identifier of the data row, and performing data rollback processing on the database according to the data backup if the second updating time stamp is identical to the current updating time stamp.
2. The data change method of claim 1, wherein the obtaining, according to the data change statement, the data backup and the data row unique identifier corresponding to the data to be changed from the database comprises:
determining the position information of the data to be changed according to the data change statement;
and acquiring a data backup and a data row unique identifier corresponding to the data to be changed from a database according to the position information of the data to be changed.
3. The data change method according to claim 1, further comprising: and receiving the change error reporting information sent by the database, and performing data rollback processing on the database according to the change error reporting information and the data backup.
4. The data change method according to claim 1, further comprising: and acquiring a first updating time stamp corresponding to the data to be changed from a database according to the data change statement.
5. The data change method according to claim 4, further comprising:
comparing the first update timestamp with the second update timestamp to obtain a comparison result;
and if the comparison results are the same, performing data rollback processing on the database according to the data backup and the unique identifier of the data row.
6. A data change apparatus for a database, the data change apparatus comprising:
the change request module is used for analyzing the acquired data change request to obtain change operation information, a data change statement, change starting time and change ending time;
the data backup module is used for acquiring data backup and a data row unique identifier corresponding to the data to be changed from a database according to the data change statement;
the data change module is used for carrying out data change processing on the data to be changed in the database according to the change operation information, the change starting time and the unique data row identifier to obtain a second update timestamp;
and the data rollback module is used for acquiring a current updating time stamp from the database according to the change ending time and the unique data row identifier, and performing data rollback processing on the database according to the data backup if the second updating time stamp is identical to the current updating time stamp.
7. The data change device of claim 6, wherein the data backup module is further configured to obtain a first update timestamp corresponding to the data to be changed from a database according to the data change statement.
8. The data change apparatus according to claim 7, further comprising: the timestamp comparison module is used for comparing the first update timestamp with the second update timestamp to obtain a comparison result; and if the comparison results are the same, performing data rollback processing on the database according to the data backup and the unique identifier of the data row.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 5 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program for executing the method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111304883.1A CN113986939A (en) | 2021-11-05 | 2021-11-05 | Data change method and device for database |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111304883.1A CN113986939A (en) | 2021-11-05 | 2021-11-05 | Data change method and device for database |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113986939A true CN113986939A (en) | 2022-01-28 |
Family
ID=79746679
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111304883.1A Pending CN113986939A (en) | 2021-11-05 | 2021-11-05 | Data change method and device for database |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113986939A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115858688A (en) * | 2023-03-03 | 2023-03-28 | 北京阿玛西换热设备制造有限公司 | Remote data synchronization method and system for database |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050256897A1 (en) * | 2004-05-11 | 2005-11-17 | Oracle International Corporation | Providing the timing of the last committed change to a row in a database table |
CN104346454A (en) * | 2014-10-30 | 2015-02-11 | 上海新炬网络技术有限公司 | Data consistency verification method based on Oracle database |
CN110489436A (en) * | 2019-08-16 | 2019-11-22 | 北京百度网讯科技有限公司 | Variation and platform, computer equipment and readable medium on the line of database |
-
2021
- 2021-11-05 CN CN202111304883.1A patent/CN113986939A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050256897A1 (en) * | 2004-05-11 | 2005-11-17 | Oracle International Corporation | Providing the timing of the last committed change to a row in a database table |
CN104346454A (en) * | 2014-10-30 | 2015-02-11 | 上海新炬网络技术有限公司 | Data consistency verification method based on Oracle database |
CN110489436A (en) * | 2019-08-16 | 2019-11-22 | 北京百度网讯科技有限公司 | Variation and platform, computer equipment and readable medium on the line of database |
Non-Patent Citations (1)
Title |
---|
田冰超: "Oracle 10g新增参数ORA_ROWSCN详解", 《信息与电脑(理论版)》, 31 January 2010 (2010-01-31) * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115858688A (en) * | 2023-03-03 | 2023-03-28 | 北京阿玛西换热设备制造有限公司 | Remote data synchronization method and system for database |
CN115858688B (en) * | 2023-03-03 | 2023-04-18 | 北京阿玛西换热设备制造有限公司 | Remote data synchronization method and system for database |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109460349B (en) | Test case generation method and device based on log | |
US11620277B2 (en) | Transaction processing at non-relational databases | |
CN111399873B (en) | Model updating method and device | |
CN109634970B (en) | Table data synchronization method, apparatus, storage medium and device | |
CN112783793B (en) | Automatic interface test system and method | |
CN111708841A (en) | Database data synchronization method and device | |
JPH07319747A (en) | Data updating system | |
CN104423960A (en) | Continuous project integration method and continuous project integration system | |
CN106341244A (en) | Method and system for updating configuration file, client and server | |
CN111078506A (en) | Business data batch running task monitoring method and device | |
CN113986939A (en) | Data change method and device for database | |
CN113760611B (en) | System site switching method and device, electronic equipment and storage medium | |
CN112035365B (en) | Version deployment method and device supporting multiple test environments | |
CN112181784B (en) | Code fault analysis method and system based on byte code injection | |
CN117874033A (en) | Database sub-table method and device, electronic equipment and storage medium | |
CN111262747B (en) | Internet of things-based equipment network access control method and Internet of things platform | |
CN111385613B (en) | Television system repairing method, storage medium and application server | |
CN116450197A (en) | Influence analysis method and system based on requirement and code corresponding relation library | |
CN116150029A (en) | Automatic overdue batch testing method and device for loan system | |
CN113687635B (en) | State management method, system and storage medium based on complete objectification equipment | |
CN113986759A (en) | Business processing flow acquisition method, business architecture flow verification method and system | |
CN114579171A (en) | Code processing method and device, computer equipment and storage medium | |
CN111639478B (en) | Automatic data auditing method and system based on EXCEL document | |
CN114637688A (en) | Coverage rate statistical method and device based on version branches | |
CN113505179A (en) | Access path synchronization method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |