Database storage space optimization method and device, electronic equipment and storage medium
By obtaining storage information from the database tablespace, determining the fragmentation rate, and performing data block reorganization and static data compression, the problem of inefficient data scanning and slow business response caused by fragmented space in the database is solved, thereby improving storage space utilization and system performance.
Patent Information
- Application Number
- CN202110794123.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-12
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2041-07-12
AI Technical Summary
The existence of fragmented space in the database leads to inefficient data scanning, slow business response, and ineffective utilization of storage space.
By obtaining the storage information of the tablespace in the database, the fragmentation rate is determined, a database sequence is generated, a target database is selected for space optimization, including data block reorganization and static data compression, and an optimization report is generated.
It improved the utilization rate of database storage space, alleviated storage pressure, enhanced system performance, and solved the problems of inefficient data scanning and slow business response caused by fragmented space.
Smart Images

Figure CN113535725B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the field of finance and computer technology, in particular to a database storage space optimization method, device, equipment, medium and program product. BACKGROUND
[0002] A database is a computer software system for storing and managing data according to data structure. In a production system, a large amount of historical data is accumulated over a long period of time, and a large amount of fragmented space is generated in the database due to frequent insertion, deletion and update of active data.
[0003] In the process of implementing the present disclosure, the inventors found that at least the following problems exist in the related art: the existence of fragmented space causes inefficient data scanning and slow business response. SUMMARY
[0004] In view of the above problems, the present disclosure provides a database storage space optimization method, device, equipment, medium and program product.
[0005] According to a first aspect of the present disclosure, a database storage space optimization method is provided, comprising:
[0006] obtaining storage information of table space in a database, wherein the storage information comprises fragmented space information of the table space;
[0007] determining a first fragmentation rate of the database according to the fragmented space information of each table space;
[0008] generating a database sequence according to the first fragmentation rate of each database in the order of size, wherein N≥1;
[0009] determining M target databases from N databases according to the database sequence, wherein N≥M≥1;
[0010] performing space optimization processing on each target database to generate a space optimization report.
[0011] According to an embodiment of the present disclosure, the storage information further comprises space usage information of the table space;
[0012] The database storage space optimization method further comprises:
[0013] determining a space usage rate of the database according to the space usage information;
[0014] generating a space report according to the first fragmentation rate and the space usage rate of each database, wherein the space report comprises a database fragmentation rate report and a database space usage rate report.
[0015] According to an embodiment of the present disclosure, determining the first fragmentation rate of the database according to the fragmentation space information of each of the table spaces comprises:
[0016] According to the fragmentation space information, determining the second fragmentation rate of each of the table spaces in the database;
[0017] According to each of the second fragmentation rate, determining the first fragmentation rate of the data.
[0018] According to an embodiment of the present disclosure, determining the M target databases from the N related databases according to the database sequence comprises:
[0019] Obtaining a selection operation of the target databases, wherein the selection operation comprises attribute information corresponding to each of the target databases, and the attribute information comprises a database identifier, an application name, or an Internet Protocol address;
[0020] In response to the target data selection operation, sequentially determining the M target databases in the database sequence.
[0021] According to an embodiment of the present disclosure, performing space optimization processing on each of the target databases to generate a space optimization report comprises:
[0022] In a case where a business idle time period of the target database is at a current time end, sending a space optimization application to a control end;
[0023] Obtaining a feedback result issued by the control end for the space optimization application;
[0024] In a case where the feedback result indicates that the target database can currently perform space optimization, performing space optimization processing on the target database to generate a space optimization report.
[0025] According to an embodiment of the present disclosure, in a case where the feedback result indicates that the target database can currently perform space optimization, performing space optimization processing on the target database to generate a space optimization report comprises:
[0026] Performing data block reorganization and static data compression processing on each of the table spaces in the target database to generate the space optimization report.
[0027] According to an embodiment of the present disclosure, the database storage space optimization method further comprises:
[0028] According to the space optimization report, performing a recycling effect evaluation on the target database to generate an optimization effect evaluation report, wherein the optimization effect evaluation report comprises an optimized space amount and a compressed space amount;
[0029] According to the optimization effect evaluation report, a space recycling report corresponding to the target database is generated.
[0030] According to an embodiment of the present disclosure, the determination method of the fragmented space information comprises:
[0031] The size information of each storage space in the table space is sequentially acquired;
[0032] The size information of each storage space is compared with a preset storage threshold, and a comparison result is output;
[0033] In a case where the comparison result represents that the size information of the storage space is less than the preset storage threshold, the storage space is determined as a fragmented space;
[0034] Attribute information of each fragmented space is acquired, and the fragmented space information is generated.
[0035] A second aspect of the present disclosure provides a database storage space optimization device, comprising:
[0036] A first acquisition module is configured to acquire storage information of table spaces in a database, wherein the storage information comprises fragmented space information of the table spaces;
[0037] A first determination module is configured to determine a first fragmentation rate of the database according to the fragmented space information of each table space;
[0038] A first generation module is configured to generate a database sequence according to a size order of the first fragmentation rate of each database from N databases, wherein N is greater than or equal to 1;
[0039] A second determination module is configured to determine M target databases from N databases according to the database sequence, wherein N is greater than or equal to M, and M is greater than or equal to 1;
[0040] A second generation module is configured to perform a space optimization process on each target database, and generate a space optimization report.
[0041] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; a memory configured to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors perform the above-mentioned database storage space optimization method.
[0042] A fourth aspect of the present disclosure further provides a computer-readable storage medium having executable instructions stored thereon, which are executed by a processor to cause the processor to perform the above-mentioned database storage space optimization method.
[0043] The fifth aspect of the present disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the database storage space optimization method described above.
[0044] According to an embodiment of the present disclosure, by obtaining the fragmentation rate of each table space in the database, the fragmentation rate of each database is determined, each database is sorted according to the size of the fragmentation rate of each database, and a database sequence is generated. A plurality of target databases are determined in the database sequence, and the target databases are subjected to space optimization processing and a space optimization report is generated. Since the target databases are determined according to the database sequence, the databases with relatively large fragmentation rates can be optimized according to specific optimization requirements, thereby improving the effect and speed of space optimization. At the same time, by subjecting the target data to space optimization processing, the storage pressure of the database can be relieved, and the performance of system operation can be improved. At least part of the problem of low efficiency of data scanning and slow business response caused by a large amount of fragmented space in the database due to frequent insertion, deletion and update of active data is solved. BRIEF DESCRIPTION OF DRAWINGS
[0045] The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure taken in conjunction with the accompanying drawings, in which:
[0046] Figure 1 An application scenario diagram of the database storage space optimization method according to an embodiment of the present disclosure is schematically shown.
[0047] Figure 2 A flowchart of the database storage space optimization method according to an embodiment of the present disclosure is schematically shown.
[0048] Figure 3 A space report schematic diagram according to an embodiment of the present disclosure is schematically shown.
[0049] Figure 4 A generation method schematic diagram of a space recycling report according to an embodiment of the present disclosure is schematically shown.
[0050] Figure 5 A structural block diagram of a database storage space optimization device according to an embodiment of the present disclosure is schematically shown.
[0051] Figure 6 A block diagram of an electronic device suitable for implementing the data processing method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0052] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood, however, that the description is merely exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description of the embodiments, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. However, it would be apparent to those skilled in the art that the embodiments, or one or more embodiments, can be practiced without these specific details. In other instances, well-known structures and
[0053] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the present disclosure. As used herein, the term "including" "comprising" and the like are meant to be inclusive, but not limiting to the components, steps, operations and / or the features that are present in one or more embodiments.
[0054] All terms used herein, including technical and scientific terms, have the meanings commonly understood by one of ordinary skill in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of the specification, and should not be interpreted in an idealized or overly formal way.
[0055] In the case of using expressions similar to "at least one of A, B, and C, etc.", it should generally be interpreted to include any of one, all, or a combination thereof. For example, "a system having at least one of A, B, and C" should be interpreted to include a system having A alone, a system having B alone, a system having C alone, a system having A and B together, a system having A and C together, a system having B and C together, and / or a system having A, B, and C together, etc.
[0056] At present, there are many open platform databases, and a large amount of historical data is accumulated in the production system for a long time. In addition, due to the frequent insertion, deletion and update operations of active data, the database generates a large amount of fragmented space. The existence of the fragmented space has a great impact on the production performance pressure, which can cause inefficient data scanning, and even cause batch interruption, slow business response and other problems. When the table space continuously adds and deletes data, and the fragmented space cannot be effectively utilized, it will continuously search for empty space or increase new storage space.
[0057] Embodiments of the present disclosure provide a database storage space optimization method, comprising:
[0058] Obtaining storage information of table spaces in a database, wherein the storage information comprises fragmentation space information of the table spaces; determining a first fragmentation rate of the database according to the fragmentation space information of each table space; generating a database sequence according to the size order of the first fragmentation rate of each database in N databases, wherein N≥1; determining M target databases from the N databases according to the database sequence, wherein N≥M≥1; performing space optimization processing on each target database to generate a space optimization report.
[0059] It should be noted that the database storage space optimization method and device of the present disclosure can be used in the fields of finance and computer technology, and can also be used in any field other than the fields of finance and computer technology. The application field of the database storage space optimization method and device of the present disclosure is not limited.
[0060] Figure 1 An application scenario diagram of the database storage space optimization method according to an embodiment of the present disclosure is schematically shown.
[0061] As shown in Figure 1 The application scenario 100 according to this embodiment can include a network, terminal devices and a server. The network 104 is a medium for providing a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 can include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0062] The user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0063] The terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers and desktop computers, etc.
[0064] The server 105 can be a server providing various services, such as a background management server supporting the website browsed by the user using the terminal devices 101, 102, 103 (only as an example). The background management server can analyze and process the received user request data, etc., and feed back the processing result (such as a webpage, information or data, etc. obtained or generated according to the user request) to the terminal device.
[0065] It should be noted that the database storage space optimization method provided by the embodiments of the present disclosure can be generally executed by the server 105. Accordingly, the database storage space optimization apparatus provided by the embodiments of the present disclosure can be generally arranged in the server 105. The database storage space optimization method provided by the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the terminal device 101, 102, 103 and / or the server 105. Accordingly, the database storage space optimization apparatus provided by the embodiments of the present disclosure can also be arranged in a server or a server cluster different from the server 105 and capable of communicating with the terminal device 101, 102, 103 and / or the server 105.
[0066] It should be understood that Figure 1 The number of terminal devices, networks and servers in the system is merely illustrative. Any number of terminal devices, networks and servers can be provided according to implementation needs.
[0067] The database storage space optimization method according to the embodiments of the present disclosure will be described in detail below based on the scenario described above. Figure 1 Figures 2 to 4 The database storage space optimization method according to the embodiments of the present disclosure will be described in detail below based on the scenario described above.
[0068] Figure 2 A flowchart of the database storage space optimization method according to the embodiments of the present disclosure is schematically shown.
[0069] As shown in Figure 2 , the database storage space optimization method of this embodiment includes operations S201-S205, which can be executed by a terminal device or a server.
[0070] In operation S201, storage information of a table space in a database is acquired, wherein the storage information includes fragmentation space information of the table space.
[0071] According to the embodiments of the present disclosure, each database can include at least one table space, for example. The fragmentation space information can include size information and position information of the fragmentation space, for example. The fragmentation space can be determined according to a preset storage threshold, for example. In the case where the storage space is smaller than the preset storage threshold, the storage space is determined as the fragmentation space. The storage space can include free space in the table space, for example. The free space is used to represent a space without storing data. For example, there is a free space between two adjacent data blocks in a certain table space. If the size of the free space is smaller than the preset storage threshold, the free space can be determined as the fragmentation space.
[0072] According to embodiments of the present disclosure, the preset storage threshold value may, for example, include 1 MB (MByte), 4 MB or 6 MB. According to specific implementation needs, the preset storage threshold value may, for example, be any other value.
[0073] In operation S202, a first fragmentation rate of the database is determined according to the fragmentation space information of each table space.
[0074] According to embodiments of the present disclosure, the first fragmentation rate may, for example, refer to a ratio of a total size of the fragmented spaces in the table space to a size of the table space. The total size of the fragmented spaces may, for example, be calculated according to the fragmentation space information of each fragmented space in the table space.
[0075] In operation S203, a database sequence is generated in the N databases in a size order of the first fragmentation rate of each database, where N≥1.
[0076] According to embodiments of the present disclosure, each database in the database sequence may, for example, be arranged in an order of decreasing fragmentation rate. According to specific implementation needs, each database in the database sequence may also be arranged in an order of increasing fragmentation rate. Alternatively, each database in the database sequence may also be arranged in other orders, and the present disclosure does not limit the arrangement order of the databases in the database sequence.
[0077] In operation S204, M target databases are determined from the N databases according to the database sequence, where N≥M≥1.
[0078] According to embodiments of the present disclosure, the target database may, for example, refer to a database that needs to be optimized in space. The determination manner of the target database may, for example, be selected and determined by a user or an operation and maintenance personnel according to the database sequence, or automatically selected and determined according to a preset number in the database sequence.
[0079] In operation S205, a space optimization processing is performed on each target database, and a space optimization report is generated.
[0080] According to embodiments of the present disclosure, the space optimization report may, for example, include a result of the space optimization processing.
[0081] According to an embodiment of the present disclosure, the database fragmentation rate of each database is determined by obtaining the fragmentation rate of each table space in the database, and each database is sorted according to the size of the fragmentation rate of each database to generate a database sequence. A plurality of target databases are determined in the database sequence, and the target databases are subjected to space optimization processing and a space optimization report is generated. Since the target databases are determined according to the database sequence, the databases with relatively high fragmentation rates can be subjected to optimization processing according to specific optimization requirements, thereby improving the effect and speed of space optimization. At the same time, by subjecting the target data to space optimization processing, the storage pressure of the database can be relieved, and the performance of system operation can be improved. At least part of the problem of low data scanning efficiency and slow business response caused by frequent insertion, deletion and update of active data to generate a large amount of fragmented space in the database is solved.
[0082] According to an embodiment of the present disclosure, the storage information further includes space usage information of the table space.
[0083] According to an embodiment of the present disclosure, the space usage information may, for example, include a space usage rate of the table space. The space usage rate may, for example, be determined by the effective storage space. The effective storage space may, for example, be determined according to a preset storage threshold. In the case where the storage space is greater than the preset storage threshold, the storage space is determined as the effective storage space. The effective storage space may, for example, include a space in which valid information has been stored in the table space, and the like.
[0084] According to an embodiment of the present disclosure, the database storage space optimization method further includes:
[0085] According to the space usage information, the space usage rate of the database is determined. The space report is generated according to the first fragmentation rate and the space usage rate of each database, wherein the space report includes the database fragmentation rate report and the database space usage rate report.
[0086] According to an embodiment of the present disclosure, the space report may, for example, be displayed in the form of an icon. By generating the space report of each database, the visibility of the data control space usage rate and the fragmentation rate can be improved, the user or the operation and maintenance personnel can be facilitated to check, and the operability of database management can be improved.
[0087] Figure 3 A space report schematic diagram according to an embodiment of the present disclosure is schematically shown.
[0088] As shown in Figure 3 The space report 300 may, for example, include a menu area 301, a database fragmentation rate report area 302, a database space usage rate report area 303 and a detailed information display area 304.
[0089] According to an embodiment of the present disclosure, different menu pages can be entered by selecting corresponding menu options in the menu area 301. The database fragmentation rate report area 302 is used to display a database fragmentation rate ranking table. The database space usage report area 303 is used to display a database space usage ranking table. The detailed information display area 304 can be used to display basic attribute information of each database, for example, which can include a database identifier (DBID), a database name, a space allocation amount, a table space number, an application name, an IP address, a database version, and the like.
[0090] According to an embodiment of the present disclosure, determining the first fragmentation rate of the database according to the fragmentation space information of each table space includes:
[0091] Determining a second fragmentation rate of each table space in the database according to the fragmentation space information. Determining the first fragmentation rate of the data according to each second fragmentation rate.
[0092] According to an embodiment of the present disclosure, determining the first fragmentation rate of the database according to the second fragmentation rate of each table space in the database can improve the accuracy of the first fragmentation rate.
[0093] According to an embodiment of the present disclosure, determining M target databases from N databases according to a database sequence includes:
[0094] Obtaining a selection operation of the target database, wherein the selection operation includes attribute information corresponding to each target database, and the attribute information includes a database identifier, an application name, or an Internet protocol address. In response to the target data selection operation, determining the M target databases in the database sequence in order.
[0095] According to an embodiment of the present disclosure, the attribute information can be used to determine the database corresponding to the attribute information. The attribute information can include a database identifier, an application name, an Internet protocol address, and the like, or other attribute information that can achieve the same technical effects, and the present disclosure does not make specific limitations on the attribute information of the database.
[0096] According to an embodiment of the present disclosure, the selection method of the target database can select a database with a larger fragmentation rate as the target database in the database sequence according to specific implementation requirements. Alternatively, other selection criteria can be used for selection, and the present disclosure does not make specific limitations on the selection method of the target database.
[0097] According to an embodiment of the present disclosure, performing space optimization processing on each target database to generate a space optimization report includes:
[0098] In a case where the current time period is a business idle period of the target database, a space optimization application is sent to the control end. A feedback result sent by the control end to the space optimization application is acquired. In a case where the feedback result indicates that the current target database can be subjected to space optimization, the target database is subjected to space optimization processing, and a space optimization report is generated.
[0099] According to an embodiment of the present disclosure, in order not to affect the normal work of the database, for example, in a case where the target database is in a business line period, a space optimization application is sent to the control end, and after the application is passed, the target database is subjected to space optimization operation.
[0100] According to an embodiment of the present disclosure, in a case where the feedback result indicates that the current target database can be subjected to space optimization, the target database is subjected to space optimization processing, and a space optimization report is generated.
[0101] The data block reorganization and static data compression processing are performed on each table space in the target database, and a space optimization report is generated.
[0102] According to an embodiment of the present disclosure, the space optimization processing may, for example, include data block reorganization, sorting, and static data compression. Through data block reorganization and sorting, fragmented space in the database can be cleared. Through static data compression, the size of static data in the database can be reduced to release the storage pressure of the database.
[0103] According to an embodiment of the present disclosure, the database storage space optimization method further includes:
[0104] According to the space optimization report, the target database is subjected to recovery effect evaluation, and an optimization effect evaluation report is generated, wherein the optimization effect evaluation report includes optimized space amount and compressed space amount. According to the optimization effect evaluation report, a space recovery report corresponding to the target database is generated.
[0105] According to an embodiment of the present disclosure, the space optimization report may, for example, further include time information and position information of each data block reorganization and sorting, and time information and position information of static data compression. The optimization effect evaluation report may, for example, include database storage space recovery effect information.
[0106] According to an embodiment of the present disclosure, according to the optimization effect evaluation report, a space recovery report is generated. The space recovery report may, for example, be displayed in the form of an icon to increase the visibility of the space recovery report.
[0107] Figure 4 A schematic diagram of a space recovery report generation method according to an embodiment of the present disclosure is shown.
[0108] As Figure 4As shown, the method includes operations S401 to S406.
[0109] In operation S401, in response to the user's target database selection operation, the tablespaces corresponding to each database are determined. In operation S402, idle time information for the target database is obtained, and a space optimization request is sent if the target database is in an idle state. In operation S403, if the request is successful, the target database is shut down. In operation S404, the space optimization environment is prepared by reorganizing and sorting data blocks in each tablespace of the target database, and then compressing the static data in each tablespace. After processing, the space optimization environment is cleaned up, and a space optimization report is generated. In operation S405, the database is started and running; the reclamation effect is evaluated based on the space optimization report, and database performance is monitored, generating an optimization effect evaluation report. In operation S406, a space reclamation report is generated based on the optimization effect evaluation report.
[0110] According to embodiments of this disclosure, the method for determining fragmented spatial information includes:
[0111] The system sequentially retrieves the size information of each storage space in the tablespace. It compares the size of each storage space with a preset storage threshold and outputs the comparison result. If the comparison result indicates that the size of the storage space is less than the preset storage threshold, the storage space is identified as a fragmented space. The system then retrieves the attribute information for each fragmented space and generates fragmented space information.
[0112] According to embodiments of this disclosure, the preset storage threshold may include, for example, 1 MB (MByte), 4 MB, or 6 MB. Depending on specific implementation needs, the preset storage threshold may be any other arbitrary value. Attribute information may include, for example, information about the size and location of fragmented space.
[0113] Based on the above-described database storage space optimization method, this disclosure also provides a database storage space optimization device. The following will be combined with... Figure 5 The device is described in detail.
[0114] Figure 5 A schematic block diagram of a database storage space optimization apparatus according to an embodiment of the present disclosure is shown.
[0115] like Figure 5 As shown, the database storage space optimization device 500 of this embodiment includes a first acquisition module 501, a first determination module 502, a first generation module 503, a second determination module 504, and a second generation module 505.
[0116] The first obtaining module 501 is configured to obtain storage information of table spaces in a database, wherein the storage information comprises fragmentation space information of the table spaces. In an embodiment, the first obtaining module 501 can be configured to perform the operation S201 described above, and details are not repeated here.
[0117] The first determining module 502 is configured to determine a first fragmentation rate of the database according to the fragmentation space information of each table space. In an embodiment, the first determining module 502 can be configured to perform the operation S202 described above, and details are not repeated here.
[0118] The first generating module 503 is configured to generate a database sequence according to the size order of the first fragmentation rate of each database in N databases, wherein N≥1. In an embodiment, the first generating module 503 can be configured to perform the operation S203 described above, and details are not repeated here.
[0119] The second determining module 504 is configured to determine M target databases from N databases according to the database sequence, wherein N≥M≥1. In an embodiment, the second determining module 504 can be configured to perform the operation S204 described above, and details are not repeated here.
[0120] The second generating module 505 is configured to perform space optimization processing on each target database to generate a space optimization report. In an embodiment, the second generating module 505 can be configured to perform the operation S205 described above, and details are not repeated here.
[0121] According to an embodiment of the present disclosure, the fragmentation rate of each table space in the database is obtained, and the fragmentation rate of each database is determined, and each database is sorted according to the size of the fragmentation rate of each database to generate a database sequence. A plurality of target databases are determined in the database sequence, and space optimization processing is performed on the target databases to generate a space optimization report. Since the target databases are determined according to the database sequence, the databases with relatively large fragmentation rates can be optimized according to specific optimization requirements, and the effect and speed of space optimization are improved. At the same time, by performing space optimization processing on the target data, the storage pressure of the database can be relieved, and the performance of system operation can be improved. At least part of the problem of low efficiency of data scanning and slow business response caused by frequent insertion, deletion and update of active data to generate a large amount of fragmented space in the database is solved.
[0122] According to an embodiment of the present disclosure, the storage information further comprises space usage information of the table spaces.
[0123] The database storage space optimization apparatus 500 further comprises a third determining module and a third generating module.
[0124] The third determining module is configured to determine the space usage rate of the database according to the space usage information.
[0125] The third generating module is configured to generate a space report according to the first fragmentation rate and the space usage rate of each database, wherein the space report comprises a database fragmentation rate report and a database space usage rate report.
[0126] According to an embodiment of the present disclosure, the first determining module 502 comprises a first determining unit and a second determining unit.
[0127] The first determining unit is configured to determine the second fragmentation rate of each table space in the database according to the fragmented space information.
[0128] The second determining unit is configured to determine the first fragmentation rate of the data according to each second fragmentation rate.
[0129] According to an embodiment of the present disclosure, the second determining module 504 comprises a first obtaining unit and a third determining unit.
[0130] The first obtaining unit is configured to obtain a selection operation of the target database, wherein the selection operation comprises attribute information corresponding to each target database, and the attribute information comprises a database identifier, an application name or an Internet protocol address.
[0131] The third determining unit is configured to determine the M target databases in sequence in the database sequence in response to the target data selection operation.
[0132] According to an embodiment of the present disclosure, the second generating module 505 comprises a sending unit, a second obtaining unit and a generating unit.
[0133] The sending unit is configured to send a space optimization application to the control end in the case that the service idle period of the target database is at the current time end.
[0134] The second obtaining unit is configured to obtain a feedback result issued by the control end for the space optimization application.
[0135] The generating unit is configured to perform a space optimization processing on the target database and generate a space optimization report in the case that the feedback result represents that the current target database can be optimized in space.
[0136] According to an embodiment of the present disclosure, the generating unit comprises a generating subunit.
[0137] The generating subunit is configured to perform data block reorganization and static data compression processing on each table space in the target database, and generate a space optimization report.
[0138] According to an embodiment of the present disclosure, the database storage space optimization apparatus 500 further comprises a fourth generating module and a fifth generating module.
[0139] The fourth generating module is configured to perform a recycling effect evaluation on the target database according to the space optimization report, and generate an optimization effect evaluation report, wherein the optimization effect evaluation report comprises an optimized space amount and a compressed space amount.
[0140] The fifth generating module is configured to generate a space recycling report corresponding to the target database according to the optimization effect evaluation report.
[0141] According to an embodiment of the present disclosure, the database storage space optimization apparatus 500 further comprises a second obtaining module, a comparison module, a fourth determining module and a third obtaining module.
[0142] The second obtaining module is configured to sequentially obtain size information of each storage space in the table space.
[0143] The comparison module is configured to compare the size information of each storage space with a preset storage threshold, and output a comparison result.
[0144] The fourth determining module is configured to determine the storage space as a fragmented space in a case where the comparison result represents that the size information of the storage space is less than the preset storage threshold.
[0145] The third obtaining module is configured to obtain attribute information of each fragmented space, and generate fragmented space information.
[0146] According to an embodiment of the present disclosure, any multiple modules of the first obtaining module 501, the first determining module 502, the first generating module 503, the second determining module 504 and the second generating module 505 can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of the modules can be combined with at least part of the functions of other modules, and implemented in one module. According to an embodiment of the present disclosure, at least one of the first obtaining module 501, the first determining module 502, the first generating module 503, the second determining module 504 and the second generating module 505 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on substrate, a system on package, an application specific integrated circuit (ASIC), or any other reasonable manner of hardware or firmware by integrating or packaging the circuit, or implemented in any one of software, hardware and firmware or in an appropriate combination of any of the above. Alternatively, at least one of the first obtaining module 501, the first determining module 502, the first generating module 503, the second determining module 504 and the second generating module 505 can be at least partially implemented as a computer program module which can perform corresponding functions when the computer program module is run.
[0147] Figure 6 A block diagram of an electronic device suitable for implementing a data processing method according to embodiments of the present disclosure is shown schematically.
[0148] As shown in Figure 6 embodiments of the present disclosure includes a processor 601 that can perform various appropriate actions and processes in accordance with programs stored in a read only memory (ROM) 602 or loaded into a random access memory (RAM) 603 from a storage section 608. The processor 601 can include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor, and / or a related chip set, and / or a dedicated microprocessor (e.g., an application specific integrated circuit (ASIC)), and so on. The processor 601 can also include an on-board memory for cache use. The processor 601 can include a single processing unit or a plurality of processing units for performing different actions of the method processes according to embodiments of the present disclosure.
[0149] In the RAM 603, various programs and data required for the operation of the electronic device 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method processes according to embodiments of the present disclosure by executing the programs in the ROM 602 and / or the RAM 603. Note that the programs can also be stored in one or more memories other than the ROM 602 and the RAM 603. The processor 601 can also perform various operations of the method processes according to embodiments of the present disclosure by executing the programs stored in the one or more memories.
[0150] According to embodiments of the present disclosure, the electronic device 600 can also include an input / output (I / O) interface 605 that is also connected to the bus 604. The electronic device 600 can also include one or more of the following components connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as necessary. A removable recording medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 610 as necessary, so that a computer program read therefrom is installed into the storage section 608 as necessary.
[0151] The present disclosure also provides a computer readable storage medium, which can be included in the device / apparatus / system described in the above embodiments, or exist separately without being assembled into the device / apparatus / system. The above computer readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present disclosure.
[0152] According to an embodiment of the present disclosure, the computer readable storage medium can be a non-volatile computer readable storage medium, which can include, but is not limited to, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination thereof. In the present disclosure, the computer readable storage medium can be any tangible medium that contains or stores a program, which can be used by or in connection with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present disclosure, the computer readable storage medium can include one or more memories, such as the ROM 602 and / or the RAM 603 described above, and / or one or more memory units other than the ROM 602 and the RAM 603.
[0153] The embodiments of the present disclosure also include a computer program product, which includes a computer program containing program codes for executing the methods shown in the flowcharts. When the computer program product is run in a computer system, the program codes are used to make the computer system implement the item recommendation method provided by the embodiments of the present disclosure.
[0154] The above functions defined in the system / apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 601. According to an embodiment of the present disclosure, the system, apparatus, module, unit, etc. described above can be implemented by computer program modules.
[0155] In one embodiment, the computer program can rely on a tangible storage medium, such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program can also be transmitted, distributed, and downloaded in the form of a signal via a network medium, and be downloaded and installed via the communication part 609 and / or installed from the detachable medium 611. The program codes contained in the computer program can be transmitted via any appropriate network medium, including but not limited to wireless, wired, etc., or any appropriate combination thereof.
[0156] In such embodiments, the computer program can be downloaded and installed from the network via the communication section 609, and / or installed from the removable media 611. When the computer program is executed by the processor 601, the above-described functions defined in the system of the embodiments of the present disclosure are executed. According to the embodiments of the present disclosure, the system, device, apparatus, module, unit, and the like described above can be implemented by the computer program modules.
[0157] According to the embodiments of the present disclosure, the program code for executing the computer program provided by the embodiments of the present disclosure can be written in any combination of one or more programming languages, and specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming language, and / or assembly / machine language. The programming language includes, but is not limited to, such as Java, C++, python, "C" language, or similar programming language. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case involving a remote computing device, the remote computing device can be connected to the user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, connected through the Internet by using an Internet service provider).
[0158] The flowcharts and block diagrams in the drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowcharts or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in a different order than that shown in the figures. For example, two blocks noted in succession can actually be executed substantially concurrently, or they can sometimes be executed in reverse order, depending on the functionality involved. It should also be noted that each block in the flowcharts or block diagrams, and combinations of blocks in the flowcharts or block diagrams, can be implemented by dedicated hardware-based systems that perform the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0159] Those skilled in the art can understand that the features described in various embodiments of the present disclosure and / or claims can be combined or / and integrated, even if such combinations or integrations are not explicitly described in the present disclosure. In particular, the features described in various embodiments of the present disclosure and / or claims can be combined and / or integrated in various combinations, without departing from the spirit and teachings of the present disclosure. All these combinations and / or integrations fall within the scope of the present disclosure.
[0160] The above described embodiments of the present disclosure. However, these embodiments are merely for illustrative purposes, and are not intended to limit the scope of the present disclosure. Although each embodiment is described above separately, this does not mean that the measures in each embodiment cannot be advantageously used in combination. The scope of the present disclosure is defined by the appended claims and their equivalents. Those skilled in the art can make various substitutions and modifications without departing from the scope of the present disclosure, and all such substitutions and modifications shall fall within the scope of the present disclosure.
Claims
1. A database storage space optimization method, comprising: obtaining storage information of table spaces in a database, wherein the storage information comprises fragmentation space information of the table spaces and space usage information of the table spaces, the database is used for deleting, adding or replacing active data, the active data is used for business response, and the fragmentation space comprises free space between two adjacent data blocks in the table spaces; determining a first fragmentation rate of the database according to the fragmentation space information of each table space; generating a database sequence in N databases according to the size order of the first fragmentation rate of each database, wherein N≥1; in response to a selection operation, determining M target databases from the N databases in sequence, wherein N≥M≥1, the selection operation comprises a database identifier, an application name or an Internet protocol address corresponding to each target database; performing space optimization processing on each target database to generate a space optimization report, wherein the space optimization processing comprises data block reorganization, sorting and static data compression, the space optimization report comprises time information and position information of each data block reorganization, sorting, and time information and position information of static data compression; performing a recycling effect evaluation on the target database according to the space optimization report to generate an optimization effect evaluation report, wherein the optimization effect evaluation report comprises an optimized space amount and a compressed space amount; and generating a space recycling report corresponding to the target database according to the optimization effect evaluation report, the space recycling report being displayed in the form of an icon; wherein the method further comprises: generating a space report according to the first fragmentation rate and a space usage rate of each database, the space usage rate being determined according to the space usage information of the table spaces, the space report comprising a menu area, a database fragmentation rate report area, a database space usage rate report area and a detailed information display area; the menu area is used for providing selection of a menu page, the database fragmentation rate report area is used for displaying a database fragmentation rate ranking table, the database space usage rate report area is used for displaying a database space usage rate ranking table, and the detailed information display area is used for displaying basic attribute information of each database, the basic attribute information comprising at least one of the following: the database identifier, a database name, a space allocation amount, a table space number, the application name, the Internet protocol address and a database version.
2. The method of claim 1, wherein, determining the first fragmentation rate of the database according to the fragmentation space information of each table space comprises: determining a second fragmentation rate of each table space in the database according to the fragmentation space information; determining the first fragmentation rate of the data according to each second fragmentation rate.
3. The method of claim 1, wherein, performing space optimization processing on each target database to generate a space optimization report comprises: in the case that a current time end is a business idle time period of the target database, sending a space optimization application to a control end; obtaining a feedback result of the control end for the space optimization application. In a case where the feedback result indicates that the target database can be currently subjected to spatial optimization, performing spatial optimization processing on the target database to generate a spatial optimization report.
4. The method of claim 3, wherein, In a case where the feedback result indicates that the target database can be currently subjected to spatial optimization, performing spatial optimization processing on the target database to generate a spatial optimization report includes: performing data block reorganization and static data compression processing on each of the table spaces in the target database to generate the spatial optimization report.
5. The method of claim 1, wherein, The method for determining the fragmentation space information includes: obtaining size information of each storage space in the table space in sequence; comparing the size information of each storage space with a preset storage threshold to output a comparison result; in a case where the comparison result indicates that the size information of the storage space is less than the preset storage threshold, determining the storage space as a fragmented space; obtaining attribute information of each fragmented space to generate the fragmentation space information.
6. A database storage space optimization apparatus, comprising: a first obtaining module configured to obtain storage information of table spaces in a database, wherein the storage information includes fragmentation space information of the table spaces and space usage information of the table spaces, the database is used for deleting, adding or replacing active data, the active data is used for business response, and a fragmented space includes free space between two adjacent data blocks in the table space; a first determining module configured to determine a first fragmentation rate of the database according to the fragmentation space information of each table space; a first generating module configured to generate a database sequence according to a size order of the first fragmentation rate of each database from N databases, wherein N≥1; a second determining module configured to determine M target databases from the N databases in sequence in response to a selection operation, wherein N≥M≥1, the selection operation includes a database identifier, an application name or an Internet Protocol address corresponding to each target database; a second generating module configured to perform spatial optimization processing on each target database to generate a spatial optimization report, wherein the spatial optimization processing includes data block reorganization, sorting and static data compression, and the spatial optimization report includes time information and position information of each data block reorganization, sorting, and time information and position information of static data compression; a fourth generating module configured to perform a recycling effect evaluation on the target database according to the spatial optimization report to generate an optimization effect evaluation report, wherein the optimization effect evaluation report includes an optimized space amount and a compressed space amount; and a fifth generating module configured to generate a space recycling report corresponding to the target database according to the optimization effect evaluation report, and the space recycling report is displayed in the form of an icon. The device further comprises: generating a space report according to the first fragmentation rate and the space usage rate of each database, the space usage rate being determined according to the space usage information of the table space, the space report comprising a menu area, a database fragmentation rate report area, a database space usage rate report area and a detailed information display area; the menu area is used to provide selection of menu pages, the database fragmentation rate report area is used to display a database fragmentation rate ranking table; the database space usage rate report area is used to display a database space usage rate ranking table; and the detailed information display area is used to display basic attribute information of each database, the basic attribute information comprising at least one of the following: the database identifier, the database name, the space allocation amount, the table space number, the application name, the Internet protocol address and the database version. 7.An electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method according to any one of claims 1-5. 8.A computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the method according to any one of claims 1-5. 9.A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-5.
Citation Information
Patent Citations
Storage space arrangement method, device and system based on distributed system
CN107368260A
Automatic processing method, system and device for table space fragmentation and storage medium
CN111930739A