Data processing method and device for database, equipment and storage medium
By identifying and grouping data tables of the sub-table type in the database, the total amount of stored data for each business category is obtained based on the library table name template, which solves the problem of low accuracy in database data volume detection in the prior art, and achieves more accurate data volume detection.
Patent Information
- Application Number
- CN202411730994.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-25
AI Technical Summary
When detecting the data volume of a database, the total amount of stored data of a certain business category cannot be accurately detected, resulting in a low accuracy in detecting the data volume of the database.
By obtaining the library table name of the data table from the database, identifying the data table of the sub-bank type, grouping based on the library table name template, and obtaining the total amount of stored data for each business category.
It realizes accurate detection of the total amount of stored data in business categories, and improves the accuracy of data detection in the database.
Smart Images

Figure CN119691228A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of Internet technology, artificial intelligence, and in particular to a data processing method, device, equipment and storage medium for a database. Background Art
[0002] As the most effective means of data management, database technology has greatly promoted the development of computer applications. Databases can be used to store a variety of business data, such as order data, product data, user data, application operation data, etc. As the amount of business data increases, the amount of data and performance of the database are under pressure. Therefore, it is necessary to detect the data volume of each data table in the database to avoid the risk of downtime due to the low available capacity of the database. At present, in the process of data volume detection of the data table, only a single data table can be detected, resulting in the inability to accurately detect the total amount of stored data of a certain business category, and thus, the accuracy of the database data volume detection is relatively low. Summary of the invention
[0003] The embodiments of the present application provide a data processing method, apparatus, device and storage medium for a database, which can accurately detect the total amount of stored data of a business and improve the accuracy of data volume detection in the database.
[0004] An embodiment of the present application provides, on one hand, a data processing method for a database, comprising:
[0005] Obtaining, from a database, M library table names corresponding to the M data tables, where the M library table names are generated based on at least one library table name template, and M is an integer greater than 1;
[0006] According to the M library table names, K target data tables whose data table type is a sub-library and sub-table type are selected from the M data tables, where K is an integer greater than 1 and less than or equal to M;
[0007] According to the K target library table names corresponding to the K target data tables, determining the library table name templates corresponding to the K target data tables, respectively, the library table name templates corresponding to the business categories indicated by the K target data tables respectively;
[0008] The K target data tables are grouped according to the library table name template to obtain S target business categories and target data tables corresponding to the S target business categories in the K target data tables, where S is a positive integer less than or equal to K;
[0009] The storage data volumes of the target data tables corresponding to the S target business categories are obtained from the database, and the total storage data volumes corresponding to the S target business categories are determined based on the storage data volumes.
[0010] An embodiment of the present application provides, on one hand, a data processing device for a database, comprising:
[0011] An acquisition module, used for acquiring M library table names corresponding to M data tables from a database, wherein the M library table names are generated based on at least one library table name template, and M is an integer greater than 1;
[0012] A screening module is used to screen K target data tables whose data table type is a sub-library and sub-table type from the M data tables according to the M library table names, where K is an integer greater than 1 and less than or equal to M;
[0013] A first determination module is used to determine the library table name templates corresponding to the K target data tables according to the K target library table names corresponding to the K target data tables, wherein the library table name templates correspond to the business categories indicated by the K target data tables respectively;
[0014] A grouping module, used for grouping the K target data tables according to the library table name template to obtain S target business categories and target data tables corresponding to the S target business categories in the K target data tables, where S is a positive integer less than or equal to K;
[0015] The second determination module is used to obtain the storage data volume of the above-mentioned target data table corresponding to the above-mentioned S target business categories from the above-mentioned database, and determine the total storage data volume corresponding to the above-mentioned S target business categories according to the above-mentioned storage data volume.
[0016] On one hand, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0017] On one hand, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.
[0018] On the one hand, an embodiment of the present application provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0019] In the present application, when the data table type is a sub-library type, the business data of the business corresponding to the data table is distributed in one or more data tables. Therefore, through the library table name of the data table, K target data tables of the sub-library type are identified, and based on the target library table names of the K target data tables, the library table name templates of the K target data tables are determined, and one library table name template reflects a business category. The above K target data tables are grouped according to the above library table name template to obtain S target business categories, and the target data tables corresponding to the above S target business categories in the above K target data tables are respectively obtained. According to the storage data volume of all target data tables under each target business category, the total storage data corresponding to each target business category is determined, which can accurately detect the total storage data corresponding to the business category and improve the accuracy of data volume detection of the database. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 It is a schematic diagram of a data processing system for a database provided by the present application;
[0022] Figure 2 This is a schematic diagram of an interaction scenario between a storage device and a service device provided by the present application;
[0023] Figure 3 It is a flow chart of a data processing method for a database provided by the present application;
[0024] Figure 4 This is a scenario diagram of a module for obtaining library table names provided by this application;
[0025] Figure 5 It is a flowchart of another data processing method for a database provided by the present application;
[0026] Figure 6 It is a schematic diagram of the total amount of storage data of a display service provided by the present application;
[0027] Figure 7 This is a schematic diagram provided by the present application showing the actual total storage data volume of the database, the actual total increase in business volume, the first restricted usage days and the second restricted days;
[0028] Figure 8It is a schematic diagram provided by the present application showing the intelligent analysis result of a database;
[0029] Fig. 9 It is a schematic diagram of the actual total amount of stored data and the growth of the utilization rate of a database provided by the present application;
[0030] Fig.10 This is a schematic diagram of a process for obtaining capacity information of a storage device provided by the present application;
[0031] Fig.11 It is a schematic diagram of a flow chart of a service device provided by the present application performing capacity detection on a database;
[0032] Fig.12 It is a structural schematic diagram of a data processing device for a database provided in an embodiment of the present application;
[0033] Fig.13 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0035] At present, in the process of data volume detection of data tables, only a single data table can be detected, resulting in the inability to accurately detect the total amount of stored data of a certain business category, and thus, the accuracy of data volume detection of the database is relatively low. For example, when the order data of the transaction business category of the past year is retained in the database, the database is divided into databases and tables in the manner of monthly databases and daily tables, that is, the order data of each day is stored in the same data table, and the data table of each month is stored in the same database, and the database includes 365 data tables corresponding to the transaction business category. Assuming that the data volume of each data table is 1G, the total data volume (total amount of stored data) corresponding to the transaction business category is 365G. If only the data volume of a single data table in the database is detected, the data volume of some data tables will not be detected, that is, the total amount of stored data corresponding to the transaction business category is detected to be 1G, resulting in a single data table being unable to truly reflect the total amount of stored data of the transaction business category, and thus, the accuracy of data volume detection of the database is relatively low.
[0036] Based on this, a library table name template in the present application reflects a business category. The above K target data tables are grouped according to the above library table name template to obtain S target business categories and the target data tables corresponding to the above S target business categories in the above K target data tables. According to the storage data volume of all target data tables under each business category, the total storage data volume corresponding to each business category is determined, which can accurately detect the total storage data volume of the business and improve the accuracy of the data volume detection of the database. For example, the 365 data tables of the transaction business category in the database share the same library table name template. Based on the library table name template, the 365 data tables under the transaction business category can be compared and obtained, and then the storage data volume corresponding to the 365 data tables under the transaction business category can be obtained. Based on the storage data volume corresponding to the 365 data tables under the transaction business category, the total storage data volume corresponding to the transaction business category is determined. That is, the data volume of all data tables under the transaction business category is detected, and the actual storage quantity under the transaction business category can be accurately detected, which improves the accuracy of the data volume detection of the database.
[0037] In order to facilitate a clearer understanding of the present application, the data processing system for a database implementing the present application is first introduced. Figure 1 As shown, the data processing system for the database includes a service device and at least one storage device, and the number of storage devices is not limited. Figure 1 As shown, the number of storage devices is 2 for illustration. Figure 1 The first storage device and the second storage device are included. It can be understood that the first storage device and the second storage device can be connected to the service device through a network, so that each storage device can exchange data with the service device through the network connection.
[0038] It is understandable that the storage device can be an independent physical server, or a server cluster or distributed system composed of at least two physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud knowledge base, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The service device can specifically refer to a vehicle terminal, a smart phone, a tablet computer, a laptop, a desktop computer, a smart speaker, a screen speaker, a smart TV, a smart watch, etc., but is not limited to this.
[0039] The first storage device and the second storage device may refer to devices for storing databases, and the first storage device and the second storage device include at least one database. Figure 1In the example, the first storage device includes the first database, and the second storage device includes the second database. The maximum available capacity of each database is limited. Usually, the maximum available capacity of a database refers to the capacity allocated when the database is created. The maximum available capacity can refer to the capacity when no data table is stored in the database, that is, the maximum available capacity can refer to the amount of business data corresponding to the maximum business data that can be stored in the database.
[0040] Each database stores at least one data table, and a data table can be used to store business data corresponding to a business category. As the business data stored in the data table increases, the available capacity of the database decreases. If the available capacity of the database is too small, the storage device will experience abnormal problems such as downtime, freezing, and inaccessibility. Therefore, it is necessary to detect the total amount of stored data in the data table under each business category to realize the data volume (available capacity) detection of the database, so that when the available capacity of the database is too small, the database can be expanded or data archived.
[0041] Among them, the library table name of the data table is used to reflect the database where the data table is located, as well as the name of the data table, and the library table name of each data table is unique. The data table type corresponding to the data table includes a sub-library and sub-table type and a single table type. The sub-library and sub-table type refers to that the business data under the same business is distributed in at least two data tables. At least two data tables can be distributed in the same database or in different databases. The data table of the sub-library and sub-table type is obtained based on the sub-library and sub-table rules of numbers or dates. Therefore, different data tables under the same business are distinguished by adding numeric characters to the library table name. The numeric characters reflect the generation date of the business data, the number of the business data, the value, etc. In addition to the numeric characters, the library table name of the data table of the sub-library and sub-table type can also include at least one of Chinese characters, English characters, and symbol characters. The single table type can refer to that the business data under the same business is distributed in the same data table. The library table name of the data table of the single table type usually does not contain numbers, that is, the library table name of the data table of the single table type can include Chinese characters, English characters, and symbol characters (such as punctuation characters, etc.).
[0042] The service device can be used to detect the amount of data in the database of each storage device, and the service device can also be used to store business data in the database and read business data from the database. Figure 2 For example, the data volume detection process of the database includes the following steps:
[0043] S11. Each storage device uploads the storage data volume of the target data table of each business category to the message queue; it is assumed that the first database of the first storage device stores the first data table and the second data table, and the second database of the second storage device stores the third data table. The first storage device can obtain the library table names of the first data table and the second data table from the first database through the first acquisition agent component; the second storage device can obtain the library table name of the third data table from the second database through the second agent acquisition component. Assume that the library table name of the first data table is db_2024.table_01, the library table name of the second data table is db_2024.table_02, and the library table name of the third data table is db_product.table_product. The first storage device can perform numeric character detection on the first data table and the second data table to obtain a first numeric character detection result. The first numeric character detection result indicates that the library table names of the first data table and the second data table both include numeric characters. The first storage device can determine that the data table types of the first numeric table and the second data table are sub-library and sub-table types. The first storage device can determine the library table name templates corresponding to the first data table and the second data table based on the library table names of the first data table and the second data table, such as the library table name templates of the first data table and the second data table are db_[yyyy].table_[mm], that is, the library table name templates of the first data table and the second data table are the same, that is, the first data table and the second data table are both data tables under the same business, taking the first data table and the second data table as data tables under the transaction business category. The first storage device can determine the first data table and the second data table as target data tables under the transaction business category, obtain the storage data volume corresponding to the first data table and the second data table from the first database, and store the storage data volume corresponding to the first data table and the second data table in the message queue.
[0044] For the implementation process of determining the library table name templates of the first data table and the second data table based on the library table names of the first data table and the second data table, please refer to the following description.
[0045] The first proxy acquisition component and the second proxy acquisition component may refer to components for reading data from a database.
[0046] The second storage device can perform a numeric character detection on the third data table to obtain a second numeric character detection result, the second numeric character detection result indicates that the library table name of the third data table does not include numeric characters, and the second storage device can determine that the data table type of the third data table is a single table type, that is, the third data table belongs to a business category, taking the third data table belonging to a data table of a product business as an example. The second storage device can obtain the storage data volume of the third data table from the second database, and store the storage data volume of the third data table in the message queue of the service device.
[0047] Among them, db_2024 in the table names of the first data table and the second data table may refer to the name of the first database, or may reflect that the business data stored in the first data table and the second data table is generated in 2024. table_01 in the table name of the first data table may refer to the name of the first data table, or may reflect that the business data in the first data table is generated in January; table_02 in the table name of the second data table may refer to the name of the second data table, or may reflect that the business data in the second data table is generated in February. db_product in the table name of the third data table is the name of the second database, and table_product in the table name of the third data table is the name of the third data table. Among them, db may refer to a database, table may refer to a data table, and product refers to a product.
[0048] S12. The service device reads the storage data volume of the target data table of each business category from the message queue; the service device can read the storage data volume corresponding to the first data table and the second data table of the transaction business category from the message queue, and read the storage data volume of the third data table of the product business.
[0049] S13. The service device detects the data volume of each business category according to the amount of stored data, obtains the data volume detection result, and stores the data volume detection result in the result library. The data volume detection result reflects the total amount of stored data corresponding to each business category. Specifically, the service device can determine the total amount of stored data corresponding to the transaction business category according to the amount of stored data corresponding to the first data table and the second data table, respectively, and determine the total amount of stored data of the product business according to the amount of stored data in the third data table. The total amount of stored data corresponding to the transaction business category and the total amount of stored data of the product business can be stored in the result library. The service device can also display the total amount of stored data of the product business and the total amount of stored data corresponding to the transaction business category, so as to prompt the user to manage the database (such as expansion, archiving, etc.) based on the total amount of stored data corresponding to each business category.
[0050] In summary, when the data table of the transaction business category is of the sub-library and sub-table type, all data tables under the transaction business category can be obtained through the library and table name templates corresponding to the first data and the second data tables respectively. This is conducive to accurately detecting the total amount of storage data of each business category, and further, it is conducive to determining the available capacity of the database based on the total amount of storage data of each business category, avoiding abnormal problems such as storage device shutdown, jamming, and inaccessibility due to the low available capacity of the database.
[0051] For further information, see Figure 3 , is a flow chart of a data processing method for a database provided in an embodiment of the present application. Figure 3 As shown, this method can be Figure 1 can be executed by any storage device in Figure 1 It can also be executed by the service device in Figure 1 The storage device and the service device in the database are executed in collaboration. The devices used to execute the data processing method for the database in this application can be collectively referred to as computer devices. The method may include the following steps:
[0052] S101. Obtain M library table names corresponding to M data tables from a database, where the M library table names are generated based on at least one library table name template, and M is an integer greater than 1.
[0053] In the present application, the computer device may include at least one database, and the computer device may obtain the library table names corresponding to M data tables from each database; the M data tables may refer to data tables belonging to the same database, or may refer to data tables belonging to multiple different databases.
[0054] It should be noted that, in the scenario of detecting the data volume of a single database, the M data tables may refer to all the data tables in the database; when in the scenario of detecting the total amount of storage data of the business category to be detected, the M data tables may refer to the data tables in all databases belonging to the business category to be detected.
[0055] Among them, one data table corresponds to one library table name, and the library table name reflects the database where the data table is located and the name of the data table. The M library table names can be generated based on at least one library table name template. That is, the M library table names can be generated based on the same library table name template, and the M library table names can be generated based on different library table name templates.
[0056] It should be noted that when the data table type of the data table is a single table type, the library table name of the data table can be generated based on the library table name template corresponding to the single table type, and the library table name template corresponding to the single table type can be db_abc.table_def, where abc and def are variables with non-numeric characters. This application mainly uses the library table name template corresponding to the sub-library and sub-table type as an example for explanation. The library table name of the target data table of the sub-library and sub-table type is generated based on the library table name template corresponding to the sub-library and sub-table type, and the variables in the library table name template are all numeric characters.
[0057] S102. According to the M library table names, K target data tables whose data table type is a sub-library and sub-table type are selected from the M data tables; K is an integer greater than 1 and less than or equal to M.
[0058] In the present application, the computer device can determine the data table type of each data table according to the library table names corresponding to the M data tables, and screen K target data tables with a data table type of a sub-library and sub-table type from the M data tables, that is, the target data table here is a data table with a data table type of a sub-library and sub-table type among the M data tables.
[0059] In one embodiment, the above step S102 may include: since the data table of the sub-library and sub-table type is usually obtained by dividing according to the sub-library rules of numbers or dates, it is easy to distinguish, and the library table name of the data table of the sub-library and sub-table type includes numeric characters. Therefore, the computer device can perform numeric character detection on the library table names corresponding to the M data tables respectively to obtain numeric character detection results; the numeric detection results reflect whether each data table contains numeric characters. The computer device can screen K target data tables with numeric characters in the library table names from the M data tables according to the above numeric character detection results; the K target data tables with numeric characters in the library table names are determined as K target data tables with data table types of sub-library and sub-table types. Through the numeric character detection method, the target data tables with data table types of sub-library and sub-table types are screened out, which is conducive to the subsequent comparison to obtain all target data tables under each business category, and improve the accuracy of obtaining the total amount of stored data of each business category.
[0060] S103. Determine the library table name templates corresponding to the K target data tables according to the K target library table names corresponding to the K target data tables, wherein the library table name templates correspond to the business categories indicated by the K target data tables.
[0061] In the present application, since the library table names of the data tables under the same business type are generated based on the same library table name template, or since the library table names of the data tables under the same business type are generated based on two similar library table name templates, the computer device can determine the library table name templates corresponding to the K target databases respectively according to the library table names corresponding to the K target data tables respectively, which is conducive to the subsequent determination of the data tables under each business category based on the library table name template.
[0062] The above-mentioned library table name template corresponds to the business categories respectively indicated by the above-mentioned K target data tables, that is, the library table name template corresponding to the library table name of a certain target data table reflects the business category to which the business data in the target data table belongs.
[0063] The target data table under the business type includes at least one of an archived data table and an original data table. The archived data table may refer to a data table to be migrated to an auxiliary storage device, and the library table name of the archived data table has an archive character, such as the archive character may include at least one of Chinese characters, English characters, and symbol characters, such as the archive character may be backup_to_drop. The original data table may refer to a data table that does not need to be migrated to an auxiliary device, and the library table name of the original data table does not contain an archive character.
[0064] The archived data table may be obtained by adding an archive character to the name of the library table of the original data table whose access frequency is less than the frequency threshold, or the archived data table may be obtained by migrating the business data whose access frequency is less than the frequency threshold in the original data table to the newly created data table, which is conducive to improving the database access performance and starting the long-term retention of data. After the archived data table is migrated to the auxiliary storage device, the computer device can delete the archived data table in the database, which is beneficial to saving the storage space of the database.
[0065] Among them, the library table name template may refer to a template for generating a target library table name of a target data table under a business category, and the library table name templates corresponding to target data tables under different business types are different. The library table name templates of various target data under the same business type have a similar relationship, and the similar relationship between the library table name templates of various target data under the same business type here has the following meanings: 1. The library table name templates of all original data tables under the same business type are the same; 2. The library table name templates of all archived data tables under the same business type are the same; 3. Under the same business type, the similarity between the library table name template corresponding to the archived data table and the library table name template of the original data table is greater than the similarity threshold value; that is, the library table name template corresponding to the archived data table is equivalent to the library table name template of the original data table. The library table name template of the archived data table has an archive character added to it compared to the library table name template of the original data table.
[0066] For example, the correspondence between the library table name and the library table name template is shown in Table 1. When the data table of business category a1 is divided into libraries and tables in the manner of monthly library and daily table, a database will be created for the business data of business category a1 in each month (taking July as an example). The database includes the target data tables corresponding to each day of July for business category a1. One target data table is used to record the business data of business category a1 on one day in July. The library table name template of the target library table name of the target data table can be: db_[yyyymm].table_[dd]. yyyymm and dd are also called variables, that is, different target data tables have different values of yyyymm and dd. yyyymm reflects the name of the database, that is, the year and month to which the business data belongs, and the value range is [202401, 202412]. dd reflects the name of the target data table, and the value range is [00, 31], reflecting the day on which the business data in the target data table was generated. For example, the database table name of the target data table b1 of the business category a1 is: db_202407.table_01, that is, the target data table b1 is used to record the business data of the business category a1 on July 1, 2024.
[0067] When the data table of business category a2 is divided into databases and tables in the manner of a single database and daily table, a database will be created for the business data of business category a2, and a target data table will be created in the database for the business data of business category a2 on a daily basis, that is, a target data table is used to store the business data of business category a2 on a daily basis. The target table name template of the target table name of the target data table can be: db.table_[yyyymmdd], the database name can be the default value, yyyymmdd is the name of the target data, reflecting the generation date of the business data in the target data table, taking July 2024 as an example, the value range of yyyymmdd is: [20240701, 20240731]. For example, the target table name of target data table b2 of business category a2 is: db.table_20240702, that is, the target data table b2 is used to record the business data of business category a2 on July 2, 2024.
[0068] When the data table of business category a3 is divided into databases and tables in the manner of annual database and monthly table, a database will be created for the business data of business category a3 in each year (taking 2024 as an example), and the database includes a target data table corresponding to the business data of each month. The database name template of the target database table name of the target data table can be: db_[yyyy].table_[mm]. yyyy is the name of the database, reflecting the year to which the transaction data belongs, and mm reflects the name of the target data table, indicating the month to which the business data belongs. Taking 2024 as an example, the value range of yyyy is 2024, and the value range of mm is [01, 12]. For example, the database table name of the target data table b3 of business category a3 is: db_2024.table_07, that is, the target data table b3 is used to record the business data of business category a3 in July 2024.
[0069] When the data table of business category a4 is divided into databases and tables in the manner of one hundred databases and ten tables, business category a4 includes one hundred databases, and ten target data tables are created for business category a4 in each database. The target database table name template of the target data table can be: db_[xx].table_[y]. xx reflects the database name, and the value range is [00, 99]. y reflects the name of the target data table, and the value range is [0, 9]. The business data stored in each target data table is obtained by taking the modulus of the business category number of the business data. For example, the database table name of the target data table b4 of business category a4 is: db_91.table_8, that is, the target data table b4 is used to record the business data of the business category number in business category a4, the last digit of which is 8 after taking the modulus, and the value of the third to second digit from the last digit is 91. For example, if the business category number of the business data is 112111, the modulus is 1211, and the result after taking the modulus is 918. The modulus can be determined according to the scenario.
[0070] When the data table of business category a5 is divided into databases and tables in the manner of monthly database and 100 tables, a database will be created for each business data of each month under business category a5, and each database includes 100 target data tables. The database name template of the target database table name of the target data table can be: db_[yyyymm].table_[xx]. yyyymm reflects the database name and also reflects the year and month to which the business data belongs. Taking 2024 as an example, the value range of yyyymm is [202401, 202412]. xx reflects the name of the target data table and the value range is [00, 99]. The business data stored in each target data table can be determined according to the last two digits of the business category number of the business data, or the business data stored in each target data table can be determined after taking the modulus of the business category number of the business data. For example, the database table name of the target data table b5 of business category a5 is: db_202407.table_01, that is, the target data table b5 is used to record the business data of business category a5 in July 2024, and the last two digits of the business category number are 01.
[0071] The specific implementation process of determining the library table name template of a certain target data table based on the target library table names of all target data tables under a certain business category can be referred to the description below.
[0072] Table 1
[0073]
[0074] In one embodiment, the above step S102 includes: the number of numeric characters in the target library table names of each target data table under the same business category is the same, and the arrangement position of the numeric characters is the same, so the computer device can obtain the number of numeric characters in the target library table names corresponding to the above K target data tables, and the arrangement position of the numeric characters in the target library table names; any two target data tables with the same number of numeric characters and the same arrangement position of the numeric characters in the K target data tables are divided into the same data table set. The computer device can determine the library table name template corresponding to the target data table in the corresponding data table set according to the target library table name of the target data table in each data table set; for example, the computer device can use different digital identifiers to replace the numeric characters in the target library table names of the target data tables in different data table sets to obtain the library table name templates of the target data tables in each data table set, which is conducive to making the library table name templates of the target data tables under the same business category have a similar relationship, and then, it is conducive to aggregate all the target data tables under each business category.
[0075] The digital marker may refer to a character used to mark a digital character, and the digital marking character may include at least one of Chinese characters, English characters, and English characters.
[0076] In one embodiment, the above-mentioned method of determining the library table name template corresponding to the target data table in the corresponding data table set according to the target library table name of the target data table in each data table set includes: the computer device can determine the value range of the corresponding digital character of the target data table in each data table set according to the digital character in the target library table name of the target data table in each data table set. A value range corresponds to a digital mark character, and the computer device can determine the digital mark symbol corresponding to each data table set according to the value range; the digital mark symbol corresponding to each data table set is used to replace the digital character in the target library table name of the target data table in the corresponding data table set, so as to obtain the library table name template of the target data table in the corresponding data table set. By replacing the digital characters in the target library table name of the target data table in the general data set with the same digital mark character, it is beneficial to make the library table name templates of the target data tables under the same business category have a similar relationship, and then it is beneficial to aggregate all the target data tables under each business category.
[0077] It should be noted that the value range of the numeric characters here may refer to the value range corresponding to the numeric characters that are arranged in adjacent positions in the library table name; the numeric identifier corresponding to the value range may be pre-set, that is, different value ranges correspond to different numeric identifiers.
[0078] It should be noted that the target library table name of the target data table may refer to the library table name of the target data table, which is used to reflect the database where the target data table is located and the name of the target data table.
[0079] For example, Figure 4As shown, assuming that the target library table name of the first target data table is db_2024.table_03, the target library table name of the second target data table is db_2024.table_04, the target library table name of the third target data table is db_2024.table_02_backup_to_drop, the target library table name of the fourth target data table is db_202407.table_01, and the target library table name of the fifth target data table is db_202407.table_02. The computer device can obtain the number of numeric characters in the library table names in each target data table, and the arrangement position of each numeric character; the number of numeric characters in the library table names in the first target data table, the second target data table, and the third target data table is 6, and the arrangement position is from the 4th character position to the 7th character position, and the 15th character position and the 16th character position, and the first target data table, the second target data table, and the third target data table can be divided into a first data table set. The number of numeric characters in the target library table names of the fourth target data table and the fifth target data table are both 8, and the numeric characters are arranged from the 4th character position to the 9th character position, and the 17th character position and the 18th character position, and the fourth target data table and the fifth target data table are divided into the second data table set. In the target library table names of the target data tables in the first data table set, the numeric characters at the 4th character position to the 7th character position correspond to a common value range of 2024, and the numeric marker corresponding to the value range is: yyyy; the numeric characters at the 15th character position and the 16th character position correspond to a common value range of [03,04], and the numeric marker corresponding to the value range is: mm. In the target library table name of the target data table in the second data table set, the numeric characters located at the 4th character position to the 9th character position correspond to the value range of: 202407, and the numeric identifier corresponding to the value range is: yyyymm; the numeric characters located at the 17th character position and the 18th character position correspond to the value range of [01,02], and the numeric identifier corresponding to the value range is: dd. The computer device can use the numeric identifier to replace the numeric characters at the corresponding arrangement position to obtain the library table name template of each target data table. Specifically, the computer device can use yyyy to replace the numeric characters located at the 4th character position to the 7th character position (i.e., 2024) in the target library table name of each target data table in the first data set, and use mm to replace the numeric characters located at the 15th character position and the 16th character position to obtain the library table name templates corresponding to each target data table in the first data table set.That is, the library table name templates of the first target data table and the second target data table are: db_yyyy.table_mm, and the library table name template of the third target data table is: db_yyyy.table_mm_backup_to_drop. The computer device can use yyyymm to replace the numeric characters located at the 4th character position to the 9th character position (i.e. 202407) in the target library table name of each target data table in the second data set, and use dd to replace the numeric characters located at the 17th character position and the 18th character position, to obtain the library table name templates corresponding to each target data table in the second data table set. The library table name template of the fourth target data table is: db_yyyymm.table_dd, and the library table name template of the fifth target data table is: db_yyyymm.table_dd.
[0080] S104. Group the K target data tables according to the table name template to obtain S target business categories and target data tables corresponding to the S target business categories in the K target data tables, where S is a positive integer less than or equal to K.
[0081] In the present application, the computer device can determine the target data tables corresponding to S target business categories based on the similarity between the library table name templates corresponding to the K target data tables. Specifically, the computer device can use a similarity algorithm to determine the similarity between the library table name templates corresponding to the K target data packets, and determine the target data tables with similarity greater than the similarity threshold as target data tables of the same business type, which is conducive to aggregating all target data tables under each business category.
[0082] In one embodiment, the above step S104 includes: the computer device can use a similarity algorithm to compare the library table name templates of the target data table to determine the similarity between the library table name templates corresponding to the above K target data tables; the target data tables in the above K target data tables whose similarity of the library table name templates is greater than the similarity threshold are divided into the same group to obtain S groups. One group corresponds to one business category, so the computer device can determine the S target business categories corresponding to the S groups according to the correspondence between the library table name templates and the business categories, and determine the target data tables corresponding to the S target business categories in the above K target data tables according to the S target business categories and the target data tables in the S groups. By comparing the library table name templates of the target data tables, all target data tables under each business category can be obtained, which is conducive to accurately obtaining the total amount of stored data under each business category.
[0083] It should be noted that the correspondence between the library table name template and the business category can be obtained by querying a mapping table, which includes multiple business categories and the library table name template corresponding to each business category. For example, the mapping table is shown in Table 2:
[0084] Table 2
[0085]
[0086] As shown in Table 2, business category a1 corresponds to db_[yyyymm].table_[dd] and db_[yyyymm].table_[dd]_backup_to_drop, that is, db_[yyyymm].table_[dd] is the library table name template of the original data table under business category a1, and db_[yyyymm].table_[dd]_backup_to_drop is the library table name template of the archived data table under business category a1. Business category a2 corresponds to db.table_[yyyymmdd], and db.table_[yyyymmdd] is the library table name template of the original data table under business category a2; business category a3 corresponds to db_[yyyy].table_[mm], and db_[yyyy].table_[mm] is the library table name template of the original data table under business category a3. Business category a4 corresponds to db_[xx].table_[y], which is the library table name template of the original data table under business category a4; business category a5 corresponds to db_[yyyymm].table_[xx], which is the library table name template of the original data table under business category a5.
[0087] It should be noted that, since the data table type of the target data table is sub-library and sub-table, the number of target data tables under each business category is usually greater than 1; in particular, when the target data table under a certain business category of the database is archived to an auxiliary device, the target data table under this business category can be equal to 1.
[0088] S105. Obtain the storage data volumes of the target data tables corresponding to the S target business categories from the database, and determine the total storage data volumes corresponding to the S target business categories based on the storage data volumes.
[0089] In the present application, the computer device can obtain the storage data volume of the target data table corresponding to S target business categories from the database, and determine the total storage data volume corresponding to each target business category according to the storage data volume of the target data table corresponding to each target business category, so as to accurately obtain the total storage data volume of each target business category, which is conducive to improving the accuracy of data volume detection in the database. By obtaining the total storage data volume corresponding to S target business categories, it is helpful to assist users in analyzing the change trend of each target business category and assist database administrators in managing the data volume of the database.
[0090] The storage data volume of the target data table may refer to the data volume of the business data stored in the target data table, and the total storage data volume corresponding to any target business category may be the sum of the storage data volumes of all target data tables under the target business category. For example, the number of target data tables corresponding to the j-th target business category is T, where T is a positive integer less than or equal to K. The total storage data volume corresponding to the j-th target business category may be expressed by the following formula (1):
[0091]
[0092] In formula (1), D j represents the total amount of stored data corresponding to the jth target business category, M jc is the storage data volume of the cth target data table of the jth target business category, where c is a positive integer less than or equal to T.
[0093] In one embodiment, when there is only one database, the computer device can sum up the total amount of stored data corresponding to S target business categories and the amount of stored data in a data table of a single table type to obtain the actual total amount of stored data in the database.
[0094] In the present application, when the data table type is a sub-library type, the business data of the business corresponding to the data table is distributed in one or more data tables. Therefore, through the library table name of the data table, K target data tables of the sub-library type are identified, and based on the target library table names of the K target data tables, the library table name templates of the K target data tables are determined, and one library table name template reflects a business category. The above K target data tables are grouped according to the above library table name template to obtain S target business categories, and the target data tables corresponding to the above S target business categories in the above K target data tables are respectively obtained. According to the storage data volume of all target data tables under each target business category, the total storage data corresponding to each target business category is determined, which can accurately detect the total storage data corresponding to the business category and improve the accuracy of data volume detection of the database.
[0095] For further information, see Figure 5 , is a flow chart of a data processing method for a database provided in an embodiment of the present application. Figure 5 As shown, this method can be Figure 1 can be executed by any storage device in Figure 1 It can also be executed by the service device in Figure 1 The storage device and the service device in the database are executed in collaboration. The devices used to execute the data processing method for the database in this application can be collectively referred to as computer devices. The method may include the following steps:
[0096] S201. According to the M library table names, K target data tables whose data table type is a sub-library and sub-table type are selected from the M data tables; K is an integer greater than 1 and less than or equal to M.
[0097] S202. According to the M library table names, K target data tables whose data table type is a sub-library and sub-table type are selected from the M data tables; K is an integer greater than 1 and less than or equal to M.
[0098] S203. Determine the library table name templates corresponding to the K target data tables according to the K target library table names corresponding to the K target data tables, wherein the library table name templates correspond to the business categories indicated by the K target data tables.
[0099] S204. Group the K target data tables according to the table name template to obtain S target business categories and target data tables corresponding to the S target business categories in the K target data tables, where S is a positive integer less than or equal to K.
[0100] S205: Obtain configuration information of the above database by obtaining the proxy component.
[0101] In the present application, a computer device may include an acquisition agent component, which may refer to a component used to read database-related data. For example, when it is necessary to obtain the amount of storage data in a target data table, the computer device may obtain the configuration information of the database through the acquisition agent component. The location information of the database may include the name of the database, the maximum available capacity, the storage path, etc. The storage path may refer to the storage location of the database.
[0102] S206: Determine a storage path of the database according to the configuration information of the database.
[0103] In the present application, the computer device may determine the storage path in the configuration information of the database as the storage path of the database.
[0104] S207. According to the storage path, in the storage layer corresponding to the database, the storage data volumes of the target data tables corresponding to the S target business categories are obtained.
[0105] In the present application, the metadata of the database includes the storage data volume of each data table in the database, but the metadata of the database is updated periodically, such as once every hour. Therefore, if the storage data volume of the target data table corresponding to each business category is obtained from the metadata of the database, the accuracy of the obtained storage data volume will be relatively low. Based on this, the computer device can use the acquisition agent component to collect the data tables in the database according to the storage path at the storage layer of the database to obtain the storage data volume of the target data table corresponding to S kinds of target business categories. That is, the storage data volume can refer to the storage data volume obtained by real-time collection of the target data table, thereby improving the accuracy of the storage data volume of the target data table.
[0106] It should be noted that the target data table corresponding to the target business category may include at least one of an archived data table and an original data table. The archived data table may refer to a data table in the target data table corresponding to the target business category whose library table name contains archive characters and has not been migrated to the auxiliary storage device. The original data table may refer to a data table in the target data table corresponding to the target business category whose library table name does not contain archive characters. For the sake of distinction, the storage data volume of the archived data table may be referred to as the archived data volume, and the storage data volume of the original data table may be referred to as the original data volume.
[0107] The archived data volume may refer to the data volume in the archived data table that has not been deleted in the database, and the original data volume may refer to the data volume in the original data table that has not been converted into the archived data table in the database.
[0108] In one, the above-mentioned acquisition of the storage data volume of the target data tables corresponding to the S target business categories respectively according to the storage path in the storage layer corresponding to the above-mentioned database includes: the computer device can perform archiving character detection according to the target library table name of the target data table corresponding to the j-th target business category to determine the archived data table and the original data table corresponding to the j-th target business category; j is a positive integer less than or equal to S. The computer device can acquire the data volume of the archived data table corresponding to the j-th target business category by acquiring the proxy component according to the storage path in the storage layer corresponding to the above-mentioned database to obtain the archived data volume of the archived data table corresponding to the j-th target business category. By acquiring the proxy component, according to the storage path, in the storage layer corresponding to the database, the data volume of the original data table corresponding to the j-th target business category is acquired to obtain the original data volume of the original data table corresponding to the j-th target business category. The computer device can determine the archived data volume and the original data volume as the storage data volume of the target data table corresponding to the j-th target business category. By acquiring the proxy component, data volume is collected for the original data table and the archived data table at the storage layer to obtain the original data volume of the original data table and the archived data volume of the archived data table. This is conducive to real-time collection of the storage data volume of each target data table and improves the accuracy of the storage data volume of the target data table.
[0109] In one embodiment, the above-mentioned determination of the archived data table and the original data table corresponding to the j-th target business category according to the target library table name of the target data table corresponding to the j-th target business category includes: the computer device can perform archived character detection on the target library table name of the target data table of the j-th target business category to obtain the archived character detection result. The computer device can determine the target data table with archived characters in the library table name in the target data table of the j-th target business category as the archived data table corresponding to the j-th target business category according to the archived character detection result; and determine the target data table without archived characters in the library table name in the target data table of the j-th target business category as the original data table corresponding to the j-th target business category according to the archived character detection result. The archived character detection method is used to determine whether the target data table is an archived data table, which is conducive to the subsequent judgment of whether there is an abnormal situation such as a significant decrease in the amount of archives in the database.
[0110] S208. Determine the total amount of stored data corresponding to the above S target business categories respectively according to the amount of stored data.
[0111] In this application, by acquiring the proxy component, according to the storage path, in the storage layer corresponding to the database, the data tables in the database are collected in real time, and the storage data volume of the target data tables corresponding to the S target business categories is obtained, thereby improving the accuracy of the storage data volume of the target data tables. In addition, based on the library table name template corresponding to the K target data table sub-tables, the K target data tables are compared and processed to obtain all the target data tables under each target business category. According to the storage data volume of all the target data tables under each target business category, the total storage data volume corresponding to each target business category is determined, which can accurately detect the total storage data volume of the business and improve the accuracy of the data volume detection of the database.
[0112] In one embodiment, the above-mentioned method of determining the total amount of stored data corresponding to the above-mentioned S target business categories respectively based on the amount of stored data includes: when the computer device is a storage device, the storage device can upload the amount of stored data of the target data table corresponding to the above-mentioned S target business categories to the message queue of the service device. Among them, the above-mentioned service device is used to obtain the amount of stored data of the target data table corresponding to the above-mentioned S target business categories from the above-mentioned message queue, and determine the total amount of stored data corresponding to the above-mentioned S target business categories respectively based on the amount of stored data of the target data table corresponding to the above-mentioned S target business categories. In other words, the storage data amount of the target data table under various target business categories is determined by the storage device, and the service device determines the total amount of stored data for each target business category based on the amount of stored data of each target business category, which is conducive to reducing the processing pressure of the storage device.
[0113] In one embodiment, after the computer device obtains the total amount of stored data corresponding to each target service category, the total amount of stored data corresponding to each target service category is displayed, such as Figure 6 As shown, the total amount of stored data of business category a1 is 355G, the total amount of stored data of business category a2 is 311G, and the total amount of stored data of business category a3 is 122G. By comparison, it can be seen that the total amount of stored data of business category a1 is the largest, the total amount of stored data of business category a2 is less than the total amount of stored data of business category a1, and greater than the total amount of stored data of business category a3, and the total amount of stored data of business category a3 is the least. By visualizing the total amount of stored data of each business category, it is helpful for users to understand the total amount of stored data of various business categories in real time.
[0114] In one embodiment, the storage data volume of the target data table corresponding to the jth target business category includes the archived data volume of the archived data table and the original data volume of the original data table; j is a positive integer less than or equal to S; the above-mentioned determination of the total storage data volume corresponding to the above S target business categories according to the storage data volume of the target data table corresponding to the above S target business categories includes: the computer device can sum the original data volume of each original data table corresponding to the above jth target business category to obtain the original total data volume corresponding to the above jth target business category; sum the archived data volume of each archived data table corresponding to the above jth target business category to obtain the archived total data volume corresponding to the above jth target business category. The archived total data volume and the original total data volume corresponding to the jth target business category are summed to obtain the total storage data volume corresponding to the jth target business category. The total storage data volume corresponding to each business category is determined by the archived data volume of the archived data table and the original data volume of the original data table, that is, the storage data volume of all target data tables under each business category is collected, which is conducive to improving the accuracy of obtaining the total storage data volume of each business category.
[0115] In one embodiment, when the access frequency of all the original data of the j-th target business category is greater than or equal to the frequency threshold, the database does not include the archived data table of the j-th target business category. Therefore, when the target data table corresponding to the j-th target business category includes the original data table but does not include the archived data table, the computer device can sum the original data volume of each original data table corresponding to the j-th target business category to obtain the original total data volume corresponding to the j-th target business category, and determine the original total data volume corresponding to the j-th target business category as the total storage data volume corresponding to the j-th target business category.
[0116] In one embodiment, when the access frequency of all original data of the j-th target business category is less than the frequency threshold, all original data tables of the j-th target business category are to be archived, that is, all original data tables of the j-th target business category are converted into archived data tables, that is, the database does not include the original data tables of the j-th target business category, but includes the archived data tables of the j-th target business category. Therefore, when the target data tables corresponding to the j-th target business category include the archived data tables but do not include the original data tables, the archived data volumes of the archived data tables corresponding to the j-th target business category are summed to obtain the total archived data volume corresponding to the j-th target business category, and the total archived data volume corresponding to the j-th target business category is determined as the total storage data volume corresponding to the j-th target business category.
[0117] In one embodiment, the computer device can perform a difference processing between the total amount of stored data corresponding to the j-th target business category and the amount of historical stored data to obtain the initial business increase of the j-th target business category; the historical stored data amount is the amount of stored data corresponding to the j-th target business category obtained last time. The computer device can obtain the amount of deleted data corresponding to the archived data table deleted within the time period of the j-th target business category from the daily data of the database; the time period is the time from the last time the total amount of stored data corresponding to the j-th target business category was obtained to the time when the total amount of stored data corresponding to the j-th target business category is obtained this time. The initial business increase and the amount of deleted data of the j-th target business category are summed to obtain the actual business increase of the j-th target business category. By obtaining the actual business increase of the j-th target business category, it is helpful to determine the reason for the insufficient amount of data in the database based on the actual business increase when it is detected that the amount of data in the database is insufficient, such as the reason that the actual business increase of the j-th target business category is too large.
[0118] Among them, the initial business increase of the jth target business category may refer to the amount of data added to the database of the jth target business category within the above time period; the actual business increase of the jth target business category may refer to the amount of data added to the jth target business category within the above time period. The deleted archived data table may be an archived data table migrated to an auxiliary storage device. The time interval between the time of obtaining the total amount of stored data of the business and the time of obtaining the total amount of stored data of the business this time is 1 day. The initial business increase of the jth target business category may refer to the daily business increase of the jth target business category (i.e., the daily business increase obtained by collecting the data table), and the actual business increase of the jth target business category may refer to the actual daily business increase of the jth target business category.
[0119] In one embodiment, the computer device can perform a difference processing between the total archived data volume corresponding to the jth target business category and the total historical archived data volume to obtain an initial archived increase, and perform a sum processing between the amount of deleted data corresponding to the archived data table deleted within the time period of the jth target business category and the initial archived increase to obtain an actual archived increase of the jth target business category. By obtaining the actual archived increase of the jth target business category, it is helpful to determine the reason for the insufficient data volume of the database based on the actual archived increase when it is detected that the data volume of the database is insufficient, such as the reason may be that the actual archived increase of the jth target business category is too small.
[0120] Among them, the actual archived increase of the jth target business category may refer to the amount of data added to all archived data tables of the jth target business category within the above-mentioned time period. All archived data tables here include the archived data tables of the jth target business category in the database within the above-mentioned time period that have not been deleted, as well as the archived data tables that have been deleted.
[0121] In one embodiment, the computer device can acquire the data volume of the database from the storage layer of the database by acquiring the proxy component, and obtain the actual total storage data volume and the remaining capacity of the above-mentioned database. The actual total storage data volume of the above-mentioned database is subtracted from the historical total data volume to obtain the initial total business increase of the above-mentioned database; the above-mentioned initial total business increase is summed with the total deleted data volume corresponding to the data table (i.e., archived data table) deleted in the above-mentioned database within the time period to obtain the actual total business increase of the above-mentioned database. The computer device can determine the limited use days of the above-mentioned database based on the initial total business increase corresponding to the above-mentioned database, the above-mentioned remaining capacity and the actual total business increase. By obtaining the limited use days of the database, it is beneficial to archive the data tables in the database in advance when the data volume of the database is about to be insufficient, or to expand the database to avoid abnormal problems such as insufficient data volume in the database, resulting in storage device shutdown, inaccessibility, and jamming.
[0122] The total initial business increase of the database may refer to the amount of data added to the database after collection, and the total actual business increase of the database may refer to the amount of data added to the database during the above time period when the archived data table is not deleted. The time interval between the time of obtaining the total amount of storage data of the business mentioned above and the time of obtaining the total amount of storage data of the business this time is 1 day, then the total initial business increase of the database may refer to the daily increase of the database (i.e. the daily increase obtained by collecting the database), and the total actual business increase of the database may refer to the actual daily increase of the database.
[0123] The limited usage days of the database may refer to the maximum and minimum available days of the database, that is, the actual usage days of the database. When the maximum available days are reached, the available capacity of the database will be insufficient, making the database unavailable.
[0124] In one embodiment, the above-mentioned determination of the restricted use days of the above-mentioned database according to the initial total increase in business, the above-mentioned remaining capacity and the actual total increase in business corresponding to the above-mentioned database includes: the computer device can divide the remaining capacity of the database by the initial total increase in business to obtain the first restricted use days of the database; that is, the remaining capacity of the database is divided by the initial total increase in business to obtain the first restricted use days of the database. The computer device can divide the remaining capacity of the above-mentioned database by the actual total increase in business to obtain the second restricted use days of the above-mentioned database, that is, the remaining capacity of the above-mentioned database is divided by the actual total increase in business to obtain the second restricted use days of the above-mentioned database. By obtaining the first restricted use days and the second restricted use days of the database, it is beneficial to prompt the user to archive or expand the database in time when the actual use days of the database are greater than the second restricted use days and less than the first restricted use days, so as to avoid the database having insufficient data volume, resulting in abnormal problems such as storage device shutdown, inaccessibility, and jamming.
[0125] The first limit usage days may refer to the maximum number of days the database can be used, and the second limit usage days may refer to the minimum number of days the database can be used.
[0126] In one embodiment, after obtaining the actual total amount of stored data, the actual total increase in business, the first limited use days, and the second limited use days of the database, the computer device can display this information to help users manage the database in a timely manner. Figure 7 As shown, when the actual total storage data volume of the database is 788G, the historical storage volume in the database obtained last time is 775G, and the initial total increase in the database business is: 788-778=13G / day. The time interval from the time when the actual storage capacity of the database was obtained last time to the time when the actual storage capacity of the database was obtained this time is 1 day. The total amount of deleted data in the archived data table deleted by the database within 1 day is 2G, then the actual total increase in the database business is: 788-775+2=15G / day. Assuming that the remaining capacity of the database is 255G, the computer device can divide the remaining capacity of the database by the initial total increase in business to obtain the first limited use days of the database, and the first limited use days is: 255 / 13≈20 days. The computer device can divide the remaining capacity of the above database by the actual total increase in business to obtain the second limited use days of the above database, and the second limited use days is: 255 / 15=17 days. The computer device can display the first limited usage days, the second limited usage days, the actual total storage data volume, and the actual total business increase of the database.
[0127] In one embodiment, the computer device can sum the actual total amount of data stored in the database and the remaining capacity to obtain the allocated capacity of the database; divide the allocated capacity of the database by the actual total amount of data stored to obtain the utilization rate of the database. That is, the actual total amount of data stored is divided by the allocated capacity of the database to obtain the utilization rate of the database. When the actual number of days of use of the database is greater than the second limited number of days of use and less than the first limited number of days of use, or when the utilization rate of the database is greater than the utilization rate threshold, it is determined that the database has abnormal use. The computer device can generate prompt information about the existence of abnormal use of the database according to the actual business increase corresponding to the S types of target business categories; for example, the actual business increase and the actual filing increase of each business category can be obtained and compared, and the first business category with the largest actual business increase and the second business category with the smallest actual filing increase can be selected from the S types of target business categories. The prompt information can prompt that the database has abnormal use, and the abnormal reason is that the actual business increase of the first business category is too fast, or the abnormal reason is that the actual filing increase of the second business category increases too little, that is, the filing speed is too slow. By monitoring the usage of the database, it is helpful for database managers to pay attention to data growth earlier, discover the problem of too little archive increase in advance, and reduce the risk of database data volume.
[0128] In one embodiment, the computer device can compare the initial business increase of the database on the same day, in the past week, and in the past month to determine whether the capacity has increased abnormally, and remind the database user to pay attention to the business growth. In the case where the capacity of the data table of the sub-library and sub-table type has been increasing, when the archived data volume of the archived data table is not collected, it is determined that the business corresponding to the data table is not configured with data archiving, and the database administrator is prompted to configure data archiving. The computer device can compare the historical archived data volume of the data table of the sub-library and sub-table type with the archived data volume in the target time period. If the difference between the archived data volume in the target time period and the historical archived data volume is less than the difference threshold, the database administrator is prompted that there is an abnormality in data archiving. The target time period can refer to the past week, the past month, etc. Alternatively, the computer device can sort the actual business increase of the business and calculate the business with the fastest actual business increase. Such analysis suggestions can help database administrators pay attention to data growth earlier, discover archiving problems in advance, and reduce the capacity risk of the database.
[0129] For example, Figure 8As shown, the total amount of deleted data corresponding to the deleted archived data table is 40G, and the total initial business increase (i.e., daily increase) is 110G / day; the computer device can calculate the actual daily increase of the database as: 110+40=150G / day. Assuming that the actual total storage data volume of the database is 4505G; the allocated capacity of the database is 4792.5G, the computer device can calculate the utilization rate of the database as: 4505 / 4792.5*100%=94%. The computer device can calculate the remaining capacity of the database: 4792.5-4505=287.5G, and the computer device can divide the remaining capacity by the actual daily increase to obtain the second restricted usage days, i.e., 287.5 / 150≈3 days. If the utilization rate threshold is 90%, the computer device can determine that there is an abnormality in the database, display the amount of storage data used by the database, the utilization rate, the actual daily increase, the amount of deleted data, the total initial business increase, and the second restricted usage days, and indicate that the database has capacity risks, please expand the capacity as soon as possible. The computer equipment can display the capacity analysis information of each business in the database. For example, the database includes business category a1, business category a2 and business category a3. That is, the capacity analysis information of business category a1 is: the average actual daily increase in business categories in the past week is 150G, which is greater than the average actual daily increase in business categories in the past month of 100G. Please evaluate the growth of business categories. The capacity analysis information of business category a2 is: the total amount of stored data reaches 900G, please configure data archiving in time. The capacity analysis information of business category a3 is: the daily archiving volume in the past three days has dropped significantly, please evaluate whether the archiving task is running normally. It is helpful to assist management personnel to expand or archive the database in time to avoid capacity risks in the database.
[0130] In one embodiment, the computer device can construct a total amount increase trend chart of the database, which can be used to reflect the actual total amount of stored data, usage rate, etc. of the database every day. Fig. 9 As shown, Fig. 9 The figure reflects the actual total amount of stored data and the growth of usage rate of database d1 and database d2 in July. Comparing database d1 and database d2, we can see that the growth rate of the actual total amount of stored data in database d1 is greater than that of the actual total amount of stored data in database d2; and the growth rate of the usage rate of database d1 is greater than that of the usage rate of database d2.
[0131] In this application, by acquiring the proxy component, according to the storage path, in the storage layer corresponding to the database, the data tables in the database are collected in real time, and the storage data volume of the target data tables corresponding to the S target business categories is obtained, thereby improving the accuracy of the storage data volume of the target data tables. In addition, based on the library table name template corresponding to the K target data table sub-tables, the K target data tables are grouped to obtain all the target data tables under each target business category. According to the storage data volume of all the target data tables under each target business category, the total storage data volume corresponding to each target business category is determined, which can accurately detect the total storage data volume of the business and improve the accuracy of the data volume detection of the database.
[0132] In one embodiment, when the data processing method for a database provided by the present application is implemented by a storage device and a service device together, as shown in FIG. Fig.10 and Fig.11 As shown, the data processing method for a database may include the following steps:
[0133] S301. Obtain capacity information of a data table; the storage device may obtain capacity information of each data table from a database by acquiring an agent component. The data table includes an archived data table and an original data table. The capacity information of the original data table includes the amount of original data in the original data table, and the capacity information of the archived data table includes the amount of archived data in the archived data table.
[0134] S302: Is it a sub-library and sub-table type? If yes, execute step S303; if no, execute step S305; the storage device can perform digital detection on the library table name of the data table, and determine the data table with numeric characters in the library table name as the target data table of the sub-library and sub-table type.
[0135] S303, analysis of sub-libraries and sub-tables; the storage device can determine the library table name template corresponding to each data table according to the target library table name of the target data table. Specifically, the number of numeric characters in the target library table names of each target data table under the same business category is the same, and the arrangement position of the numeric characters is the same. Therefore, the storage device can obtain the number of numeric characters in the library table names corresponding to the above K target data tables, and the arrangement position of the numeric characters in the library table names; any two target data tables with the same number of numeric characters and the same arrangement position of numeric characters in the K target data tables are divided into the same data table set. The storage device can determine the library table name template corresponding to the target data table in the corresponding data table set according to the target library table name of the target data table in each data table set; for example, the storage device can use different digital markers to replace the numeric characters in the target library table names of the target data tables in different data table sets to obtain the library table name templates of the target data tables in each data table set.
[0136] S304. Obtain capacity information of the target data table; the storage device may group K target data tables according to the library table name template, determine the target data tables corresponding to the S target business categories, and obtain capacity information of the target data tables corresponding to the S target business categories from the capacity information of the above data tables.
[0137] S305, upload capacity information; the capacity information includes the total amount of storage data corresponding to the S target business categories and the storage data amount of the data table of the single table type. The storage device can determine the total amount of storage data corresponding to the S target business categories according to the storage data amount of the target data table corresponding to the S target business categories; upload the total amount of storage data corresponding to the S target business categories and the storage data amount of the data table of the single table type to the message queue.
[0138] S306, obtaining capacity information of the data table; the service device can obtain the total amount of stored data corresponding to the S types of business categories in the database and the amount of stored data in the data table of a single table type from the message queue.
[0139] S307, calculate the actual total increase in business; the service device can sum the total amount of stored data corresponding to the above S target business categories and the amount of data in the single-table data table to obtain the actual total amount of stored data in the database. The actual total amount of stored data in the database is subtracted from the historical total amount of data to obtain the initial total increase in business in the database; the initial total increase in business is summed with the total amount of deleted data corresponding to the archived data table deleted in the database within the time period to obtain the actual total increase in business in the database.
[0140] S308, calculate the restricted use days; the service device can determine the restricted use days of the above database according to the total initial business increase corresponding to the above database, the above remaining capacity and the actual total business increase.
[0141] S309, calculate the utilization rate; the service device may sum the actual total storage data volume of the above-mentioned database and the above-mentioned remaining capacity to obtain the allocated capacity of the above-mentioned database; and divide the allocated capacity of the above-mentioned database by the above-mentioned actual total storage data volume to obtain the utilization rate of the above-mentioned database.
[0142] S310, generating intelligent analysis results; the utilization rate of the database, the total actual business increase, and the total amount of stored data corresponding to the S target business categories, generating intelligent analysis results about the database, the intelligent analysis results are as follows Figure 8 shown.
[0143] S311, set a capacity warning threshold; the capacity warning threshold may refer to the usage rate of the data volume, or the number of days threshold. That is, when the usage rate of the database is less than the usage rate threshold, or the number of days of restricted use is less than the number of days threshold, the computer device may output a prompt message.
[0144] S312. Display a prompt message; the prompt message instructs the database to be expanded or archived in time to avoid database capacity problems.
[0145] In summary, by interacting with storage devices and service devices, the capacity of the database is detected, which is conducive to reducing the capacity detection pressure of a single device and improving the capacity detection efficiency of the database. It can be seen that the storage device can detect the capacity information of the data table of the sub-library and sub-table type, and then, the total amount of storage data of the data table of the same sub-library and sub-table type can be calculated, rather than the single table capacity obtained by sampling. The growth trend of the database capacity is analyzed on the service side to obtain the restricted use days of the database, combined with the database usage rate and the restricted use days alarm notification, and generate the intelligent analysis results of the database capacity, which can help database management and users to more accurately grasp the database capacity usage and timely plan capacity resources. This application solves the problem of inaccurate actual storage capacity of the previous database, so that database managers get rid of the dilemma of manually counting the use of sub-library and sub-table capacity, help database users to understand the capacity usage and growth of the library table more timely and effectively, and help database managers to discover database capacity risks more timely and locate abnormal capacity growth problems more conveniently and quickly. It reduces the risk of database downtime caused by capacity problems, improves database management efficiency, and reduces manual operation and maintenance costs.
[0146] See also Fig.12 , is a schematic diagram of a data processing device for a database provided in an embodiment of the present application. Fig.12 As shown, the data processing device for the database may include:
[0147] The acquisition module 1211 is used to acquire M library table names corresponding to M data tables from a database, where the M library table names are generated based on at least one library table name template, and M is an integer greater than 1;
[0148] The screening module 1212 is used to screen K target data tables of sub-library and sub-table type from the M data tables according to the M library and table names, where K is an integer greater than 1 and less than or equal to M.
[0149] The first determining module 1213 is used to determine the library table name templates corresponding to the K target data tables according to the K target library table names corresponding to the K target data tables, wherein the library table name templates correspond to the business categories indicated by the K target data tables respectively;
[0150] The grouping module 1214 is used for grouping the K target data tables according to the library table name template to obtain S target business categories and the target data tables corresponding to the S target business categories in the K target data tables, where S is a positive integer less than or equal to K.
[0151] The second determination module 1215 is used to obtain the storage data volume of the above-mentioned target data table corresponding to the above-mentioned S target business categories from the above-mentioned database, and determine the total storage data volume corresponding to the above-mentioned S target business categories according to the above-mentioned storage data volume.
[0152] Optionally, the first determining module 1213 is specifically configured to: obtain the number of numeric characters in the names of the K target library tables corresponding to the K target data tables, and the arrangement positions of the numeric characters in the names of the target library tables;
[0153] Divide any two target data tables having the same number of numeric characters and the same arrangement positions of the numeric characters in the K target data tables into the same data table set;
[0154] According to the target library table name of the target data table in each data table set, the library table name template corresponding to the target data table in the corresponding data table set is determined.
[0155] Optionally, the first determining module 1213 is specifically configured to:
[0156] Determine the value range of the corresponding numeric characters of the target data table in each data table set according to the numeric characters in the target library table name of the target data table in each data table set;
[0157] According to the above value range, determine the digital identifier corresponding to each of the above data table sets;
[0158] The digital identifier corresponding to each of the above data table sets is used to replace the digital characters in the target library table name of the target data table in the corresponding data table set, so as to obtain the library table name template of the target data table in the corresponding data table set.
[0159] Optionally, the acquisition module 1211 is specifically used for:
[0160] Obtain configuration information of the above database by obtaining the proxy component;
[0161] Determine the storage path of the database according to the configuration information of the database;
[0162] According to the storage path, in the storage layer corresponding to the database, the storage data volumes of the target data tables corresponding to the S target business categories are obtained.
[0163] Optionally, the acquisition module 1211 is specifically used for:
[0164] According to the target library table name of the target data table corresponding to the j-th target business category, determine the archived data table and the original data table corresponding to the j-th target business category; j is a positive integer less than or equal to S;
[0165] According to the storage path, in the storage layer corresponding to the database, the amount of archived data in the archived data table corresponding to the j-th target business category is obtained;
[0166] According to the storage path, in the storage layer corresponding to the database, the original data volume of the original data table corresponding to the j-th target business category is obtained;
[0167] The archived data volume and the original data volume are determined as the storage data volume of the target data table corresponding to the j-th target business category.
[0168] Optionally, the acquisition module 1211 is specifically used for:
[0169] Perform archiving character detection on the target database table name of the target data table of the j-th target business category to obtain an archiving character detection result;
[0170] According to the above-mentioned archiving character detection result, among the target data tables of the above-mentioned j-th target business category, the target data tables having archiving characters in the library table names are determined as the archiving data tables corresponding to the above-mentioned j-th target business category;
[0171] According to the above-mentioned archiving character detection result, among the target data tables of the above-mentioned j-th target business category, the target data tables without archiving characters in the library table names are determined as the original data tables corresponding to the above-mentioned j-th target business category.
[0172] Optionally, the second determining module 1215 is specifically configured to:
[0173] Upload the above stored data volume to the message queue of the service device;
[0174] The service device is used to obtain the storage data volume from the message queue, and determine the total storage data volume corresponding to the S target service categories according to the storage data volume.
[0175] Optionally, the storage data volume of the target data table corresponding to the j-th target business category includes the archived data volume of the archived data table and the original data volume of the original data table; j is a positive integer less than or equal to S;
[0176] Optionally, the second determining module 1215 is specifically configured to:
[0177] The original data volumes of the original data tables corresponding to the j-th target service category are summed to obtain the original total data volume corresponding to the j-th target service category;
[0178] The archived data volumes of the archived data tables corresponding to the j-th target business category are summed to obtain the total archived data volume corresponding to the j-th target business category;
[0179] The total archived data volume and the original total data volume corresponding to the j-th target business category are summed to obtain the total storage data volume corresponding to the j-th target business category.
[0180] Optionally, the second determining module 1215 is specifically configured to:
[0181] The total amount of stored data corresponding to the j-th target service category and the amount of historical stored data are subtracted to obtain the initial service increase of the j-th target service category; the amount of historical stored data is the amount of stored data corresponding to the j-th target service category obtained last time;
[0182] Obtain the amount of deleted data corresponding to the archived data table deleted for the j-th target business category within a time period; the time period is from the time when the total amount of stored data corresponding to the j-th target business category was obtained last time to the time when the total amount of stored data corresponding to the j-th target business category is obtained this time;
[0183] The initial service increase amount and the amount of deleted data of the j-th target service category are summed to obtain the actual service increase amount of the j-th target service category.
[0184] Optionally, the second determining module 1215 is specifically configured to:
[0185] Obtaining the actual total storage data volume and remaining capacity of the database from the database;
[0186] The actual total amount of stored data in the above database is subtracted from the total amount of historical data to obtain the total initial business increase of the above database;
[0187] The initial total increase in business volume and the total amount of deleted data corresponding to the data table deleted in the database within the time period are summed to obtain the actual total increase in business volume of the database;
[0188] The number of days for the restricted use of the above-mentioned database is determined based on the total initial business increase corresponding to the above-mentioned database, the above-mentioned remaining capacity and the total actual business increase.
[0189] Optionally, the second determining module 1215 is specifically configured to:
[0190] Dividing the remaining capacity of the database by the total initial business increase to obtain the first restricted use days of the database;
[0191] The remaining capacity of the above-mentioned database is divided by the above-mentioned total actual business increase to obtain the second limited usage days of the above-mentioned database.
[0192] Optionally, the second determining module 1215 is specifically configured to:
[0193] The total amount of data actually stored in the database and the remaining capacity are summed to obtain the allocated capacity of the database;
[0194] Dividing the allocated capacity of the database by the total amount of data actually stored, to obtain a utilization rate of the database;
[0195] When the actual usage days of the database is greater than the second restricted usage days and less than the first restricted usage days, or when the usage rate of the database is greater than the usage rate threshold, it is determined that there is an abnormal usage of the database;
[0196] According to the actual business increases corresponding to the above S target business categories, prompt information about abnormal usage of the above database is generated.
[0197] Optionally, the second determining module 1215 is specifically configured to:
[0198] Performing numeric character detection on the M library table names to obtain numeric character detection results;
[0199] According to the above numeric character detection results, K target data tables with numeric characters in their library table names are selected from the above M data tables;
[0200] The K target data tables having numeric characters in the library table names are determined as K target data tables whose data table type is a sub-library and sub-table type.
[0201] Optionally, the grouping module 1214 specifically determines the similarity between the library table name templates corresponding to the above K target data tables;
[0202] In the above K target data tables, the target data tables whose similarity of the library table name template is greater than the similarity threshold are divided into the same group to obtain S groups;
[0203] Determine the S target service categories corresponding to the S groups according to the corresponding relationship between the library table name template and the service category;
[0204] According to the S target service categories and the target data tables in the S groups, target data tables corresponding to the S target service categories in the K target data tables are determined.
[0205] In the present application, when the data table type is a sub-library type, the business data of the business corresponding to the data table is distributed in one or more data tables. Therefore, through the library table name of the data table, K target data tables of the sub-library type are identified, and based on the target library table names of the K target data tables, the library table name templates of the K target data tables are determined, and one library table name template reflects a business category. The above K target data tables are grouped according to the above library table name template to obtain S target business categories, and the target data tables corresponding to the above S target business categories in the above K target data tables are respectively obtained. According to the storage data volume of all target data tables under each target business category, the total storage data corresponding to each target business category is determined, which can accurately detect the total storage data corresponding to the business category and improve the accuracy of data volume detection of the database.
[0206] See also Fig.13 , is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig.13 As shown, the above-mentioned computer device 1000 may refer to a terminal or a server, including: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, in some embodiments, the user interface 1003 may include a display screen (DiSPlay), a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatileMeMory), such as at least one disk storage. The memory 1005 may also be optionally at least one storage device away from the aforementioned processor 1001. As Fig.13As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a computer program.
[0207] exist Fig.13 In the computer device 1000 shown, the network interface 1004 can provide a network communication function; the user interface 1003 is mainly used to provide an input interface; and the processor 1001 can be used to call the computer program stored in the memory 1005 to implement the following steps of the present application:
[0208] Obtaining, from a database, M library table names corresponding to the M data tables, where the M library table names are generated based on at least one library table name template, and M is an integer greater than 1;
[0209] According to the M library table names, K target data tables whose data table type is a sub-library and sub-table type are selected from the M data tables, where K is an integer greater than 1 and less than or equal to M;
[0210] According to the K target library table names corresponding to the K target data tables, determining the library table name templates corresponding to the K target data tables, respectively, the library table name templates corresponding to the business categories indicated by the K target data tables respectively;
[0211] The K target data tables are grouped according to the library table name template to obtain S target business categories and target data tables corresponding to the S target business categories in the K target data tables, where S is a positive integer less than or equal to K;
[0212] The storage data volumes of the target data tables corresponding to the S target business categories are obtained from the database, and the total storage data volumes corresponding to the S target business categories are determined based on the storage data volumes.
[0213] Optionally, the processor 1001 may be configured to call a computer program stored in the memory 1005 to implement the following steps of the present application:
[0214] Obtain the number of numeric characters in the names of the K target library tables corresponding to the K target data tables, and the arrangement positions of the numeric characters in the names of the target library tables;
[0215] Divide any two target data tables having the same number of numeric characters and the same arrangement positions of the numeric characters in the K target data tables into the same data table set;
[0216] According to the target library table name of the target data table in each data table set, the library table name template corresponding to the target data table in the corresponding data table set is determined.
[0217] Optionally, the processor 1001 may be configured to call a computer program stored in the memory 1005 to implement the following steps of the present application:
[0218] Determine the value range of the corresponding numeric characters of the target data table in each data table set according to the numeric characters in the target library table name of the target data table in each data table set;
[0219] According to the above value range, determine the digital identifier corresponding to each of the above data table sets;
[0220] The digital identifier corresponding to each of the above data table sets is used to replace the digital characters in the target library table name of the target data table in the corresponding data table set, so as to obtain the library table name template of the target data table in the corresponding data table set.
[0221] Optionally, the processor 1001 may be configured to call a computer program stored in the memory 1005 to implement:
[0222] Obtain configuration information of the above database by obtaining the proxy component;
[0223] Determine the storage path of the database according to the configuration information of the database;
[0224] According to the storage path, in the storage layer corresponding to the database, the storage data volumes of the target data tables corresponding to the S target business categories are obtained.
[0225] Optionally, the processor 1001 may be configured to call a computer program stored in the memory 1005 to implement the following steps of the present application:
[0226] According to the target library table name of the target data table corresponding to the j-th target business category, determine the archived data table and the original data table corresponding to the j-th target business category; j is a positive integer less than or equal to S;
[0227] According to the storage path, in the storage layer corresponding to the database, the amount of archived data in the archived data table corresponding to the j-th target business category is obtained;
[0228] According to the storage path, in the storage layer corresponding to the database, the original data volume of the original data table corresponding to the j-th target business category is obtained;
[0229] The archived data volume and the original data volume are determined as the storage data volume of the target data table corresponding to the j-th target business category.
[0230] Optionally, the processor 1001 may be configured to call a computer program stored in the memory 1005 to implement the following steps of the present application:
[0231] Perform archiving character detection on the target database table name of the target data table of the j-th target business category to obtain an archiving character detection result;
[0232] According to the above-mentioned archiving character detection result, among the target data tables of the above-mentioned j-th target business category, the target data tables having archiving characters in the library table names are determined as the archiving data tables corresponding to the above-mentioned j-th target business category;
[0233] According to the above-mentioned archiving character detection result, among the target data tables of the above-mentioned j-th target business category, the target data tables without archiving characters in the library table names are determined as the original data tables corresponding to the above-mentioned j-th target business category.
[0234] Optionally, the processor 1001 may be configured to call a computer program stored in the memory 1005 to implement the following steps of the present application:
[0235] Upload the above stored data volume to the message queue of the service device;
[0236] The service device is used to obtain the storage data volume from the message queue, and determine the total storage data volume corresponding to the S target service categories according to the storage data volume.
[0237] Optionally, the storage data volume of the target data table corresponding to the j-th target business category includes the archived data volume of the archived data table and the original data volume of the original data table; j is a positive integer less than or equal to S;
[0238] Optionally, the processor 1001 may be configured to call a computer program stored in the memory 1005 to implement the following steps of the present application:
[0239] The original data volumes of the original data tables corresponding to the j-th target service category are summed to obtain the original total data volume corresponding to the j-th target service category;
[0240] The archived data volumes of the archived data tables corresponding to the j-th target business category are summed to obtain the total archived data volume corresponding to the j-th target business category;
[0241] The total archived data volume and the original total data volume corresponding to the j-th target business category are summed to obtain the total storage data volume corresponding to the j-th target business category.
[0242] Optionally, the processor 1001 may be configured to call a computer program stored in the memory 1005 to implement the following steps of the present application:
[0243] The total amount of stored data corresponding to the j-th target service category and the amount of historical stored data are subtracted to obtain the initial service increase of the j-th target service category; the amount of historical stored data is the amount of stored data corresponding to the j-th target service category obtained last time;
[0244] Obtain the amount of deleted data corresponding to the archived data table deleted for the j-th target business category within the time period; the time period is from the time when the total amount of stored data corresponding to the j-th target business category was obtained last time to the time when the total amount of stored data corresponding to the j-th target business category is obtained this time;
[0245] The initial service increase amount and the amount of deleted data of the j-th target service category are summed to obtain the actual service increase amount of the j-th target service category.
[0246] Optionally, the processor 1001 may be configured to call a computer program stored in the memory 1005 to implement the following steps of the present application:
[0247] Obtaining the actual total storage data volume and remaining capacity of the database from the database;
[0248] The actual total amount of stored data in the above database is subtracted from the total amount of historical data to obtain the total initial business increase of the above database;
[0249] The initial total increase in business volume and the total amount of deleted data corresponding to the data table deleted in the database within the time period are summed to obtain the actual total increase in business volume of the database;
[0250] The number of days for the restricted use of the above-mentioned database is determined based on the total initial business increase corresponding to the above-mentioned database, the above-mentioned remaining capacity and the total actual business increase.
[0251] Optionally, the processor 1001 may be configured to call a computer program stored in the memory 1005 to implement the following steps of the present application:
[0252] Dividing the remaining capacity of the database by the total initial business increase to obtain the first restricted use days of the database;
[0253] The remaining capacity of the above-mentioned database is divided by the above-mentioned total actual business increase to obtain the second limited usage days of the above-mentioned database.
[0254] Optionally, the processor 1001 may be configured to call a computer program stored in the memory 1005 to implement the following steps of the present application:
[0255] The total amount of data actually stored in the database and the remaining capacity are summed to obtain the allocated capacity of the database;
[0256] Dividing the allocated capacity of the database by the total amount of data actually stored, to obtain a utilization rate of the database;
[0257] When the actual usage days of the database is greater than the second restricted usage days and less than the first restricted usage days, or when the usage rate of the database is greater than the usage rate threshold, it is determined that there is an abnormal usage of the database;
[0258] According to the actual business increases corresponding to the above S target business categories, prompt information about abnormal usage of the above database is generated.
[0259] Optionally, the processor 1001 may be configured to call a computer program stored in the memory 1005 to implement the following steps of the present application:
[0260] Performing digital character detection on the library table names corresponding to the M data tables to obtain digital character detection results;
[0261] According to the above numeric character detection results, K target data tables with numeric characters in their library table names are selected from the above M data tables;
[0262] The K target data tables having numeric characters in the library table names are determined as K target data tables whose data table type is a sub-library and sub-table type.
[0263] Optionally, the processor 1001 may be configured to call a computer program stored in the memory 1005 to implement the following steps of the present application:
[0264] Determine the similarity between the library table name templates corresponding to the above K target data tables respectively;
[0265] In the above K target data tables, the target data tables whose similarity of the library table name template is greater than the similarity threshold are divided into the same group to obtain S groups;
[0266] Determine the S target service categories corresponding to the S groups according to the corresponding relationship between the library table name template and the service category;
[0267] According to the S target service categories and the target data tables in the S groups, target data tables corresponding to the S target service categories in the K target data tables are determined.
[0268] It should be understood that the computer device described in the embodiments of the present application can execute the description of the data processing method for the database in the corresponding embodiments above, and can also execute the description of the data processing device for the database in the corresponding embodiments above, which will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated.
[0269] The data collection and processing in this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in practice, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0270] In the present application, when the data table type is a sub-library type, the business data of the business corresponding to the data table is distributed in one or more data tables. Therefore, through the library table name of the data table, K target data tables of the sub-library type are identified, and based on the target library table names of the K target data tables, the library table name templates of the K target data tables are determined, and one library table name template reflects a business category. The above K target data tables are grouped according to the above library table name template to obtain S target business categories, and the target data tables corresponding to the above S target business categories in the above K target data tables are respectively obtained. According to the storage data volume of all target data tables under each target business category, the total storage data corresponding to each target business category is determined, which can accurately detect the total storage data corresponding to the business category and improve the accuracy of data volume detection of the database.
[0271] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the above-mentioned computer-readable storage medium stores a computer program executed by the data processing device for the database mentioned above, and the above-mentioned computer program includes program instructions. When the above-mentioned processor executes the above-mentioned program instructions, it can execute the description of the above-mentioned data processing method for the database in the corresponding embodiment above, so it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0272] As an example, the above program instructions may be deployed on a computer device for execution, or deployed on at least two computer devices at one location for execution, or executed on at least two computer devices distributed at at least two locations and interconnected through a communication network. At least two computer devices distributed at at least two locations and interconnected through a communication network may constitute a blockchain network.
[0273] The computer-readable storage medium may be a data processing device for a database provided in any of the aforementioned embodiments or a central storage unit of the computer device, such as a hard disk or a memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SMART Media card, SMC), a secure digital character (Secure digital, SD) card, a flash memory card (flaSh card), etc. equipped on the computer device. Further, the computer-readable storage medium may also include both a central storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0274] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish between contents in different media, rather than to describe a specific order. In addition, the terms "including" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules that are not listed, or may optionally include other step units inherent to these processes, methods, devices, products, or equipment.
[0275] 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, and 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 processing circuits or memories) or a combination thereof. Similarly, a 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 part of an overall module or unit that includes the function of the module or unit.
[0276] The data collection and processing in this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in practice, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0277] The embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the description of the data processing method and decoding method for the database in the above-mentioned corresponding embodiment, so it will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the embodiment of the computer program product involved in the present application, please refer to the description of the method embodiment of the present application.
[0278] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0279] The method and related apparatus provided by the embodiment of the present application are described with reference to the method flow chart and / or structural diagram provided by the embodiment of the present application. Specifically, each process and / or box in the method flow chart and / or structural diagram, as well as the combination of the processes and / or boxes in the flow chart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable network connection device to generate a machine, so that the instructions executed by the processor of the computer or other programmable network connection device generate instructions for implementing the process in the process. Figure 1 A process or multiple processes and / or structures Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable network-connected device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or structures Figure 1 These computer program instructions can also be loaded onto a computer or other programmable network connected device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A flow or multiple flows and / or structures illustrate the steps of the functions specified in one block or multiple blocks.
[0280] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method for a database, characterized in that: include: Obtaining, from a database, M library table names corresponding to the M data tables, where the M library table names are generated based on at least one library table name template, and M is an integer greater than 1; According to the M library table names, K target data tables whose data table type is a sub-library and sub-table type are selected from the M data tables, where K is an integer greater than 1 and less than or equal to M; According to the K target library table names corresponding to the K target data tables, determining the library table name templates corresponding to the K target data tables respectively, wherein the library table name templates correspond to the business categories respectively indicated by the K target data tables; The K target data tables are grouped according to the library table name template to obtain S target business categories and target data tables corresponding to the S target business categories in the K target data tables, where S is a positive integer less than or equal to K; The storage data volumes of the target data tables respectively corresponding to the S target business categories are obtained from the database, and the total storage data volumes respectively corresponding to the S target business categories are determined based on the storage data volumes.
2. The method according to claim 1, characterized in that The step of determining the library table name templates corresponding to the K target data tables respectively according to the K target library table names corresponding to the K target data tables includes: Obtaining the number of numeric characters in the names of the K target library tables corresponding to the K target data tables, and the arrangement positions of the numeric characters in the names of the target library tables; Divide any two target data tables having the same number of numeric characters and the same arrangement positions of the numeric characters in the K target data tables into the same data table set; According to the target library table name of the target data table in each data table set, the library table name template corresponding to the target data table in the corresponding data table set is determined.
3. The method according to claim 2, characterized in that The step of determining the library table name template corresponding to the target data table in the data table set according to the target library table name of the target data table in each data table set includes: Determine, according to the numeric characters in the target library table name of the target data table in each data table set, the value range of the numeric characters corresponding to the target data table in each data table set; Determine the digital identifier corresponding to each data table set according to the value range; The digital identifier corresponding to each data table set is used to replace the digital characters in the target library table name of the target data table in the corresponding data table set, so as to obtain the library table name template of the target data table in the corresponding data table set.
4. The method according to claim 1, characterized in that The acquiring, from the database, storage data amounts of target data tables corresponding to the three target business categories respectively comprises: Obtain configuration information of the database by obtaining the proxy component; Determining a storage path of the database according to the configuration information of the database; According to the storage path, at the storage layer corresponding to the database, the storage data volumes of the target data tables respectively corresponding to the S target business categories are obtained.
5. The method according to claim 4, characterized in that The acquiring, according to the storage path, at the storage layer corresponding to the database, the storage data amounts of the target data tables respectively corresponding to the S target business categories comprises: According to the target library table name of the target data table corresponding to the j-th target business category, determine the archived data table and the original data table corresponding to the j-th target business category; j is a positive integer less than or equal to S; According to the storage path, in the storage layer corresponding to the database, obtaining the amount of archived data of the archived data table corresponding to the j-th target business category; According to the storage path, in the storage layer corresponding to the database, the original data volume of the original data table corresponding to the j-th target business category is obtained; The archived data volume and the original data volume are determined as the storage data volume of the target data table corresponding to the j-th target business category.
6. The method according to claim 5, characterized in that The step of determining the archived data table and the original data table corresponding to the j-th target business category according to the target library table name of the target data table corresponding to the j-th target business category comprises: Performing archival character detection on the target database table name of the target data table of the j-th target business category to obtain an archival character detection result; According to the archiving character detection result, among the target data tables of the j-th target business category, the target data tables having the archiving character in the library table name are determined as the archiving data tables corresponding to the j-th target business category; According to the archiving character detection result, among the target data tables of the j-th target business category, the target data tables without archiving characters in their library table names are determined as the original data tables corresponding to the j-th target business category.
7. The method according to claim 1, characterized in that The determining, according to the amount of stored data, the total amount of stored data corresponding to the three target service categories, respectively, includes: Uploading the stored data volume to a message queue of a service device; The service device is used to obtain the storage data volume from the message queue, and determine the total storage data volume corresponding to the S target service categories respectively according to the storage data volume.
8. The method according to claim 1, characterized in that The storage data volume of the target data table corresponding to the jth target business category includes the archived data volume of the archived data table and the original data volume of the original data table; j is a positive integer less than or equal to S; The determining, according to the amount of stored data, the total amount of stored data corresponding to the three target service categories, respectively, includes: Summing the original data volumes of the original data tables corresponding to the j-th target service category to obtain the original total data volume corresponding to the j-th target service category; Summing up the archived data volumes of the archived data tables corresponding to the j-th target service category to obtain the total archived data volume corresponding to the j-th target service category; The total archived data volume and the original total data volume corresponding to the j-th target business category are summed to obtain the total storage data volume corresponding to the j-th target business category.
9. The method according to claim 8, characterized in that The method further comprises: The total amount of stored data corresponding to the j-th target service category and the amount of historical stored data are subtracted to obtain the initial service increase of the j-th target service category; the amount of historical stored data is the total amount of stored data corresponding to the j-th target service category acquired last time; Obtaining the amount of deleted data corresponding to the archived data table deleted for the j-th target business category within a time period; the time period is from the time when the total amount of stored data corresponding to the j-th target business category was obtained last time to the time when the total amount of stored data corresponding to the j-th target business category is obtained this time; The initial service increase amount and the deleted data amount of the j-th target service category are summed to obtain the actual service increase amount of the j-th target service category.
10. The method according to claim 1, characterized in that The method further comprises: Obtaining from the database the actual total amount of stored data and the remaining capacity of the database; Performing a difference processing on the actual total storage data volume of the database and the historical total data volume to obtain the initial total business increase of the database; The initial total business increase is summed with the total amount of deleted data corresponding to the data tables deleted in the database within a time period to obtain the actual total business increase of the database; The number of days for limited use of the database is determined according to the total initial business increase, the remaining capacity and the total actual business increase corresponding to the database.
11. The method according to claim 10, characterized in that Determining the number of days for limiting the use of the database according to the total initial business increase, the remaining capacity and the total actual business increase corresponding to the database includes: Dividing the remaining capacity of the database by the total initial business increase to obtain a first limited usage day of the database; The remaining capacity of the database is divided by the actual total increase in business to obtain a second limited number of days for use of the database.
12. The method according to claim 11, characterized in that The method further comprises: The total amount of data actually stored in the database and the remaining capacity are summed to obtain the allocated capacity of the database; Dividing the allocated capacity of the database by the actual total amount of stored data to obtain the utilization rate of the database; When the actual usage days of the database are greater than the second restricted usage days and less than the first restricted usage days, or when the usage rate of the database is greater than the usage rate threshold, it is determined that the database has usage anomalies; According to the actual business increases respectively corresponding to the S target business categories, prompt information about abnormal usage of the database is generated.
13. The method according to claim 1, characterized in that The step of screening K target data tables whose data table types are sub-library and sub-table types from the M data tables according to the M library table names includes: Performing numeric character detection on the M library table names to obtain numeric character detection results; According to the numeric character detection result, K target data tables having numeric characters in their library table names are screened from the M data tables; The K target data tables having numeric characters in the library table names are determined as K target data tables whose data table type is a sub-library and sub-table type.
14. The method according to claim 1, wherein: The K target data tables are grouped according to the library table name template to obtain S target business categories, and the target data tables corresponding to the S target business categories in the K target data tables respectively include: Determine the similarity between the library table name templates corresponding to the K target data tables respectively; In the K target data tables, the target data tables whose similarity of the library table name templates is greater than the similarity threshold are divided into the same group to obtain S groups; Determine S target service categories corresponding to the S groups according to the correspondence between the library table name template and the service category; According to the S target service categories and the target data tables in the S groups, target data tables corresponding to the S target service categories in the K target data tables are determined.
15. A data processing device for a database, characterized in that: include: An acquisition module, used for acquiring M library table names corresponding to M data tables from a database, wherein the M library table names are generated based on at least one library table name template, and M is an integer greater than 1; A screening module, used for screening K target data tables whose data table type is a sub-library and sub-table type from the M data tables according to the M library table names, where K is an integer greater than 1 and less than or equal to M; A first determination module is used to determine the library table name templates corresponding to the K target data tables according to the K target library table names corresponding to the K target data tables, wherein the library table name templates correspond to the business categories indicated by the K target data tables respectively; A grouping module, used for grouping the K target data tables according to the library table name template to obtain S target business categories and target data tables corresponding to the S target business categories in the K target data tables, where S is a positive integer less than or equal to K; The second determination module is used to obtain from the database the storage data volume of the target data table corresponding to the S target business categories respectively, and determine the total storage data volume corresponding to the S target business categories respectively according to the storage data volume.
16. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 14 are implemented.
17. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.
18. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.