Database log time restoration method and device, electronic equipment and storage medium
By determining the relationship between the reference preset time and the decimal data form in the database log, combined with the relationship in the hexadecimal form, the problem that the database log data storage form cannot be analyzed is solved, and the log data is accurately restored and analyzed, supporting database performance monitoring and fault diagnosis.
Patent Information
- Application Number
- CN202510322392.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2045-03-19
AI Technical Summary
In the prior art, the data storage form in the database log cannot be analyzed, resulting in the analysis tool being unable to accurately parse the data in the log and unable to restore the actual value of the data in the log.
By determining the relationship between the reference preset time and the decimal data form in the database log, combining the relationship in the hexadecimal form, the original log value of the time to be restored is converted to the intermediate value of the decimal form, and then its actual time is determined.
It realizes accurate and efficient analysis of database log data, and supports database performance monitoring and fault diagnosis.
Smart Images

Figure CN119848011A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database technology, and in particular to a database log time restoration method, device, electronic equipment and storage medium. Background Art
[0002] During the operation of the database system, the log records all the operation information of the database, including the addition, deletion, modification and query of data, the start and submission of transactions, etc., and is an important basis for database recovery, performance analysis, etc. However, in actual applications, the data storage in the database log is diverse, which brings many challenges to the database log analysis. In the prior art, when using the database, the data storage format in the database log cannot be analyzed, and then the analysis tool cannot accurately parse the data in the log, resulting in the inability to restore the actual value of the data in the log. Summary of the invention
[0003] In order to solve the above problems existing in the prior art, the present invention provides a database log time restoration method, device, electronic device and storage medium. The technical problem to be solved by the present invention is achieved through the following technical solutions: A first aspect of an embodiment of the present invention provides a method for restoring a database log time, comprising the following steps: According to the number of 0s in the first original log values corresponding to the multiple first preset times in the database log, determine the first preset time corresponding to the first original log value with the largest number of 0s as the reference preset time; wherein the hour, minute, and second in the first preset time are all 0, and the number of 0s in the year, month, and day is greater than 2; Determine the multiple relationship between the preset number of seconds and the decimal value according to the preset number of seconds, the first original log value of the reference preset time, and the number of zeros between the last digit and the first non-zero value of the second original log value corresponding to the second preset time after the reference preset time is increased by the preset number of seconds; Determine that the storage mode of the time in the database log is hexadecimal according to the multiple relationship between the preset number of seconds and the decimal value and the third original log value in the database log corresponding to the third preset time after the second preset time is increased by 24 hours; Convert the original log value of the time to be restored stored in the database log in hexadecimal form into the intermediate value to be restored in decimal form; The actual time of the intermediate value to be restored is determined according to the intermediate value to be restored, the reference preset time, and the relationship between the preset number of seconds and the multiple of the decimal value.
[0004] In one embodiment of the present invention, determining that the storage method of the time in the database log is hexadecimal according to the multiple relationship between the preset number of seconds and the decimal value and the third original log value in the database log corresponding to the third preset time after the second preset time is increased by 24 hours includes: Determine the decimal value of the third preset time after the second preset time is increased by 24 hours according to the relationship between the preset number of seconds and the multiple of the decimal value; Input the third preset time into the database, and obtain the corresponding third original log value in the database log; Determine whether there are multiple letters in the third original log value; If so, determine whether the number of 0s between the last digit of the third original log value and the first non-zero value is greater than or equal to the number of 0s between the last digit of the decimal value of the third preset time and the first non-zero value; When the number of zeros between the last digit of the third original log value and the first non-zero value is greater than or equal to the number of zeros between the last digit of the decimal value of the third preset time and the first non-zero value, it is determined that the storage method of the time in the database log is hexadecimal.
[0005] In one embodiment of the present invention, the method further comprises: A plurality of first preset times are input into a database, and corresponding first original log values in the database log are obtained.
[0006] In one embodiment of the present invention, the relationship between the preset number of seconds and the multiple of the decimal value is 1 second equals 1000000.
[0007] A second aspect of an embodiment of the present invention provides a device for restoring a database log time, comprising: A first determination module is used to determine, according to the number of digits 0 in the first original log values corresponding to the plurality of first preset times in the database log, the first preset time corresponding to the first original log value having the largest number of 0s as the reference preset time; wherein the hour, minute, and second in the first preset time are all 0, and the number of 0s in the year, month, and day is greater than 2; A second determination module is used to determine the multiple relationship between the preset number of seconds and the decimal value according to the preset number of seconds, the first original log value of the reference preset time, and the number of zeros between the last digit and the first non-zero value of the second original log value corresponding to the second preset time after the preset number of seconds is added to the reference preset time in the database log; A third determination module is used to determine that the storage mode of the time in the database log is hexadecimal according to the multiple relationship between the preset number of seconds and the decimal value and the third original log value corresponding to the third preset time after the second preset time is increased by 24 hours in the database log; A conversion module, used for converting the original log value stored in the database log in hexadecimal form at the time to be restored into an intermediate value to be restored in decimal form; The fourth determining module is used to determine the actual time of the intermediate value to be restored according to the intermediate value to be restored, the reference preset time, and the relationship between the preset number of seconds and the multiple of the decimal value.
[0008] In one embodiment of the present invention, determining that the storage method of the time in the database log is hexadecimal according to the multiple relationship between the preset number of seconds and the decimal value and the third original log value in the database log corresponding to the third preset time after the second preset time is increased by 24 hours includes: Determine the decimal value of the third preset time after the second preset time is increased by 24 hours according to the relationship between the preset number of seconds and the multiple of the decimal value; Input the third preset time into the database, and obtain the corresponding third original log value in the database log; Determine whether there are multiple letters in the third original log value; If so, determine whether the number of 0s between the last digit of the third original log value and the first non-zero value is greater than or equal to the number of 0s between the last digit of the decimal value of the third preset time and the first non-zero value; When the number of zeros between the last digit of the third original log value and the first non-zero value is greater than or equal to the number of zeros between the last digit of the decimal value of the third preset time and the first non-zero value, it is determined that the storage method of the time in the database log is hexadecimal.
[0009] In one embodiment of the present invention, it also includes: The acquisition module is used to input a plurality of first preset times into a database and acquire the corresponding first original log values in the database log.
[0010] In one embodiment of the present invention, the relationship between the preset number of seconds and the multiple of the decimal value is 1 second equals 1000000.
[0011] A third aspect of an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a database log time restoration method provided by the first aspect of an embodiment of the present invention is implemented.
[0012] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for restoring a database log time provided by the first aspect of the embodiment of the present invention is implemented.
[0013] Beneficial effects of the present invention: The present invention converts the time into seconds by determining the relationship between the reference time and the decimal data form. The time data storage form of the database log can be obtained through the relationship between the number of seconds and the decimal data form and the relationship between the hexadecimal form, and then the actual value of the time in the log can be restored, so that the log data of the database can be analyzed accurately and efficiently, and the performance monitoring and fault diagnosis of the database are facilitated.
[0014] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0015] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings: Figure 1 A schematic diagram of a process flow of a database log time restoration method provided by an embodiment of the present invention; Figure 2 A schematic block diagram of a database log time restoration device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0017] The present invention is further described in detail below with reference to specific embodiments, but the embodiments of the present invention are not limited thereto.
[0018] like Figure 1 As shown, a first aspect of an embodiment of the present invention provides a method for restoring a database log time, comprising the following steps: Step 11, according to the number of digits 0 in the first original log values corresponding to the plurality of first preset times in the database log, determine the first preset time corresponding to the first original log value having the largest number of 0s as the reference preset time.
[0019] Among them, the hour, minute and second in the first preset time are all 0, and the number of 0s in the year, month and day is greater than 2.
[0020] Step 12, determine the multiple relationship between the preset seconds and the decimal value based on the preset seconds, the first original log value of the benchmark preset time, and the number of zeros between the last digit of the second original log value corresponding to the second preset time after the benchmark preset time is increased by the preset seconds and the first non-zero value in the database log.
[0021] Step 13, determining that the storage method of the time in the database log is hexadecimal based on the multiple relationship between the preset seconds and the decimal value and the third original log value in the database log corresponding to the third preset time after the second preset time is increased by 24 hours.
[0022] Step 14: Convert the original log value of the time to be restored stored in the database log in hexadecimal form into an intermediate value to be restored in decimal form.
[0023] Step 15, determining the actual time of the intermediate value to be restored according to the intermediate value to be restored, the reference preset time, and the relationship between the preset number of seconds and the multiple of the decimal value.
[0024] In this embodiment, by determining the relationship between the reference time and the decimal data form, the time is converted into seconds. Through the relationship between the seconds and the decimal data form and the hexadecimal form, the time data storage form of the database log can be obtained, and then the actual value of the time in the log can be restored, so that the log data of the database can be analyzed accurately and efficiently, which facilitates performance monitoring and fault diagnosis of the database.
[0025] Based on the first aspect of the embodiment of the present invention, the second aspect of the embodiment of the present invention further describes the method of the present invention. The second aspect of the embodiment of the present invention provides a database log time restoration method, which is applied to the Gaussdb-100 database and includes the following steps: Step 21: input a plurality of first preset times into a database, and obtain corresponding first original log values in the database log.
[0026] Among them, the hour, minute and second in the first preset time are all 0, and the number of 0s in the year, month and day is greater than 2.
[0027] In this step, a plurality of different preset first times are input into the database, and a first original log value of each first preset time is obtained from the log of the database.
[0028] Since 0 is a special number, it represents simple and identifying information in multiple number systems. Therefore, the time input with more 0s in the time data is selected to obtain its original log value in the database log. The preset time here is the time data including year, month, day, hour, minute and second. For example, 2001-01-02 05:00:02 is a complete first preset time.
[0029] Step 22, according to the number of digits 0 in the first original log values corresponding to the plurality of first preset times in the database log, determine the first preset time corresponding to the first original log value having the largest number of 0s as the reference preset time.
[0030] In this step, among the multiple first original log values obtained, the time corresponding to the first original log value with the most 0s is determined as the reference time. Since the time data in the log needs to be restored to the actual time, it is necessary to determine a reference time, on the basis of which forward and backward calculations can be performed. Here, when the first preset time is 2000-01-01 00:00:00, all the first original log values corresponding to it are 0, that is, 0000000000000000, and the original log values corresponding to other first preset times are not all 0. Therefore, here, 2000-01-01 00:00:00 is used as the reference preset time, and the numerical values corresponding to 0 are all 0. Therefore, calculations are started from 0 to simplify the calculation logic.
[0031] Step 23, determine the multiple relationship between the preset seconds and the decimal value according to the preset seconds, the first original log value of the base preset time, and the number of zeros between the last digit of the second original log value corresponding to the second preset time after the base preset time is increased by the preset seconds and the first non-zero value in the database log.
[0032] In this step, since the time data is represented by pure numbers from 0 to 9, the decimal representation is introduced as an intermediate value to further determine which number system the value in the log is represented in. Specifically, based on the reference preset time, the preset number of seconds is increased, for example, one or two seconds is increased, to obtain one or more second preset times, the second preset time is input into the database, and the second original log value corresponding to the second preset time in the database log is obtained. For example, as shown in the following Table 1: Table 1 In Table 1, 2000-01-01 00:00:01 is a second preset time, and the corresponding second original log value is 40420f0000000000, 2000-01-01 00:00:02 is another second preset time, and the corresponding second original log value is 40420f0000000000, and the decimal corresponding to 000000000000000 is 0, so 2000-01-01 00:00:01 has one more second, and the corresponding decimal adds 1 second on the basis of 0, that is, 1, but when the decimal 1 is converted into other bases, there will be no situation with multiple 0s, and when 1 second is expressed in microseconds, 1 second is equal to 1000 milliseconds (ms), 1 millisecond is equal to 1000 microseconds (μs), then 1s = 1000 * 1000 = 1000000μs, the decimal 1000000 is close to the number of zeros at the end of 40420f0000000000. Similarly, the decimal corresponding to 2000-01-01 00:00:02 is 2 seconds (2000000μs) added to 0, which is 2000000 in decimal. Therefore, when expressed in decimal, the increase or decrease time based on the base preset time is expressed in decimal and in microseconds as a preset association, that is, for every increase of 1 second, the decimal increases by 1000000. For example, adding 24 hours and 2 seconds to the reference preset time 2000-01-01 00:00:00 is 2000-01-02 00:00:02, which is equivalent to adding 86402 seconds, that is, 86402000000 μs. Based on the decimal representation of 0 of the reference preset time, the decimal of 2000-01-02 00:00:02 is increased by 86402000000, that is, 86402000000.
[0033] Step 24, determining that the storage method of the time in the database log is hexadecimal based on the multiple relationship between the preset seconds and the decimal value and the third original log value in the database log corresponding to the third preset time after the second preset time is increased by 24 hours.
[0034] The specific steps of step 24 include step 241 to step 245: Step 241, determining the decimal value of the third preset time after the second preset time is increased by 24 hours according to the relationship between the preset number of seconds and the multiple of the decimal value.
[0035] For example, according to the relationship between microseconds and decimal representation in the previous step, 1000000 μs is represented as 1000000 in decimal, the second preset time is 2000-01-01 00:00:02, and the third preset time after 24 hours is 2000-01-02 00:00:02, which is equivalent to adding 86400000000 μs to the second preset time. The decimal of 2000-01-01 00:00:02 is 2000000, and the decimal of 2000-01-02 00:00:02 is 86402000000.
[0036] Step 242: input the third preset time into the database, and obtain the corresponding third original log value in the database log.
[0037] Step 243, determining whether there are multiple letters in the third original log value.
[0038] Step 244, if yes, determine whether the number of 0s between the last digit of the third original log value and the first non-zero value is greater than or equal to the number of 0s between the last digit of the decimal value of the third preset time and the first non-zero value.
[0039] Here, the third preset time 2000-01-02 00:00:02 is input into the database, and the corresponding log value in the database log is 80E4F51D14000000. There are multiple letters in this log value, and it can be preliminarily determined that the time data in the log is expressed in hexadecimal.
[0040] Step 245, when the number of zeros between the last digit of the third original log value and the first non-zero value is greater than or equal to the number of zeros between the last digit of the decimal value of the third preset time and the first non-zero value, determine that the storage method of the time in the database log is hexadecimal.
[0041] In this step, the third preset time 2000-01-02 00:00:02 is entered into the database, and the corresponding log value in the database log is 80E4F51D14000000, and the number of 0s at the end is six, which is equal to the number of 0s at the end of the decimal 86402000000. From the other time examples above, it can be seen that the number of 0s at the end of the original log value is greater than the number of 0s at the end of the decimal. For the corresponding numbers, it conforms to the character rules of conversion between decimal and hexadecimal. Therefore, it can be determined that the storage location of the time in the database log is hexadecimal.
[0042] At the same time, converting the decimal time example above into hexadecimal will give the log value in the database log.
[0043] Step 25: Convert the original log value of the time to be restored stored in the database log in hexadecimal form into an intermediate value to be restored in decimal form.
[0044] In this step, after determining that the time in the database log is expressed in hexadecimal, any time in the database log can be restored to the actual time through decimal.
[0045] Step 26, determining the actual time of the intermediate value to be restored according to the intermediate value to be restored, the reference preset time, and the relationship between the preset number of seconds and the multiple of the decimal value.
[0046] In this step, after converting the intermediate value to be restored into decimal, the intermediate value to be restored is divided by 1000000 to obtain the number of seconds added on the basis of the benchmark preset time, which is also the total number of seconds added on the basis of the benchmark preset time. Then, the total number of seconds is calculated to be how many days, hours, minutes, and seconds, that is, how many days, hours, minutes, and seconds are added on the basis of the benchmark preset time, and the actual time to be restored can be obtained.
[0047] For example, the original log value of the time to be restored stored in the database log in hexadecimal form is converted into a decimal intermediate value to be restored of 172800000000, which is 172800000000 microseconds, 172800000000 / 1000000=172800 seconds, 172800 / 60=2880 minutes, 2880 / 60=48 hours, which is 48 hours added to the base preset time 2000-01-01 00:00:00, that is, two days added, and the actual time obtained is 2000-01-03 00:00:00.
[0048] like Figure 2 As shown, a third aspect of an embodiment of the present invention provides a database log time restoration device, comprising: The first determination module 31 is used to determine, according to the number of 0s in the first original log values corresponding to the plurality of first preset times in the database log, the first preset time corresponding to the first original log value having the largest number of 0s as the reference preset time; wherein the hour, minute and second in the first preset time are all 0, and the number of 0s in the year, month and day is greater than 2; A second determination module 32 is used to determine the multiple relationship between the preset number of seconds and the decimal value according to the preset number of seconds, the first original log value of the reference preset time, and the number of zeros between the last digit and the first non-zero value of the second original log value corresponding to the second preset time after the reference preset time is increased by the preset number of seconds. A third determination module 33 is used to determine that the storage mode of the time in the database log is hexadecimal according to the multiple relationship between the preset number of seconds and the decimal value and the third original log value corresponding to the third preset time after the second preset time is increased by 24 hours in the database log; A conversion module 34, used to convert the original log value stored in the database log in hexadecimal form at the time to be restored into an intermediate value to be restored in decimal form; The fourth determining module 35 is used to determine the actual time of the intermediate value to be restored according to the intermediate value to be restored, the reference preset time, and the relationship between the preset number of seconds and the multiple of the decimal value.
[0049] In one embodiment of the present invention, determining that the storage method of the time in the database log is hexadecimal according to the multiple relationship between the preset number of seconds and the decimal value and the third original log value in the database log corresponding to the third preset time after the second preset time is increased by 24 hours includes: Determine the decimal value of the third preset time after 24 hours are added to the second preset time according to the relationship between the preset number of seconds and the multiple of the decimal value; Input the third preset time into the database, and obtain the corresponding third original log value in the database log; Determine whether there are multiple letters in the third original log value; If so, determine whether the number of 0s between the last digit of the third original log value and the first non-zero value is greater than or equal to the number of 0s between the last digit of the decimal value of the third preset time and the first non-zero value; When the number of zeros between the last digit of the third original log value and the first non-zero value is greater than or equal to the number of zeros between the last digit of the decimal value of the third preset time and the first non-zero value, it is determined that the storage method of the time in the database log is hexadecimal.
[0050] In one embodiment of the present invention, it also includes: The acquisition module is used to input a plurality of first preset times into a database and acquire the corresponding first original log values in the database log.
[0051] In one embodiment of the present invention, the relationship between the preset number of seconds and the multiple of the decimal value is 1 second equals 1000000.
[0052] A fourth aspect of an embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, a database log time restoration method provided by the above-mentioned embodiment of the present invention is implemented.
[0053] A fifth aspect of an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of a database log time restoration method provided by the above-mentioned embodiment of the present invention are implemented.
[0054] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0055] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware systems.
[0056] The method provided in the embodiment of the present invention can be applied to electronic devices. Specifically, the electronic device can be: a desktop computer, a portable computer, an intelligent mobile terminal, a server, etc. This is not limited here, and any electronic device that can implement the present invention belongs to the protection scope of the present invention.
[0057] As for the device / electronic device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0058] 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.
[0059] 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.
[0060] 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 The steps for the functions specified in one or more boxes.
[0061] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A database log time restoration method, characterized in that: The following steps are involved: According to the number of 0s in the first original log values corresponding to the multiple first preset times in the database log, determine the first preset time corresponding to the first original log value with the largest number of 0s as the reference preset time; wherein the hour, minute, and second in the first preset time are all 0, and the number of 0s in the year, month, and day is greater than 2; Determine the multiple relationship between the preset number of seconds and the decimal value according to the preset number of seconds, the first original log value of the reference preset time, and the number of zeros between the last digit and the first non-zero value of the second original log value corresponding to the second preset time after the reference preset time is increased by the preset number of seconds; Determine that the storage mode of the time in the database log is hexadecimal according to the multiple relationship between the preset number of seconds and the decimal value and the third original log value in the database log corresponding to the third preset time after the second preset time is increased by 24 hours; Convert the original log value of the time to be restored stored in the database log in hexadecimal form into the intermediate value to be restored in decimal form; The actual time of the intermediate value to be restored is determined according to the intermediate value to be restored, the reference preset time, and the relationship between the preset number of seconds and the multiple of the decimal value.
2. The method according to claim 1, characterized in that The method of determining that the storage method of the time in the database log is hexadecimal according to the multiple relationship between the preset number of seconds and the decimal value and the third original log value in the database log corresponding to the third preset time after the second preset time is increased by 24 hours includes: Determine the decimal value of the third preset time after the second preset time is increased by 24 hours according to the relationship between the preset number of seconds and the multiple of the decimal value; Input the third preset time into the database, and obtain the corresponding third original log value in the database log; Determine whether there are multiple letters in the third original log value; If so, determine whether the number of 0s between the last digit of the third original log value and the first non-zero value is greater than or equal to the number of 0s between the last digit of the decimal value of the third preset time and the first non-zero value; When the number of zeros between the last digit of the third original log value and the first non-zero value is greater than or equal to the number of zeros between the last digit of the decimal value of the third preset time and the first non-zero value, it is determined that the storage method of the time in the database log is hexadecimal.
3. The method according to claim 2, characterized in that The method further comprises: A plurality of first preset times are input into a database, and corresponding first original log values in the database log are obtained.
4. The method according to claim 2, characterized in that The relationship between the preset number of seconds and the multiple of the decimal value is that 1 second equals 1000000.
5. A device for restoring database log time, characterized in that: include: A first determination module is used to determine, according to the number of digits 0 in the first original log values corresponding to the plurality of first preset times in the database log, the first preset time corresponding to the first original log value having the largest number of 0s as the reference preset time; wherein the hour, minute, and second in the first preset time are all 0, and the number of 0s in the year, month, and day is greater than 2; A second determination module is used to determine the multiple relationship between the preset number of seconds and the decimal value according to the preset number of seconds, the first original log value of the reference preset time, and the number of zeros between the last digit and the first non-zero value of the second original log value corresponding to the second preset time after the preset number of seconds is added to the reference preset time in the database log; A third determination module is used to determine that the storage mode of the time in the database log is hexadecimal according to the multiple relationship between the preset number of seconds and the decimal value and the third original log value corresponding to the third preset time after the second preset time is increased by 24 hours in the database log; A conversion module, used for converting the original log value stored in the database log in hexadecimal form at the time to be restored into an intermediate value to be restored in decimal form; The fourth determining module is used to determine the actual time of the intermediate value to be restored according to the intermediate value to be restored, the reference preset time, and the relationship between the preset number of seconds and the multiple of the decimal value.
6. The device according to claim 5, characterized in that The method of determining that the storage method of the time in the database log is hexadecimal according to the multiple relationship between the preset number of seconds and the decimal value and the third original log value in the database log corresponding to the third preset time after the second preset time is increased by 24 hours includes: Determine the decimal value of the third preset time after the second preset time is increased by 24 hours according to the relationship between the preset number of seconds and the multiple of the decimal value; Input the third preset time into the database, and obtain the corresponding third original log value in the database log; Determine whether there are multiple letters in the third original log value; If so, determine whether the number of 0s between the last digit of the third original log value and the first non-zero value is greater than or equal to the number of 0s between the last digit of the decimal value of the third preset time and the first non-zero value; When the number of zeros between the last digit of the third original log value and the first non-zero value is greater than or equal to the number of zeros between the last digit of the decimal value of the third preset time and the first non-zero value, it is determined that the storage method of the time in the database log is hexadecimal.
7. The device according to claim 6, characterized in that Also includes: The acquisition module is used to input a plurality of first preset times into a database and acquire the corresponding first original log values in the database log.
8. The device according to claim 6, characterized in that The relationship between the preset number of seconds and the multiple of the decimal value is that 1 second equals 1000000.
9. 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 program, the database log time restoration method as described in any one of claims 1 to 4 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the database log time restoration method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Data structure based on cloud computing database system
CN103399945A
Log recording method, device and equipment and storage medium
CN111881012A
Data transmission method and device
CN112436900A
IEMS data problem checking system and method
CN112765228A
Data synchronization method and device, equipment and storage medium
CN113495894A