Database Log Time Restoration Method, Device, Electronic Device, and Storage Medium
By determining the relationship between the reference time and the decimal data form, and combining the hexadecimal form, the problem that the data storage form in the database log cannot be analyzed is solved, and the actual value of the time in the log is accurately restored, which facilitates database performance monitoring and fault diagnosis.
Patent Information
- Application Number
- CN202510322392.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-06-20
- 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 time and the decimal data form, converting time into seconds, combining the relationship between the number of seconds and the decimal data form and the relationship between the hexadecimal form, it is determined that the storage method of time in the database log is hexadecimal, and converting it into the intermediate value to be restored in the decimal form to restore the actual value of time in the log.
It realizes accurate and efficient analysis of the database log data, which facilitates performance monitoring and fault diagnosis of the database.
Smart Images

Figure CN119848011B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of databases, and in particular, to a method, apparatus, electronic device, and storage medium for restoring database log time. Background Art
[0002] During the operation of a database system, the log records all operation information of the database, including data addition, deletion, modification, query, start and submission of transactions, etc., and is an important basis for database recovery, performance analysis, etc. However, in practical applications, the data storage in database logs is diverse, which brings many challenges to database log analysis. In the prior art, when using a database, the data storage form in the database log cannot be analyzed, and thus 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] To solve the above problems existing in the prior art, the present invention provides a method, apparatus, electronic device, and storage medium for restoring database log time. The technical problems to be solved by the present invention are achieved through the following technical solutions:
[0004] In a first aspect of an embodiment of the present invention, a method for restoring database log time is provided, including the following steps:
[0005] Determine the first preset time corresponding to the first original log value with the largest number of zeros among the first original log values corresponding to multiple first preset times in the database log as the reference preset time; wherein, the hours, minutes, and seconds in the first preset time are all 0, and the number of zeros in the digits of the year, month, and day is greater than 2;
[0006] Determine the multiple relationship between the preset number of seconds and the decimal value according to the number of zeros between the last digit and the first non-zero value of the second original log value corresponding to the preset number of seconds, the first original log value of the reference preset time, and the second preset time after adding the preset number of seconds to the reference preset time in the database log;
[0007] Determine that the storage method of 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 adding 24 hours to the second preset time in the database log;
[0008] Convert the original log value stored in hexadecimal form in the database log of the time to be restored into a decimal intermediate value to be restored;
[0009] 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 multiple relationship between the preset number of seconds and the decimal value.
[0010] In an embodiment of the present invention, determining that the storage mode of 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 adding 24 hours to the second preset time includes:
[0011] Determine the decimal value of the third preset time after adding 24 hours to the second preset time according to the multiple relationship between the preset number of seconds and the decimal value;
[0012] Input the third preset time into the database to obtain the corresponding third original log value in the database log;
[0013] Determine whether there are multiple letters in the third original log value;
[0014] If so, determine whether the number of 0s between the last digit and the first non-zero value of the third original log value is greater than or equal to the number of 0s between the last digit and the first non-zero value of the decimal value of the third preset time;
[0015] When the number of 0s between the last digit and the first non-zero value of the third original log value is greater than or equal to the number of 0s between the last digit and the first non-zero value of the decimal value of the third preset time, determine that the storage mode of time in the database log is hexadecimal.
[0016] In an embodiment of the present invention, the method further includes:
[0017] Input multiple first preset times into the database to obtain the corresponding first original log values in the database log.
[0018] In an embodiment of the present invention, the multiple relationship between the preset number of seconds and the decimal value is that 1 second is equal to 1,000,000.
[0019] A second aspect of the embodiments of the present invention provides a device for restoring the time of a database log, including:
[0020] A first determination module, configured to determine, according to the number of digits 0 in the first original log value corresponding to multiple first preset times in the database log, that the first preset time corresponding to the first original log value with the largest number of digits 0 is the reference preset time; wherein, the hour, minute, and second in the first preset time are all 0, and the number of digits 0 in the numbers of year, month, and day is greater than 2;
[0021] A second determination module, configured to determine a multiple relationship between the preset number of seconds and a decimal value according to the number of zeros between the last digit and the first non-zero value of the first original log value of the reference preset time and the second original log value corresponding to the second preset time after adding the preset number of seconds to the reference preset time in the database log;
[0022] A third determination module, configured to determine that the storage mode of 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 adding 24 hours to the second preset time in the database log;
[0023] A conversion module, configured to convert the original log value stored in hexadecimal form of the time to be restored in the database log into an intermediate value to be restored in decimal form;
[0024] A fourth determination module, configured 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 multiple relationship between the preset number of seconds and the decimal value.
[0025] In an embodiment of the present invention, the determining that the storage mode of 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 adding 24 hours to the second preset time includes:
[0026] Determining the decimal value of the third preset time after adding 24 hours to the second preset time according to the multiple relationship between the preset number of seconds and the decimal value;
[0027] Inputting the third preset time into the database to obtain the third original log value corresponding to the database log;
[0028] Judging whether there are multiple letters in the third original log value;
[0029] If so, judging whether the number of zeros between the last digit and the first non-zero value of the third original log value is greater than or equal to the number of zeros between the last digit and the first non-zero value of the decimal value of the third preset time;
[0030] When the number of zeros between the last digit and the first non-zero value of the third original log value is greater than or equal to the number of zeros between the last digit and the first non-zero value of the decimal value of the third preset time, determining that the storage mode of time in the database log is hexadecimal.
[0031] In an embodiment of the present invention, it further includes:
[0032] An acquisition module, configured to input multiple first preset times into a database, and acquire corresponding first original log values in the database log.
[0033] In an embodiment of the present invention, the multiple relationship between the preset number of seconds and the decimal value is that 1 second is equal to 1,000,000.
[0034] A third aspect of the embodiments of the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements a method for restoring the time of a database log provided in the first aspect of the embodiments of the present invention.
[0035] A fourth aspect of the embodiments of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements a method for restoring the time of a database log provided in the first aspect of the embodiments of the present invention.
[0036] Advantages of the present invention:
[0037] By determining the relationship between the reference time and the decimal data form, the present invention converts the time into seconds. Through the relationship between the number of 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 as to accurately and efficiently analyze the log data of the database, and further facilitate performance monitoring and fault diagnosis of the database.
[0038] Other features and advantages of the present invention will be described in the following specification, and, in part, will be obvious from the specification, or will be understood by implementing the present invention. The objectives and other advantages of the present invention can be achieved and obtained by the structures specifically pointed out in the written specification, claims, and drawings.
[0039] Next, through the drawings and embodiments, the technical solutions of the present invention will be further described in detail. Description of the Drawings
[0040] The 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 to the present invention. In the drawings:
[0041] Figure 1 It is a schematic flowchart of a method for restoring the time of a database log provided by an embodiment of the present invention;
[0042] Figure 2 It is a schematic block diagram of a device for restoring the time of a database log provided by an embodiment of the present invention. Detailed Embodiments
[0043] The following further describes the present invention in detail with reference to specific embodiments, but the implementation manners of the present invention are not limited thereto.
[0044] As Figure 1 shown, the first aspect of the embodiment of the present invention provides a method for restoring the database log time, including the following steps:
[0045] Step 11: Determine the first preset time corresponding to the first original log value with the largest number of zeros among the first original log values corresponding to multiple first preset times in the database log as the reference preset time.
[0046] Among them, the hours, minutes, and seconds in the first preset time are all 0, and the number of zeros in the digits of the year, month, and day is greater than 2.
[0047] Step 12: Determine the multiple relationship between the preset number of seconds and the decimal value according to the number of zeros between the last digit and the first non-zero value of the second original log value corresponding to the preset number of seconds, the first original log value of the reference preset time, and the second preset time after adding the preset number of seconds to the reference preset time in the database log.
[0048] Step 13: Determine 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 corresponding to the third preset time after adding 24 hours to the second preset time in the database log.
[0049] Step 14: Convert the original log value stored in hexadecimal form of the time to be restored in the database log into a decimal intermediate value to be restored.
[0050] Step 15: 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 multiple relationship between the preset number of seconds and the decimal value.
[0051] In this embodiment, by determining the relationship between the reference time and the decimal data form, converting the time into seconds, and using the relationship between the number of 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 as to accurately and efficiently analyze the log data of the database, and further facilitate the performance monitoring and fault diagnosis of the database.
[0052] 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 method for restoring the database log time, which is applied to the Gaussdb-100 database, including the following steps:
[0053] Step 21: Input multiple first preset times into the database and obtain the corresponding first original log values in the database log.
[0054] Among them, the hours, minutes, and seconds in the first preset time are all 0, and the number of 0s in the numbers of year, month, and day is greater than 2.
[0055] In this step, multiple different preset first times are input into the database, and the first original log value of each first preset time is obtained from the log of the database.
[0056] Since 0 is a relatively special number and corresponds to simple and identifiable information in multiple number systems, times with more 0s in the time data are selected for input, and their original log values in the database log are obtained. The preset time here is time data including year, month, day, hour, minute, and second. For example, 2001-01-02 05:00:02 is a complete first preset time.
[0057] Step 22: Determine that the first preset time corresponding to the first original log value with the most 0s among the first original log values corresponding to multiple first preset times in the database log is the reference preset time.
[0058] 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 it is necessary to restore the time data in the log to the actual time, a reference time needs to be determined. Based on this reference time, calculations can be performed forward and backward. Here, when the first preset time is 2000-01-01 00:00:00, all the values in its corresponding first original log value 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 values corresponding to 0 in the number system are all 0. Therefore, starting from 0 for calculation simplifies the calculation logic.
[0059] Step 23: Determine the multiple relationship between the preset number of seconds and the decimal value according to the number of 0s between the last digit and the first non-zero value of the second original log value corresponding to the preset number of seconds, the first original log value of the reference preset time, and the second preset time after adding the preset number of seconds to the reference preset time in the database log.
[0060] In this step, since the time data is represented by pure digits from 0 to 9, decimal representation is introduced as an intermediate value to further determine which number system is used to represent the value in the log. Specifically, based on the reference preset time, a preset number of seconds is added, such as adding one second or two seconds, to obtain one or more second preset times. The second preset times are input into the database, and the corresponding second original log values in the database log are obtained. For example, as shown in Table 1 below:
[0061] Table 1
[0062]
[0063] 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. The decimal value corresponding to 0000000000000000 is 0. So, when adding one second to 2000-01-01 00:00:01, the corresponding decimal value increases by 1 second on the basis of 0, that is, 1. However, when converting decimal 1 to other number systems, there will be no situation with multiple 0s. When 1 second is represented in microseconds, 1 second is equal to 1000 milliseconds (ms), and 1 millisecond is equal to 1000 microseconds (μs), so 1s = 1000 * 1000 = 1000000μs. At this time, the number of trailing 0s in decimal 1000000 is relatively close to the number of 0s at the end of 40420f0000000000. Similarly, the decimal value corresponding to 2000-01-01 00:00:02 is an increase of 2 seconds (2000000μs) on the basis of 0, that is, decimal is represented by 2000000. Therefore, when using decimal representation, the increase or decrease in time on the basis of the reference preset time is represented in decimal and in microseconds as a preset association relationship, that is, for every 1 second increase in time, the decimal value increases by 1000000. For example, adding 24 hours and 2 seconds to the reference preset time 2000-01-01 00:00:00 gives 2000-01-02 00:00:02, which is equivalent to an increase of 86402 seconds, that is, 86402000000μs. Then, on the basis of the decimal representation 0 of the reference preset time, the decimal value of 2000-01-02 00:00:02 increases by 86402000000, that is, 86402000000.
[0064] Step 24: Determine that the storage format of the time in the database log is hexadecimal based on 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 adding 24 hours to the second preset time.
[0065] The specific steps of Step 24 include Steps 241 - 245:
[0066] Step 241: Determine the decimal value of the third preset time after adding 24 hours to the second preset time according to the multiple relationship between the preset number of seconds and the decimal value.
[0067] 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 adding 24 hours is 2000 - 01 - 02 00:00:02, which is equivalent to adding 86400000000 μs to the second preset time. The decimal value of 2000 - 01 - 01 00:00:02 is 2000000, so the decimal value of 2000 - 01 - 02 00:00:02 is 86402000000.
[0068] Step 242: Input the third preset time into the database and obtain the corresponding third original log value in the database log.
[0069] Step 243: Determine whether there are multiple letters in the third original log value.
[0070] Step 244: If so, determine whether the number of 0s between the last digit and the first non - zero digit of the third original log value is greater than or equal to the number of 0s between the last digit and the first non - zero digit of the decimal value of the third preset time.
[0071] Here, when the third preset time 2000 - 01 - 02 00:00:02 is input into the database, the corresponding log value in the database log is 80E4F51D14000000. Since there are multiple letters in this log value, it can be preliminarily determined that the time data in the log is represented in hexadecimal.
[0072] Step 245: When the number of 0s between the last digit and the first non - zero digit of the third original log value is greater than or equal to the number of 0s between the last digit and the first non - zero digit of the decimal value of the third preset time, determine that the storage format of the time in the database log is hexadecimal.
[0073] In this step, 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, with the number of trailing zeros being six, which is equal to the number of trailing zeros of 86402000000 in decimal. From the other time examples above, it can be seen that the number of trailing zeros in the original log value is greater than the number of trailing zeros in decimal. For the corresponding numbers, it conforms to the character rule of decimal and hexadecimal conversion. Therefore, it can be determined that the storage location of the time in the database log is in hexadecimal.
[0074] At the same time, converting the above time example from decimal to hexadecimal gives the log value in the database log.
[0075] Step 25: Convert the original log value in which the time to be restored is stored in hexadecimal form in the database log into a decimal form of the intermediate value to be restored.
[0076] In this step, after determining that the time in the database log is represented in hexadecimal, any time in the database log can be restored to the actual time through decimal.
[0077] Step 26: 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 multiple relationship between the preset number of seconds and the decimal value.
[0078] In this step, after converting the intermediate value to be restored into decimal, the number obtained by dividing the intermediate value to be restored by 1000000 is the number of seconds added on the basis of the reference preset time, which is also the total number of seconds added on the basis of the reference preset time. Then calculate how many days, hours, minutes, and seconds this total number of seconds is, that is, how many days, hours, minutes, and seconds are added on the basis of the reference preset time, and the actual time of the time to be restored can be obtained.
[0079] For example, converting the original log value in which the time to be restored is stored in hexadecimal form in the database log into a decimal form of the intermediate value to be restored is 172800000000, that is, 172800000000 microseconds. 172800000000 / 1000000 = 172800 seconds, 172800 / 60 = 2880 minutes, 2880 / 60 = 48 hours, that is, 48 hours are added on the basis of the reference preset time 2000-01-01 00:00:00, that is, two days are added, and the obtained actual time is 2000-01-03 00:00:00.
[0080] As Figure 2 shown, the third aspect of the embodiment of the present invention provides a device for restoring the time of a database log, including:
[0081] The first determination module 31 is configured to determine, according to the number of digits 0 in the first original log values corresponding to multiple first preset times in the database log, that the first preset time corresponding to the first original log value with the largest number of digits 0 is the reference preset time; wherein, the hour, minute, and second in the first preset time are all 0, and the number of digits 0 in the year, month, and day numbers is greater than 2;
[0082] The second determination module 32 is configured to determine the multiple relationship between the preset number of seconds and the decimal value according to the number of digits 0 between the last digit and the first non-zero value of the second original log value corresponding to the preset number of seconds, the first original log value of the reference preset time, and the second preset time after adding the preset number of seconds to the reference preset time in the database log;
[0083] The third determination module 33 is configured 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 adding 24 hours to the second preset time in the database log;
[0084] The conversion module 34 is configured to convert the original log value stored in hexadecimal form in the database log of the time to be restored into an intermediate value to be restored in decimal form;
[0085] The fourth determination module 35 is configured 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 multiple relationship between the preset number of seconds and the decimal value.
[0086] In an embodiment of the present invention, determining 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 adding 24 hours to the second preset time includes:
[0087] Determining the decimal value of the third preset time after adding 24 hours to the second preset time according to the multiple relationship between the preset number of seconds and the decimal value;
[0088] Inputting the third preset time into the database to obtain the third original log value corresponding in the database log;
[0089] Judging whether there are multiple letters in the third original log value;
[0090] If so, judging whether the number of digits 0 between the last digit and the first non-zero value of the third original log value is greater than or equal to the number of digits 0 between the last digit and the first non-zero value of the decimal value of the third preset time;
[0091] When 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, determine that the storage method of the time in the database log is hexadecimal.
[0092] In an embodiment of the present invention, it further includes:
[0093] An acquisition module, configured to input multiple first preset times into the database and acquire corresponding first original log values in the database log.
[0094] In an embodiment of the present invention, the multiple relationship between the preset number of seconds and the decimal value is that 1 second is equal to 1,000,000.
[0095] A fourth aspect of the embodiments of the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the method for restoring the time of the database log provided by the embodiments of the present invention.
[0096] A fifth aspect of the embodiments 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, it implements the steps of the method for restoring the time of the database log provided by the embodiments of the present invention.
[0097] Among them, the memory may include a random access memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.
[0098] The aforementioned processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; it may also be a digital signal processor (Digital Signal Processing, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field-Programmable Gate Array, FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware systems.
[0099] The method provided by the embodiments of the present invention can be applied to an electronic device. Specifically, the electronic device can be: a desktop computer, a portable computer, a smart mobile terminal, a server, etc. There is no limitation here, and any electronic device that can implement the present invention belongs to the protection scope of the present invention.
[0100] For the device / electronic device embodiments, since they are basically similar to the method embodiments, the description is relatively simple. For the relevant parts, refer to the partial description of the method embodiments.
[0101] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the 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 the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the specified functions in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0102] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured product including an instruction device, and the instruction device implements the specified functions in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0103] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for implementing the specified functions in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0104] 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 equivalent technologies, the present invention is also intended to include these changes and modifications.
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; 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 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, determine that the storage method of the time in the database log is hexadecimal; 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 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.
3. The method according to claim 1, characterized in that The relationship between the preset number of seconds and the multiple of the decimal value is that 1 second equals 1000000.
4. A database log time restoration device, 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, configured 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 a third original log value in the database log corresponding to the third preset time after the second preset time is increased by 24 hours, comprises: 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 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, determine that the storage method of the time in the database log is hexadecimal; 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.
5. The device according to claim 4, 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.
6. The device according to claim 4, characterized in that The relationship between the preset number of seconds and the multiple of the decimal value is that 1 second equals 1000000.
7. 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 3 is implemented.
8. 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 3 is implemented.
Citation Information
Patent Citations
Data structure based on cloud computing database system
CN103399945A
IEMS data problem checking system and method
CN112765228A