Database repairing method and device, computer readable medium and electronic equipment

By automatically detecting and repairing database exceptions, users can repair the database independently, solving the problems that users need to wait for developers to deal with in the existing technology, achieving efficient repair and data fault tolerance, and improving user experience.

CN120407373APending Publication Date: 2025-08-01TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410114944.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-25
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In the prior art, when an application is abnormal, users need to feedback to developers and wait for processing, resulting in inefficiency and poor user experience. Especially when a large-scale abnormality is abnormal, developers cannot follow up in time, resulting in high costs and low efficiency.

Method used

Provides a database repair method, which automatically detects exceptions, backs up the database, and pops up the repair boot page. The user triggers the repair operation, automatically performs the repair, and replaces the database after completion, supporting manual repair and data synchronization.

Benefits of technology

It realizes that users can repair database abnormalities independently and efficiently, reduce the risk of data loss, improve user experience, reduce customer complaints, and improve data error tolerance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407373A_ABST
    Figure CN120407373A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a database repairing method and device, a computer readable medium and electronic device.The method comprises the steps that when it is detected that a target database of an application program is abnormal, the target database is backed up, and a target backup database is obtained; popping up a repair guide page including a repair option so that a user can trigger a repair operation through the repair guide page; when a first trigger instruction for the repair option is received, automatically executing repair operation on the target backup database according to the first trigger instruction; and when repairing of the target backup database is completed, replacing the target database with the target backup database. According to the embodiment of the invention, the user can more efficiently repair the abnormity of the database, the user experience is remarkably improved, the error-tolerant rate of the data can also be improved, and the influence of the abnormity of the target database on the user is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software debugging technology, and in particular to a database repair method, device, computer-readable medium, and electronic device. Background Art

[0002] With the development of mobile Internet, a large number of applications have emerged. When users are using applications, the applications may become abnormal, causing users to be unable to continue to use the applications normally.

[0003] Currently, users often provide feedback to app developers to ensure they can continue using their apps. However, many apps don't offer a way to provide feedback to app developers. Even when some apps do, developers may not always respond promptly. Consequently, current solutions are highly inefficient when handling exceptions, reducing the user experience. Summary of the Invention

[0004] The embodiments of the present application provide a database repair method, apparatus, computer-readable medium, and electronic device, which can, at least to a certain extent, enable users to more efficiently repair database anomalies and improve user experience.

[0005] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by practice of the present application.

[0006] According to one aspect of an embodiment of the present application, a database repair method is provided, the method comprising: when an abnormality is detected in a target database of an application, backing up the target database to obtain a target backup database; popping up a repair guide page including a repair option so that a user can trigger a repair operation through the repair guide page; when a first trigger instruction for the repair option is received, automatically performing a repair operation on the target backup database according to the first trigger instruction; and when the repair of the target backup database is complete, replacing the target database with the target backup database.

[0007] According to one aspect of the embodiments of the present application, a database repair device is provided. The device includes: a backup unit, configured to back up the target database when it is detected that the target database of the application program is abnormal, to obtain a target backup database; a display unit, configured to pop up a repair guidance page including repair options, so that the user can trigger a repair operation through the repair guidance page; an automatic repair unit, configured to automatically perform a repair operation on the target backup database according to the first trigger instruction when receiving the first trigger instruction for the repair option; a replacement unit, configured to replace the target database with the target backup database when the repair of the target backup database is completed.

[0008] In some embodiments of the present application, based on the foregoing solution, the target database is used to store the message data received by the application program. The device further includes a database reconstruction unit; after backing up the target database, the database reconstruction unit is configured to: reconstruct the target database to obtain a target reconstructed database; continue to store the newly received message data of the application program through the target reconstructed database; the replacement unit is configured to: replace the target reconstructed database with the target backup database.

[0009] In some embodiments of the present application, based on the foregoing solution, the replacement unit is configured to: when the repair of the target backup database is completed, name the target backup database with a target name, where the target name is different from the name of the target database; delete the target database; perform an initialization operation on the target backup database to rename the target backup database to the name of the target database, to obtain a new target database.

[0010] In some embodiments of the present application, based on the foregoing solution, the device further includes a synchronization unit; after obtaining the new target database, the synchronization unit is configured to: synchronize the newly received message data in the cloud to the new target database.

[0011] In some embodiments of the present application, based on the foregoing solution, the device further includes a manual repair unit; after backing up the target database, the manual repair unit is configured to: when receiving a wake-up instruction for the manual repair page in the application program, display the manual repair page, and the manual repair page shows at least one repair option; when receiving a second trigger instruction for a target repair option among at least one repair option on the manual repair page, automatically perform a repair operation on the target backup database according to the second trigger instruction.

[0012] In some embodiments of the present application, based on the foregoing solution, the automatic repair unit is configured to: when receiving a first trigger instruction for the repair option, determine whether at least one backup database has been generated; if it is determined that at least one backup database has been generated, select a target backup database from the at least one backup database according to a predetermined rule, and automatically perform a repair operation on the target backup database according to the first trigger instruction.

[0013] In some embodiments of the present application, based on the foregoing solution, the automatic repair unit is configured to: select the latest generated backup database from the at least one backup database as the target backup database.

[0014] In some embodiments of the present application, based on the foregoing solution, after determining whether at least one backup database has been generated, the automatic repair unit is further configured to: if it is determined that no backup database has been generated, repair the target database.

[0015] In some embodiments of the present application, based on the foregoing solution, the device further includes a log recording unit; after naming the target backup database as the target name, the log recording unit is configured to: write the record information related to the current repair into the log.

[0016] According to one aspect of the embodiments of the present application, there is provided a computer-readable medium having a computer program stored thereon, and when the computer program is executed by a processor, the repair method of the database as described in the above embodiments is implemented.

[0017] According to one aspect of the embodiments of the present application, there is provided an electronic device, including: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the repair method of the database as described in the above embodiments.

[0018] According to one aspect of the embodiments of the present application, there is provided a computer program product, the computer program product includes computer instructions, the computer instructions are stored in a computer-readable storage medium, a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the repair method of the database as described in the above embodiments.

[0019] In the technical solutions provided by some embodiments of the present application, when it is detected that the target database of an application is abnormal, the target database is first backed up to obtain a target backup database, and then a repair guidance page for the user to trigger a repair operation is popped up. Then, when the user triggers the repair option in the repair guidance page, that is, when the first trigger instruction for the repair option is received, the repair operation will be automatically performed on the target backup database according to the first trigger instruction. Finally, when the repair of the target backup database is completed, the repair process ends by replacing the target database with the target backup database. Therefore, based on the solution of the embodiments of the present application, the user can timely discover the abnormality of the target database of the application, and the entire repair process is carried out in an automatic guidance manner without the user having to feedback to the developer. Therefore, the abnormality of the target database can be repaired more efficiently, the target database can be restored to normal more quickly, the possibility of user complaints can be reduced, and the user experience is effectively improved; since the target database is backed up first and then the subsequent repair process is immediately performed, the data fault tolerance rate can be improved, and the impact of the abnormality of the target database on the user can be reduced.

[0020] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The accompanying drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can obtain other drawings according to these drawings without creative efforts. In the drawings:

[0022] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of the present application can be applied is shown;

[0023] Figure 2 A flowchart of a method for repairing a database according to an embodiment of the present application is shown;

[0024] Figure 3 A schematic diagram of the overall process of database repair according to an embodiment of the present application is shown;

[0025] Figure 4 A schematic diagram of a repair guidance page according to an embodiment of the present application is shown;

[0026] Figure 5 A schematic diagram of the process of repairing a database according to an embodiment of the present application is shown;

[0027] Figure 6shows a Figure 2 flowchart of the details of step 230 in an embodiment;

[0028] Figure 7 shows a Figure 2 flowchart of the details of step 260 in an embodiment;

[0029] Figure 8 shows a Figure 7 flowchart of the steps after step 263 in an embodiment;

[0030] Figure 9 shows a Figure 2 flowchart of the steps after step 210 in an embodiment;

[0031] Figure 10 block diagram of a repair device for a database according to an embodiment of the present application;

[0032] Figure 11 shows a schematic structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application. Detailed implementation manners

[0033] Example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more complete and comprehensive, and will fully convey the concept of the example embodiments to those skilled in the art.

[0034] In addition, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of the present application. However, those skilled in the art will realize that the technical solutions of the present application can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. can be used. In other cases, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the present application.

[0035] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, which works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that includes the function of that module or unit.

[0036] The block diagrams shown in the drawings are only functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0037] The flowcharts shown in the drawings are only illustrative and do not necessarily include all the content and operations / steps, nor do they have to be executed in the described order. For example, some operations / steps can be decomposed, while some operations / steps can be combined or partially combined, so the actual execution order may change according to the actual situation.

[0038] With the development of the Internet, especially mobile Internet, more and more technology companies provide services by releasing application programs. However, it is often inevitable for application programs to have exceptions.

[0039] Many users often feel at a loss when faced with exceptions in application programs and often don't know what to do. In many cases, even if an exception occurs in an application program, if the exception does not affect the main functions of the application program that the user uses, then the user may even ignore the exception of the application program, which degrades the user experience.

[0040] Currently, users mainly handle exceptions by feedback to the developers of the application programs. The process of users finding the feedback entry to the developers and waiting for the developers to fix the exceptions will also affect the user experience. If the developers cannot follow up and handle the exceptions in a timely manner, it will further affect the user experience. Moreover, developers often need to manually fix the exceptions, which is costly. Especially when exceptions occur in the application programs of a large number of users in a short period of time, developers simply cannot fix the exceptions for each user one by one. Therefore, this is a very inefficient solution.

[0041] For this reason, this application first provides a method for repairing a database. Based on the method for repairing a database provided by the embodiments of this application, the above-mentioned defects can be overcome. Users do not need to give feedback to the developers and can repair the database by themselves, can automatically detect and guide users to automatically restore data, reduce the possibility of complete data loss, improve the data fault tolerance rate, and reduce possible customer complaints.

[0042] Figure 1 Shows a schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of this application can be applied. As Figure 1As shown, the system architecture 100 may include multiple user terminals and a cloud 150. The cloud 150 may include several servers. The multiple user terminals specifically include a first user terminal 110, a second user terminal 120, a third user terminal 130, and a fourth user terminal 140. Each user terminal has established a communication connection with the cloud 150. A server side of a communication tool is deployed on the cloud 150, and a client side of an instant messaging tool is installed and running on each user terminal. The second user terminal 120 may be the execution entity of the solution of the embodiment of the present application. When a method for repairing a database provided by the embodiment of the present application is applied to Figure 1 the system architecture shown, a process may be as follows: First, the user of the first user terminal 110 requests to send a message to the user of the second user terminal 120 through the client of the first user terminal 110, and the first user terminal 110 will send the message to the cloud 150. Then, after receiving the message, the cloud 150 will first store the message and forward the message to the second user terminal 120. After receiving the message, the client of the second user terminal 120 will read and display the message, and the user of the second user terminal 120 can see the message sent by the user of the first user terminal 110. The client of the second user terminal 120 will also store the message in the local database. The client of the instant messaging tool also provides the user with the function of searching for historical messages, and this function is actually implemented by querying the local database of the user terminal. In this way, when the user of the second user terminal 120 uses the client of the second user terminal 120 to search for historical messages, if the local database is normal, then the user will search for all messages including this message. When the second user terminal 120 continues to receive a message sent by a certain user terminal, if the local database of the second user terminal 120 is abnormal, for example, this abnormality will cause the user to be unable to search for messages when searching for historical messages, then the client of the second user terminal 120 will automatically detect this abnormality by executing the method for repairing the database provided by the embodiment of the present application and guide the user to perform a repair operation.

[0043] In some embodiments of the present application, the ability to send and receive messages between the clients on different user terminals is determined according to the relationship between the accounts logged in to the clients.

[0044] In some embodiments of the present application, if the relationship between the accounts logged in to multiple clients is a friend relationship or a group chat relationship, then the clients logged in to these accounts can all send and receive messages.

[0045] In some embodiments of the present application, the client of the second user terminal 120 detects the local database whenever it receives a message and requests to write the message into the local database.

[0046] In some embodiments of the present application, the client of the second user terminal 120 guides the user to provide a trigger instruction by popping up a repair guidance page, and then performs a repair operation according to the trigger instruction.

[0047] It should be understood that Figure 1 the number of each user terminal and the number of clouds in are merely illustrative. According to actual needs, there can be any number of user terminals and clouds, that is, the number of user terminals can be less than 4 or more than 4, and there can be multiple clouds.

[0048] It should be noted that Figure 1 only one embodiment of the present application is shown. Although in Figure 1 the solution of the embodiment, each user terminal is a smart phone and the execution entity is the cloud, but in other embodiments of the present application, the user terminal can also be various types of terminal devices such as desktop computers, laptop computers, tablet computers, vehicle-mounted terminals, portable wearable devices, workstations, etc., and the execution entity can also be an ordinary server, and the types of different user terminals can be different; although Figure 1 the solution of the embodiment is for repairing a type of database exception that causes the user to be unable to search for messages when searching for historical messages, but in other embodiments of the present application, it can also be for repairing other types of database exceptions; although Figure 1 the solution of the embodiment is mainly for repairing database exceptions, but in other embodiments of the present application, it can also be for repairing exceptions of other types of application programs. The embodiments of the present application do not make any restrictions in this regard, and the protection scope of the present application should not be limited by this either.

[0049] It is easy to understand that the database repair method provided by the embodiments of the present application is generally executed by a terminal device. Correspondingly, the database repair device is generally set in the terminal device. However, in other embodiments of the present application, the server can also have a similar function as the terminal device, so as to execute the database repair solution provided by the embodiments of the present application.

[0050] Therefore, the embodiments of the present application can be applied to a terminal or a server. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal and the server can be directly or indirectly connected through wired or wireless communication methods, and the present application does not make any restrictions in this regard.

[0051] The implementation details of the technical solution of the embodiments of the present application are elaborated in detail as follows:

[0052] Figure 2 The flowchart of the database repair method according to an embodiment of the present application is shown. The database repair method can be executed by various devices with processing and display functions, such as a user terminal or a cloud server. The user terminal includes but is not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, smart watches, etc. Please refer to Figure 2 As shown, the database repair method at least includes the following steps:

[0053] In step 210, when it is detected that the target database of the application program appears abnormal, the target database is backed up to obtain a target backup database.

[0054] The application program can be of various types. According to the type of the deployed device, the application program can be an APP on a mobile terminal (such as a smart phone, a tablet computer), or software on other terminal devices such as a desktop computer or a laptop computer. According to the function of the application program, the application program can be a communication tool or an instant messaging tool, or other various software with communication functions. Users of different instant messaging tools can send messages in real time through the instant messaging tool.

[0055] The target database is a database for storing message data, and the target database can be used to store the message data received by the application program. The target database can be a lightweight relational database. Specifically, the target database can be a SQLite database. SQLite is a lightweight in-process embedded database, and its database is a file, which implements a self-sufficient, serverless, zero-configuration, transactional SQL database engine.

[0056] Therefore, when the target database of the application program is a SQLite database, the target database is actually a database file.

[0057] The target database of the application program can be detected for abnormality in various situations. For example, the target database of the application program can be detected regularly, or the target database of the application program can be detected whenever a message data is received and needs to be written into the target database.

[0058] It can be determined whether the target database appears abnormal by detecting whether the target database outputs an error message.

[0059] Exceptions in the target database can be of various types. For example, the database file may be damaged. Different types of exceptions in the target database will generate different error messages. The reasons for a certain exception may be diverse. For example, problems with the user's terminal device such as hardware issues, power loss of the device, or abnormal program exits can all cause damage to the database file.

[0060] Next, take the exception of database file damage in an instant messaging tool as an example to introduce the solution of the embodiments of the present application.

[0061] Figure 3 FIG. shows a schematic diagram of the overall process of database repair according to an embodiment of the present application. Please refer to Figure 3 As shown, the overall process of database repair may include the following steps:

[0062] Step 310, the sqlite database reports an error at the bottom layer.

[0063] For example, scenarios such as failed database opening or network disconnection may cause the database to report an error.

[0064] Step 320, the user experiences an exception.

[0065] When using the instant messaging tool, the user may find an exception. For example, it may affect the user's data search, that is, the user cannot search for historical messages.

[0066] Step 330, backup the info.db in the database to info.db.cbk.

[0067] To avoid affecting the user's subsequent use and reduce the repair time, when an exception occurs, the damaged database is directly backed up. Specifically, the damaged database is the file named info.db. By backing it up, a file named info.db.cbk can be obtained, that is, the corresponding backup database.

[0068] Please continue to refer to Figure 2 , in step 220, a repair guidance page including repair options is popped up so that the user can trigger a repair operation through the repair guidance page.

[0069] For different types of exceptions, different repair guidance pages can be popped up.

[0070] Figure 4 FIG. shows a schematic diagram of the repair guidance page according to an embodiment of the present application. Please refer to Figure 4As shown, the repair guidance page includes a repair option "Start Repair". Users can trigger the repair operation by clicking on this repair option. It can be seen that in addition to the repair option, the repair guidance page also includes other information, such as information for prompting the cause of the abnormality and the operations that users should perform, like "The XX database is damaged, which may affect normal use. It is recommended to try to repair the data".

[0071] It is easy to understand that the repair guidance page can be popped up not directly, but in the form of a secondary page of a notification. That is to say, a notification page can be directly popped up, which notifies the user that the database is damaged. It can also include a "Repair" button. When the user triggers this "Repair" button after seeing the notification page, the repair guidance page as shown Figure 4 will be displayed. In this way, the database repair operation can be effectively prevented from being accidentally triggered.

[0072] Please continue to refer to Figure 3 As shown, after step 330, the following steps are further included:

[0073] Step 340, Notify the UI.

[0074] Send the notification to the user interface (User Interface, UI) layer of the application. When the user interface layer receives the notification, corresponding UI operations will be executed. Each type of exception will have a corresponding notification. The notification can include a specific flag, which can be used to identify the type of the corresponding exception. When the user interface layer of the application receives a notification indicating database damage, corresponding UI operations can be executed.

[0075] Step 350, The UI receives the notification.

[0076] In an embodiment of the present application, the notification received by the user interface layer of the application is cross-platform.

[0077] Specifically, users can log in to the application on multiple platforms at the same time. For example, users can log in to the application on the mobile terminal, tablet terminal, and PC terminal respectively at the same time. When the target database of the application on a certain terminal (such as the mobile terminal) has an abnormality, the user interface layer of the application on other terminals will also receive the notification. This enables users to learn that the target database of the application has an abnormality when using the application on other terminals, so as to process it in time.

[0078] Step 360, The UI pops up the guidance page.

[0079] It can pop up Figure 4The displayed repair guidance page uses simple copywriting to prompt the user about the anomalies and guides the user to trigger the repair operation by clicking the "Start Repair" button.

[0080] Please continue to refer to Figure 2 , in step 230, when receiving the first trigger instruction for the repair option, automatically perform a repair operation on the target backup database according to the first trigger instruction.

[0081] Please continue to refer to Figure 3 As shown, in step 370, the user clicks the "Start Repair" button.

[0082] When the user clicks the "Start Repair" button, a first trigger instruction will be generated.

[0083] Step 380, start repairing the database.

[0084] Start performing a repair operation on the target backup database according to the first trigger instruction.

[0085] Next, in combination with Figure 5 and Figure 6 to introduce in detail how to repair the database.

[0086] Figure 6 Shows a Figure 2 flowchart of the details of step 230 according to an embodiment of the present application. Please refer to Figure 6 As shown, when receiving the first trigger instruction for the repair option, automatically perform a repair operation on the target backup database according to the first trigger instruction, which may specifically include:

[0087] In step 231, when receiving the first trigger instruction for the repair option, determine whether at least one backup database has been generated.

[0088] Since the backup database will be named.cbk, it is possible to determine whether a backup database has been generated by judging whether there is a file with the.cbk suffix.

[0089] If the backup is not successful during backup or the target backup database is accidentally deleted by the user, it will result in the situation where the backup database cannot be found. By judging whether at least one backup database has been generated in this step, the redundancy and reliability of the system can be improved.

[0090] Specifically, before using the current version of the application program with the automatic guided repair function for the database, the user may have used an old version of the application program, and the old version of the application program may only have the backup function for the database without the automatic guided repair function for the database. Therefore, there may be multiple backup databases.

[0091] In step 232, if it is determined that at least one backup database has been generated, a target backup database is selected from the at least one backup database according to a predetermined rule, and a repair operation is automatically performed on the target backup database according to the first trigger instruction.

[0092] In an embodiment of the present application, selecting a target backup database from at least one backup database according to a predetermined rule includes: selecting the latest generated backup database from the at least one backup database as the target backup database.

[0093] The backup databases can be sorted according to their generation times, and the backup database with the largest generation time is used as the target backup data.

[0094] Since the latest generated backup database often contains more comprehensive message data, by using the latest generated backup database as the target backup database, omission of message data can be avoided.

[0095] In an embodiment of the present application, after determining whether at least one backup database has been generated, the database repair method may further include: if it is determined that no backup database has been generated, repairing the target database.

[0096] In the case where no backup database has been generated, the target database can be directly repaired by adopting the method of repairing the target backup database, and the purpose of repair can also be achieved. Of course, in order to improve the reliability of repair, when there is a backup database, the backup database needs to be repaired preferentially.

[0097] Figure 5 The flowchart showing the repair of a database according to an embodiment of the present application is shown. Please refer to Figure 5 As shown, the repair of the database may specifically include the following processes:

[0098] Step 510, start repairing the database.

[0099] ]>Start performing a repair operation on the target backup database according to the first trigger instruction.

[0100] Step 520, determine whether there is a cbk file.

[0101] Determine whether there is a database file with the suffix.cbk. If there is, perform step 530; if not, perform step 540.

[0102] Step 530, obtain the latest file address.

[0103] Obtain the file address of the latest generated cbk file.

[0104] Step 540, obtain the address of info.db.

[0105] Obtain the file address of the file named info.db (i.e., the target database).

[0106] Step 550, open the local database through the address.

[0107] The file address is the storage path of the file; find the file based on the storage path, and then open the file, which is the local database.

[0108] Step 560, perform the operation of repairing the database.

[0109] Start to prepare to perform the operation of repairing the database.

[0110] Step 570, sqlite executes the dump command.

[0111] The inventor of the present application analyzed the collected damaged SQLite files and found that most SQLite damages were caused by the inconsistency between the stored message data and the number read from the SQLite header file, resulting in index anomalies and inability to read the corresponding data. For this kind of damage, the SQLite itself supports a dump method for repair. When the dump command is executed, SQLite will enter the SQLITE_RecoveryMode mode. In this mode, SQLite can bypass the error of inconsistent quantities.

[0112] Therefore, the interface provided by sqlite can be called by executing the dump command in sqlite, thereby realizing the automatic repair of the database.

[0113] In step 260, when the repair of the target backup database is completed, replace the target database with the target backup database.

[0114] When backing up the target database, the timestamp of the backup time and the name of the target database can be backed up to the target backup database. The database to be replaced by the target backup database can be determined according to the name of the backed-up target database.

[0115] Figure 7 Shows according to an embodiment of the present application Figure 2 The flowchart of the details of step 260 in the embodiment. Please refer to Figure 7 As shown, when the repair of the target backup database is completed, replace the target database with the target backup database, which may specifically include the following steps:

[0116] In step 261, when the repair of the target backup database is completed, name the target backup database as the target name, and the target name is different from the name of the target database.

[0117] The target backup database can be named the target name by adding the suffix "recover" to the name of the target backup database.

[0118] In an embodiment of the present application, after naming the target backup database the target name, the method may further include the following steps: writing the record information related to this repair into a log.

[0119] By writing the record information related to each repair into a log after each repair is completed, it is convenient for subsequent troubleshooting information usage.

[0120] In step 262, the target database is deleted.

[0121] The repair of the database has been completed. At this time, the target database is no longer needed, and the target database can be deleted to save storage space.

[0122] In step 263, an initialization operation is performed on the target backup database to rename the target backup database to the name of the target database, obtaining a new target database.

[0123] Naming the target backup database the name of the target database can make the target backup database be used by the application program in the same way as the original target database.

[0124] Please continue to refer to Figure 5 As shown, after step 570, the following steps are further included:

[0125] Step 580, naming the repaired database "info.db.recover".

[0126] Whether repairing the "info.db" file or the "info.db.cbk" file, after the repair is completed, the "recover" suffix should be added. The purpose of doing this is to delete the original damaged "info.db" and use the repaired database.

[0127] Step 590, deleting the original damaged database.

[0128] Deleting the original damaged database, that is, the "info.db" file.

[0129] Step 5100, backing up the log file.

[0130] After the repair is completed, the information related to this repair is backed up to the log file for easy troubleshooting.

[0131] Step 5110, initializing the database.

[0132] In step 580, the repaired database has been named as a file with the suffix.recover. After deleting the damaged database, by re-initializing the database, the repaired database is named info.db.

[0133] In an embodiment of the present application, after backing up the target database, the database repair method further includes: reconstructing the target database to obtain a target reconstructed database; storing the message data newly received by the application program through the target reconstructed database; replacing the target database with the target backup database, including: replacing the target reconstructed database with the target backup database.

[0134] If the target database has already stored the message data of 1000 messages, then, after backing up the target database, the target database will be reconstructed. The target reconstructed database no longer contains the message data of these 1000 messages, and the subsequent newly received messages will be written into the target reconstructed database obtained by reconstruction. This enables the messages received after these 1000 messages to be normally searched by the user, and this can have no impact on the reception and storage of message data during the repair process.

[0135] Figure 8 Shows according to an embodiment of the present application Figure 7 The flowchart of the steps after step 263 in the embodiment. Please refer to Figure 8 As shown, after obtaining the new target database, the database repair method may further include the following steps:

[0136] In step 270, synchronize the newly received message data in the cloud to the new target database.

[0137] Each application program receives message data from other application programs through the cloud. Therefore, message data can also be stored in the cloud. The cloud can store the message data sent within a predetermined time period before the current time, and the predetermined time period can be freely defined by the developer, for example, it can be defined as 3 months.

[0138] Of course, in other embodiments of the present application, since the target reconstructed database has already stored the newly received message data, therefore, the newly received message data in the target reconstructed database can also be directly synchronized to the new target database.

[0139] Please continue to refer to Figure 3 As shown, the following steps may further be included after step 380:

[0140] Step 390, the repair is completed.

[0141] Complete the repair operation on the target backup database to obtain a new target database.

[0142] Step 3100, sync to the latest message.

[0143] Synchronize the message data from the cloud to the new target database.

[0144] Step 3110, the user resumes normal use.

[0145] The user can use the application normally.

[0146] Figure 9 Shows the Figure 2 flowchart of the steps after step 210 in an embodiment according to the present application. Please refer to Figure 9 As shown, after backing up the target database, the database repair method may further include the following steps:

[0147] In step 240, when a wake-up instruction for the manual repair page in the application is received, display the manual repair page, and the manual repair page displays at least one repair option.

[0148] The display difficulty of the manual repair page is generally greater than that of other pages in the application. Here, the display difficulty is used to measure the difficulty of finding and triggering the display of a certain page in the application. In this way, it is possible to prevent the user from accidentally triggering and displaying the manual repair page, ensuring a good user experience.

[0149] For example, the user can generate a wake-up instruction for the manual repair page by triggering a hidden easter egg button to display the manual repair page. The way for the user to find the hidden easter egg button can be defined as: after the user enters the home page of the application, the hidden easter egg button needs to be found by the user through multiple-level page jumps. Here, the multiple-level pages refer to pages above level 3, such as level 4 pages, level 5 pages, etc. The number of levels of the page refers to the number of jumps. For example, to enter a level 1 page, the user needs to click a certain button on the home page of the application and jump once.

[0150] The way for the user to find the hidden easter egg button can also be defined as: the user needs to shake the terminal (such as a smart phone) where the application is located with a certain force. When the application detects that the force of the user shaking the terminal is greater than a predetermined threshold, the application will pop up the hidden easter egg button.

[0151] The triggering difficulty of the wake-up instruction can be greater than that of a regular triggering instruction. Therefore, the possibility of the wake-up instruction being accidentally triggered can also be reduced by setting a wake-up instruction that is difficult to trigger. For example, the triggering method of the wake-up instruction can be: the user needs to shake the terminal (such as a smartphone) where the application is located with a certain force; when the application detects that the force of the user shaking the terminal is greater than a predetermined threshold, the wake-up instruction will be triggered in the application. The triggering method of the wake-up instruction can be: the user clicks the target button multiple times continuously within a short period of time (within a predetermined time range). The triggering method of the wake-up instruction can also be: the user clicks two or more specified buttons on a certain page of the application simultaneously.

[0152] Step 240 can be executed when the user does not trigger the repair option in the repair guidance page. That is, after executing step 220, the user can manually close the repair guidance page and trigger the display of the manual repair page when needed.

[0153] In step 250, when receiving a second trigger instruction for the target repair option in at least one repair option of the manual repair page, a repair operation is automatically performed on the target backup database according to the second trigger instruction.

[0154] The manual repair interface display can show multiple repair options, each repair option corresponding to a type of exception existing in the application. The damage of the target database is a type of exception existing in the application.

[0155] To increase the flexibility of users' active repair, the embodiment of the present application introduces a mobile easter egg. The user can find a hidden easter egg button in the application, and after clicking it, it will jump to a dedicated repair interface. On this interface, the user can manually select repair options and perform repair operations as needed. This enables the user to perform manual repair at any time according to their own needs and circumstances.

[0156] In summary, according to the database repair method provided by the embodiment of the present application, at least the following technical effects can be achieved:

[0157] 1. Reduce the possibility of complete data loss: By automatically detecting and guiding repair, problems can be timely discovered and automatically repaired when the database file is damaged, effectively reducing the risk of complete data loss.

[0158] 2. Improve the data fault tolerance rate: Through regular automatic backup and repair operations, the system can improve the fault tolerance rate of the database file and reduce the impact of data damage on users.

[0159] 3. Reduce possible customer complaints: Through the dual solutions of automatic repair and manual repair with the mobile easter egg, data can be timely restored, reducing possible customer complaints from users and improving the user experience.

[0160] 4. Improve user engagement: By adding mobile Easter eggs, encourage users to actively participate in the repair process, enhancing user engagement and satisfaction.

[0161] The following describes the device embodiments of the present application, which can be used to execute the database repair method in the above embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the embodiments of the database repair method above of the present application.

[0162] Figure 10 The block diagram of a database repair device according to an embodiment of the present application is shown.

[0163] Refer to Figure 10 As shown, a database repair device 1000 according to an embodiment of the present application includes: a backup unit 1010, a display unit 1020, an automatic repair unit 1030, and a replacement unit 1040. Among them, the backup unit 1010 is used to back up the target database when it is detected that the target database of the application program appears abnormal, obtaining a target backup database; the display unit 1020 is used to pop up a repair guidance page including repair options, so that the user can trigger a repair operation through the repair guidance page; the automatic repair unit 1030 is used to automatically execute a repair operation on the target backup database according to the first trigger instruction when receiving the first trigger instruction for the repair option; the replacement unit 1040 is used to replace the target database with the target backup database when the repair of the target backup database is completed.

[0164] In some embodiments of the present application, based on the foregoing solution, the target database is used to store the message data received by the application program, and the device further includes a database reconstruction unit; after backing up the target database, the database reconstruction unit is used to: reconstruct the target database to obtain a target reconstructed database; continue to store the message data newly received by the application program through the target reconstructed database; the replacement unit 1040 is configured to: replace the target reconstructed database with the target backup database.

[0165] In some embodiments of the present application, based on the foregoing solution, the replacement unit 1040 is configured to: when the repair of the target backup database is completed, name the target backup database as a target name, the target name being different from the name of the target database; delete the target database; perform an initialization operation on the target backup database to rename the target backup database as the name of the target database, obtaining a new target database.

[0166] In some embodiments of the present application, based on the foregoing solution, the device further includes a synchronization unit; after obtaining the new target database, the synchronization unit is configured to: synchronize the newly received message data in the cloud to the new target database.

[0167] In some embodiments of the present application, based on the foregoing solution, the device further includes a manual repair unit; after backing up the target database, the manual repair unit is configured to: when receiving a wake-up instruction for the manual repair page in the application, display the manual repair page, where the manual repair page shows at least one repair option; when receiving a second trigger instruction for a target repair option among at least one repair option on the manual repair page, automatically perform a repair operation on the target backup database according to the second trigger instruction.

[0168] In some embodiments of the present application, based on the foregoing solution, the automatic repair unit 1030 is configured to: when receiving a first trigger instruction for the repair option, determine whether at least one backup database has been generated; if it is determined that at least one backup database has been generated, select a target backup database from the at least one backup database according to a predetermined rule, and automatically perform a repair operation on the target backup database according to the first trigger instruction.

[0169] In some embodiments of the present application, based on the foregoing solution, the automatic repair unit 1030 is configured to: select the latest generated backup database from the at least one backup database as the target backup database.

[0170] In some embodiments of the present application, based on the foregoing solution, after determining whether at least one backup database has been generated, the automatic repair unit 1030 is further configured to: if it is determined that no backup database has been generated, repair the target database.

[0171] In some embodiments of the present application, based on the foregoing solution, the device further includes a log recording unit; after naming the target backup database with a target name, the log recording unit is configured to: write record information related to the current repair into the log.

[0172] Figure 11 The structural schematic diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application is shown.

[0173] It should be noted that Figure 11 The computer system 1100 of the electronic device shown is only an example, and should not bring any limitation to the functions and usage scopes of the embodiments of the present application.

[0174] Such as Figure 11As shown, computer system 1100 includes a Central Processing Unit (CPU) 1101, which can perform various appropriate actions and processes according to a program stored in a Read-Only Memory (ROM) 1102 or a program loaded from a storage section 1108 into a Random Access Memory (RAM) 1103, such as executing the methods described in the above embodiments. In the RAM 1103, various programs and data required for system operation are also stored. The CPU 1101, ROM 1102, and RAM 1103 are connected to each other via a bus 1104. An Input / Output (I / O) interface 1105 is also connected to the bus 1104.

[0175] The following components are connected to the I / O interface 1105: an input section 1106 including a keyboard, a mouse, etc.; an output section 1107 including, for example, a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), etc. and a speaker, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to the I / O interface 1105 as needed. A removable medium 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1110 as needed so that a computer program read from it can be installed into the storage section 1108 as needed.

[0176] Specifically, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program codes for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1109, and / or installed from the removable medium 1111. When the computer program is executed by a Central Processing Unit (CPU) 1101, various functions defined in the system of the present application are executed.

[0177] It should be noted that the computer-readable medium shown in the embodiments of the present application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which computer-readable program code is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0178] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. Among them, each block in a flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and the combination of blocks in a block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0179] The units involved in the embodiments described in this application can be implemented in software or in hardware, and the described units can also be provided in a processor. Among them, the names of these units do not, in some cases, constitute a limitation to the unit itself.

[0180] As one aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or may exist alone without being assembled into the electronic device. When the above one or more programs are executed by an electronic device, the electronic device is caused to implement the method described in the above embodiments.

[0181] It should be noted that although several modules or units of a device for action execution are mentioned in the above detailed description, such a division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of the two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0182] Through the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software or by a combination of software and necessary hardware. Therefore, the technical solutions according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (such as a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.

[0183] It can be understood that in the specific embodiments of the present application, when it comes to data related to the content of a meeting, when the above embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards in relevant countries and regions.

[0184] After considering the specification and practicing the disclosed embodiments herein, those skilled in the art will readily conceive of other embodiments of the present application. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include known common knowledge or conventional technical means in the technical field not disclosed in the present application above.

[0185] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.

Claims

1. A method for repairing a database, characterized in that, The method includes: When an exception occurs in the target database of the application, back up the target database to obtain a target backup database; Pop up a repair guidance page including repair options so that the user can trigger a repair operation through the repair guidance page; When receiving a first trigger instruction for the repair option, automatically perform a repair operation on the target backup database according to the first trigger instruction; When the repair of the target backup database is completed, replace the target database with the target backup database.

2. The database repair method according to claim 1, wherein, The target database is used to store the message data received by the application; After backing up the target database, the method further includes: Rebuild the target database to obtain a target rebuilt database; Continue to store the newly received message data of the application through the target rebuilt database; The replacing the target database with the target backup database includes: Replacing the target rebuilt database with the target backup database.

3. The repair method of the database according to claim 2, wherein, The step of when the repair of the target backup database is completed, replacing the target database with the target backup database includes: When the repair of the target backup database is completed, name the target backup database as a target name, where the target name is different from the name of the target database; Delete the target database; Perform an initialization operation on the target backup database to rename the target backup database to the name of the target database to obtain a new target database.

4. The method for repairing a database according to claim 3, wherein After obtaining the new target database, the method further includes: Synchronize the newly received message data in the cloud to the new target database.

5. The method for repairing a database according to claim 1, wherein After backing up the target database, the method further includes: When receiving a wake-up instruction for the manual repair page in the application, display the manual repair page, and at least one repair option is shown on the manual repair page; When receiving a second trigger instruction for a target repair option among at least one repair option on the manual repair page, automatically perform a repair operation on the target backup database according to the second trigger instruction.

6. The method for repairing a database according to claim 1, wherein The step of when receiving a first trigger instruction for the repair option, automatically performing a repair operation on the target backup database according to the first trigger instruction includes: When receiving a first trigger instruction for the repair option, determine whether at least one backup database has been generated; If it is determined that at least one backup database has been generated, select a target backup database from the at least one backup database according to a predetermined rule, and automatically perform a repair operation on the target backup database according to the first trigger instruction.

7. The method for repairing a database according to claim 6, wherein The step of selecting a target backup database from the at least one backup database according to a predetermined rule includes: Select the latest generated backup database from the at least one backup database as the target backup database.

8. The method for repairing a database according to claim 6, wherein, After determining whether at least one backup database has been generated, the method further includes: If it is determined that no backup database has been generated, repair the target database.

9. The method for repairing a database according to claim 3, wherein, After naming the target backup database as the target name, the method further includes: Writing record information related to the current repair into a log.

10. A repair device for a database, characterized in that, The apparatus includes: A backup unit, configured to back up the target database to obtain a target backup database when detecting an abnormality in the target database of an application program; A display unit, configured to pop up a repair guidance page including repair options, so that a user triggers a repair operation through the repair guidance page; An automatic repair unit, configured to automatically perform a repair operation on the target backup database according to the first trigger instruction when receiving the first trigger instruction for the repair option; A replacement unit, configured to replace the target database with the target backup database when the repair of the target backup database is completed.

11. A computer-readable medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the database repair method according to any one of claims 1 to 9.

12. An electronic device, characterized in that, Including: One or more processors; A storage device, configured to store one or more programs, which when executed by the one or more processors, cause the one or more processors to implement the database repair method according to any one of claims 1 to 9.

13. A computer program product, characterized in that, The computer program product includes computer instructions, the computer instructions are stored in a computer-readable storage medium, a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the database repair method according to any one of claims 1 to 9.